Fody not playing well with MSBuild when updating Fody-versions
See original GitHub issueAttached is a solution with the new csproj format (this bug is also present with the old csproj format).
It’s a console application with Fody 3.0.0
and PropertyChanged.Fody 2.4.0,
just to have an example.
There is also a pretty minimal config.msbuild
-file, a build.cmd
to run msbuild.
Do not open it in Visual Studio (Visual Studio works fine, MSBuild does not).
Before doing anything, clear the nuget caches (C:\Users\Username\.nuget\packages
for me)
Open a CMD prompt and navigate to the dir, and run build.cmd
. It will restore the Fody and PropertyChanged.Fody packages, and then under FodyTarget, note that it says Fody: Fody (version 3.0.0.0) Executing
.
Then open FodyTestNewFormat.csproj
in a text editor, and change the version of Fody to 3.1.4
, and save. (As would happen if changing branch in git and the branches had different Fody-versions)
Go back to the CMD prompt and run build.cmd
again. It will restore Fody 3.1.4
correctly from NuGet, but under FodyTarget, it still says Fody: Fody (version 3.0.0.0) Executing
.
If you run build.cmd
again without altering anything, you might get it to use Fody 3.1.4
This bug also works with decrementing the version (and it then using the higher version).
The versions selected here are randomly selected, and works with eachother, but if the versions are not compatible, then it will fail the build, even though the versions in the .csproj
are compatible with eachother!
Issue Analytics
- State:
- Created 5 years ago
- Comments:18 (9 by maintainers)
This sounds like it is related to MsBuild Node Reuse - which is one of it’s worst features and has only caused pain for me so far.
You can disable it either through a command line argument, or globally through an environment variable.
I’d suggest the env var:
MSBUILDDISABLENODEREUSE=1
https://blogs.msdn.microsoft.com/msbuild/2007/04/16/node-reuse-in-multiproc-msbuild/Thank you for that reproduction-zip, @tom-englert. You proved that it was not related to Fody, so we can close this issue. I have raised an issue with msbuild. Regarding your second point: I was able to reproduce it by msbuild generally, without using the
config.msbuild