VS Project References Broken On Case Sensitivity of GUID

前端 未结 5 1063
旧巷少年郎
旧巷少年郎 2020-12-09 03:03

Since upgrading to VS 2015, my team has experienced random quirky things which I\'m sure are being worked out at Microsoft right now. One pretty annoying one is that we see

5条回答
  •  醉梦人生
    2020-12-09 03:30

    Today in visual studio 2019 (16.2.2) I was encountering build system issues where projects were being unnecessarily (and repeatedly) rebuilt whenever I initiated the building of my solution.

    (None of the usual steps resolved the build issues, eg deleting the ".vs" folder, or deleting "bin" and "obj" directories, etc).

    At first it appeared to be related to the character-casing of guids, because I was able to get the problem to go away by editing the guids and saving the project. However that was a red-herring ... I was unwittingly fixing the problem by changing the timestamps of all my csproj files. The build system seemed a lot happier after those timestamps were updated, and it stopped the annoying behavior (continuously attempting to rebuild projects that had already been built.)

    The character casing of the guids didn't end up being the problem at all. As far as I can tell, VS 2019 is ok with both upper- and lower-case guids. They can even mismatch the source project, based on my experimentation (eg. the original source project can use uppercase and referencing projects can use lowercase).

    If it is helpful to anyone, below is a powershell that will let you adjust the write-time of all csproj files under a path. This will be another trick I use whenever the msbuild system is misbehaving in visual studio.

    $datenow = get-date
    
    $files = Get-ChildItem -path "C:\Data\Workspaces\LumberTrack\" -recurse | where { $_.PSIsContainer -eq $false} 
    
    foreach ($file in $files)
    {
    if ($file.Extension -eq ".csproj") 
    {
       Set-ItemProperty $file.FullName LastWriteTime $datenow
       Write-Output $file.FullName
    }    
    }    
    }    
    

提交回复
热议问题