资源文件无效

Dan*_*ker 11 c# resources visual-studio

在尝试编译我的C#项目时,我收到以下错误:

'C:\Documents and Settings\Dan\Desktop\Rowdy Pixel\Apps\CleanerMenu\CleanerMenu\obj\Debug\CSC97.tmp' is not a valid Win32 resource file.
Run Code Online (Sandbox Code Playgroud)

经过多次Google搜索后,我确定这通常是由项目使用的图标中的256x256图像引起的.我已经浏览了所有图标并删除了256x256版本,但错误仍然存​​在.关于如何摆脱这个的任何想法?


@Mike:一天晚上神秘地出现了.我搜索了csproj文件,但没有提到CSC97.tmp(我也检查了解决方案文件,但我也没有运气).如果它有帮助,我已经在pastebin上发布了csproj文件内容.

@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 ==========
Run Code Online (Sandbox Code Playgroud)

我还上传了我正在使用的图标.你可以在这里查看.


@Mike:谢谢!删除除32x32图像以外的所有内容后,一切都很顺利.现在我可以回过头来逐一添加其他尺寸,看看哪一个让我感到悲伤.:)

@Derek:自从我第一次收到错误以来,我已经完成了Windows的重新安装(以及它的SDK).这不是重新安装的主要原因,但我希望它能解决问题.

现在,如果我能弄清楚为什么它之前适用于所有其他尺寸...

med*_*ire 7

我的构建日志中出现了"obj/debug/* .tmp"文件错误的类似问题.结果我的C:\驱动器空间不足.清除一些空间后,我的构建开始工作.


Mik*_*one 6

我不知道这是否有帮助,但是从这个论坛:

将.ico文件添加到属性页面的应用程序部分,并收到已描述的错误,当我使用图标编辑器检查图标文件时,发现文件有多个版本的图像即(16 x 16,24 x 24,32 x 32,48 x 48 vista压缩),我删除了其他格式,我不想重新保存文件(只需32x 32),现在应用程序编译没有错误.

尝试在图标编辑器中打开图标,看看是否看到其他格式(也可以尝试删除图标,看看项目是否会再次构建,只是为了验证图标是否导致它).