Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Assembly with same name is already loaded" error when using two different versions of same task factory in MSBuild 15.3 for .NET Core #2501

Closed
stazz opened this issue Sep 7, 2017 · 3 comments
Labels

Comments

@stazz
Copy link

stazz commented Sep 7, 2017

Hi,

I've noticed an inconsistent behaviour in MSBuild 15.3 when there are two projects built which use different versions of the same task factory. In .NET Desktop, the build completes successfully, while in .NET Core, the build is terminated in error: error MSB4175: The task factory "UtilPack.NuGet.MSBuild.NuGetTaskRunnerFactory" could not be loaded from the assembly "~\.nuget\packages\utilpack.nuget.msbuild\1.1.0\build\\netcoreapp1.1\UtilPack.NuGet.MSBuild.dll". Assembly with same name is already loaded".

I've attached the minimal set of files required to reproduce this. For .NET Desktop, run command "c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" /t:TestTarget main.build. For .NET Core, run command dotnet msbuild /t:TestTarget main.build. It seems that using UnloadProjectsOnCompletion property on MSBuild task in main.build has no effect.

Here is the attached zip file, containing all required files to reproduce the issue: task_factory_issue_reproduce.zip. Zip file contains main.build file, which will be used as entrypoint, and it will restore & execute the .build files in subdirectories. Those .build files will use different versions of the same task factory (which is visible by including PackageReference to UtilPack.NuGet.MSBuild NuGet package).

I guess this is a bug on .NET Core version of MSBuild?

@stazz stazz changed the title Inconsistent behaviour when using two different versions of same task factory "Assembly with same name is already loaded" error when using two different versions of same task factory in MSBuild 15.3 for .NET Core Sep 11, 2017
@herebebeasties
Copy link

As an example of a use-case that is impacted by this, this prevents you from using two different versions of things like NerdBank.GitVersioning in a solution, meaning you need to upgrade everything simultaneously in lockstep, which is hard to achieve in large monorepos. It'd be great to get this fixed. 👍

@rainersigwald
Copy link
Member

This should be resolved by #4916. Please let us know if you see otherwise on MSBuild 16.5 or higher.

@marcin-krystianc
Copy link
Contributor

I can confirm that this is fixed now, thanks!

@AR-May AR-May added the triaged label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants