2008-08-10 64 views
8

當試圖編譯我的C#項目,我得到以下錯誤:無效的資源文件

'C:\Documents and Settings\Dan\Desktop\Rowdy Pixel\Apps\CleanerMenu\CleanerMenu\obj\Debug\CSC97.tmp' is not a valid Win32 resource file. 

已經經歷了許多谷歌搜索了,我已經確定,這通常是由一個圖標內的256×256的圖像使用造成的由該項目。我瀏覽了所有圖標並刪除了256x256版本,但錯誤仍然存​​在。任何想法如何擺脫這個?


@Mike:它一晚上神祕地出現了。我搜索了csproj文件,但沒有提及CSC97.tmp(我也檢查瞭解決方案文件,但是我沒有運氣)。如果有幫助,我發佈了contents of the csproj file on 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 ========== 

我還上傳了我使用的圖標。你可以view it here.


@Mike:謝謝!刪除除32x32圖像以外的所有內容後,所有操作都很順利。現在我可以回過頭來逐個添加其他尺寸,看看哪一個讓我感到悲傷。 :)

@Derek:自從我第一次得到錯誤,我做了一個完整的Windows重新安裝(並與它一起,SDK)。這不是重新安裝的主要原因,但我有一個渺茫的希望它能解決問題。

現在,如果只有我能弄清楚,爲什麼它以前與所有其他尺寸工作...

+6

請添加您的答覆或感謝評論中沒有問題。 – 2013-01-09 06:01:10

回答

5

我不知道這是否會幫助,但this forum

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.

嘗試在圖標編輯器中打開該圖標,看看你看其他格式,如描述的(也嘗試刪除圖標並查看項目是否會再次生成,只是爲了驗證該圖標是否導致它)。

0

這是一個文件,您創建並添加到項目或沒有它神祕現身?

你也許可以檢查你的.csproj文件,看看它是如何被引用的(它應該是一個簡單的xml文件,你可以搜索CSC97.tmp)。

也許張貼您找到信息,所以我們可以有更多的細節,以幫助您解決問題

0

環顧四周,似乎有些人通過修復或重新安裝.NET SDK解決了這個。你可能想嘗試一下。

P.S.我明白了爲什麼你現在沒有包含更多的編譯器輸出。沒有太多的真正看到那裏。 :)

7

我有一個類似的問題,在構建日誌中出現「obj/debug/* .tmp」文件錯誤。原來我的C:\驅動器空間不足。清除一些空間後,我的構建開始工作。