Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF Warning with VSTS: Different checksum values given for '*.g.cs' Files

In Visual Studio 2008 Team System, this is my warning:

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

The offending line in the SomeFile.g.cs file is:

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

I deleted all of the *.g.cs files in the Solution and rebuilt and all of the warnings came back. What the hell is this?

like image 889
rasx Avatar asked Dec 11 '09 18:12

rasx


1 Answers

It looks like Visual Studio doesn't handle very long paths correctly when generating GUIDs. I confirmed this by adding two different files into a long path and reproduced the behavior you are seeing. If you look in the offending SomeFile.g.cs files you will notice that the guids for the two files are the same. Apparently Visual Studio only checks the first x characters of the file path when generating this GUID.

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)

From the .g.cs files:

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

As for a solution, I guess you could either shorten your paths or (more likely) ignore these warnings. :)

like image 144
Ben Collier Avatar answered Nov 15 '22 06:11

Ben Collier