MSBuild trying to copy different dll with similar name into project sporadically

17 views Asked by At

We are using MSBuild through command line for daily builds. The build fails now about 70% of the time but not always. The solution has multiple WCF projects that are being published. When going through build logs we notice when MSBuild is trying to publish the first service and if it fails the build is trying to copy a class library named Example.Library.dll which should not be referenced anywhere with this service.
When MSBuild succeeds is will copy a class library named Example.Library.Extensions.dll. Which is correct as it is referenced in supporting classes.

It appears MSBuild is for some reason getting the file name wrong when building out dependencies seeing something similar and using that. Both these class libraries are projects in the solution and are referenced as project references. This is all happening in the "CopyAllFilesToSingleFolderForPackage" step.

Here is our build line

msbuild.exe solution.sln /p:Configuration=Release 
/p:BuildProjectReferences=True /t:"Restore;Build" 
/p:IntermediateOutputPath="C:\temp" /p:DeployOnBuild=True 
/p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=FileSystem 
/p:DeleteExistingFiles=True /p:publishUrl="C:\publish"

This happens using VS Build tools 2019 and 2022. After this started we upgraded 2019 to the latest release and when that didn't work we tried VS build tools 2022. This is been happening for a month now and is completely at random. Sometimes it fails constantly, sometimes it only fails one out of 5 times.

We tried using different Intermediate paths as well. No Luck.

0

There are 0 answers