无效的资源文件
时间:2020-03-05 18:38:48 来源:igfitidea点击:
尝试编译Cproject时,出现以下错误:
'C:\Documents and Settings\Dan\Desktop\Rowdy Pixel\Apps\CleanerMenu\CleanerMenu\obj\Debug\CSC97.tmp' is not a valid Win32 resource file.
经过多次Google搜索后,我确定这通常是由该项目使用的图标内的256x256图片引起的。我浏览了所有图标并删除了256x256版本,但错误仍然存在。关于如何摆脱这一点的任何想法?
@迈克:它神秘地出现了一个晚上。我已经搜索了csproj文件,但是没有提到CSC97.tmp(我也检查了解决方案文件,但是那里也没有运气)。如果有帮助,我已经将csproj文件的内容发布到pastebin上。
@Derek:没问题。这是编译器的输出。
------ Build started: Project: Infralution.Licensing, Configuration: Debug Any CPU ------ Infralution.Licensing -> C:\Documents and Settings\Dan\Desktop\Rowdy Pixel\Apps\CleanerMenu\Infralution.Licensing\bin\Debug\Infralution.Licensing.dll ------ Build started: Project: CleanerMenu, Configuration: Debug Any CPU ------ C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /main:CleanerMenu.Program /reference:"C:\Documents and Settings\Dan\Desktop\Rowdy Pixel\Apps\CleanerMenu\Infralution.Licensing\bin\Debug\Infralution.Licensing.dll" /reference:..\NotificationBar.dll /reference:..\PSTaskDialog.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:obj\Debug\Interop.IWshRuntimeLibrary.dll /debug+ /debug:full /optimize- /out:obj\Debug\CleanerMenu.exe /resource:obj\Debug\CleanerMenu.Form1.resources /resource:obj\Debug\CleanerMenu.frmAbout.resources /resource:obj\Debug\CleanerMenu.ModalProgressWindow.resources /resource:obj\Debug\CleanerMenu.Properties.Resources.resources /resource:obj\Debug\CleanerMenu.ShortcutPropertiesViewer.resources /resource:obj\Debug\CleanerMenu.LocalizedStrings.resources /resource:obj\Debug\CleanerMenu.UpdatedLicenseForm.resources /target:winexe /win32icon:CleanerMenu.ico ErrorHandler.cs Form1.cs Form1.Designer.cs frmAbout.cs frmAbout.Designer.cs Licensing.cs ModalProgressWindow.cs ModalProgressWindow.Designer.cs Program.cs Properties\AssemblyInfo.cs Properties\Resources.Designer.cs Properties\Settings.Designer.cs Scanner.cs ShortcutPropertiesViewer.cs ShortcutPropertiesViewer.Designer.cs LocalizedStrings.Designer.cs UpdatedLicenseForm.cs UpdatedLicenseForm.Designer.cs error CS1583: 'C:\Documents and Settings\Dan\Desktop\Rowdy Pixel\Apps\CleanerMenu\CleanerMenu\obj\Debug\CSC97.tmp' is not a valid Win32 resource file Compile complete -- 1 errors, 0 warnings ------ Skipped Build: Project: CleanerMenu Installer, Configuration: Debug ------ Project not selected to build for this solution configuration ========== Build: 1 succeeded or up-to-date, 1 failed, 1 skipped ==========
我还上传了我正在使用的图标。我们可以在这里查看。
@Mike:谢谢!删除除32x32图像以外的所有内容后,所有内容均运行良好。现在,我可以返回并逐一添加其他尺寸,以查看哪个尺寸引起了我的悲伤。 :)
@Derek:自从我第一次遇到错误以来,我已经完成了Windows的完整安装(以及SDK的重新安装)。这不是重新安装的主要原因,但是我苗条地希望它能够解决问题。
现在,只要我能弄清楚为什么它以前可以与所有其他尺寸一起使用...
解决方案
回答
这是我们创建并添加到项目中的文件,还是神秘地显示出来?
我们也许可以检查.csproj文件并查看其引用方式(该文件应该是简单的xml文件,并且可以搜索CSC97.tmp)。
也许发布我们找到的信息,以便我们可以提供更多详细信息来解决问题
回答
环顾四周,似乎有些人通过修复或者重新安装.NET SDK来解决此问题。我们可能想尝试一下。
P.S.我知道为什么我们现在不包括更多的编译器输出。真的看不到那里。 :)
回答
我不知道这是否有帮助,但是可以从这个论坛上:
Add an .ico file to the application section of the properties page, and recieved the error thats been described, when I checked the Icon file with an icon editor, it turn out that the file had more than one version of the image ie (16 x 16, 24 x 24, 32 x 32, 48 x 48 vista compressed), I removed the other formats that I didnt want resaved the file (just with 32x 32) and the application now compiles without error.
尝试在图标编辑器中打开图标,看看是否看到上述其他格式(同样,尝试删除图标并查看项目是否会再次生成,只是为了验证图标是由它引起的)。