2009-12-11 30 views
6

在Visual Studio 2008 Team System中給出不同的校驗值,這是我的警告:WPF與VSTS警告: '* .g.cs' 文件

Different checksum values given for '<some folder>' ...\Visual Studio 2008\Projects\... 
\Debug\...\SomeFile.g.cs 

SomeFile.g.cs文件中的那一行是:

#pragma checksum "..\..\..\..\..\..\...\SomeFile.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "A18BC47B27EC4695C69B69F1831E3225" 

我刪除在溶液中*.g.cs文件的所有和重建,所有的警告回來。這到底是什麼?

+1

你有機會有一些文件正在生成真正長的路徑?此警告應該表示有兩個名稱相同的文件,並且Visual Studio無法確定要從哪個文件進行調試,但可能會在將它們相互比較時在某個點處截斷路徑。 – 2009-12-11 20:00:33

回答

10

它看起來像生成GUID時,Visual Studio不能正確處理很長的路徑。我通過將兩個不同的文件添加到漫長的路徑中,證實了這一點,並重現了您所看到的行爲。如果您查看有問題的SomeFile.g.cs文件,您會注意到兩個文件的GUID是相同的。顯然,Visual Studio在生成此GUID時僅檢查文件路徑的第一個x字符。

C:\Users\Developer\Documents\Visual Studio 2008\Projects\WpfApplication1\WpfApplication1\obj\Debug\LongFolderNameLongFolderNameLongFolderName\LongFolderNameLongFolderNameLongFolderName\LongFolderNameLongFolderNameLongFolderName\SomeFileName1.g.cs(1,1): warning CS1697: Different checksum values given for 'c:\Users\Developer\Documents\Visual Studio 2008\Projects\WpfApplication1\WpfApplication1\LongFolderNameLo' 
C:\Users\Developer\Documents\Visual Studio 2008\Projects\WpfApplication1\WpfApplication1\obj\Debug\LongFolderNameLongFolderNameLongFolderName\LongFolderNameLongFolderNameLongFolderName\LongFolderNameLongFolderNameLongFolderName\SomeFileName2.g.cs(1,1): (Related location) 

從.g.cs文件:

#pragma checksum "..\<snipped>\SomeFileName1.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "F21D94943016E57893CEB405BE12ADEA" 
#pragma checksum "..\<snipped>\SomeFileName2.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "C67F2F8C841E2C338E5FCDC5037E8454" 

至於解決的辦法,我想你既可以縮短你的路或(更可能)忽略這些警告。 :)

+0

我會在我的終點確認它,但這感覺就像是正確的解決方案! – rasx 2009-12-11 22:33:04

+0

確認!這*是解決方案! – rasx 2009-12-12 00:29:57

+0

這是微軟提出的嗎? – 2011-04-19 10:57:15