在Visual Studio 2008团队系统中,这是我的警告:

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文件并进行了重建,所有警告都回来了。这到底是什么?

最佳答案

看起来Visual Studio在生成GUID时无法正确处理非常长的路径。我通过在长路径中添加两个不同的文件来确认这一点,并重现了您所看到的行为。如果查看有问题的SomeFile.g.cs文件,您会注意到这两个文件的向导是相同的。显然,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"

至于解决方案,我想您可以缩短路径或者(更可能)忽略这些警告。 :)

关于wpf - 带有VSTS的WPF警告: Different checksum values given for '*.g.cs' Files,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/1890159/

10-14 05:26