I'm having an issue trying to build a dotnet core project from command line that has these references:
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.6.1" />
<PackageReference Include="Microsoft.Net.Compilers" Version="2.6.1" />
For whatever reason it keeps saying Microsoft.Build.Tasks.CodeAnalysis.dll
assembly has already been loaded. Here is the exact error message:
C:\Users.nuget\packages\microsoft.net.compilers\2.6.1\tools\Microsoft.CSharp.Core.targets(84,5): error MSB4062: The "Microsoft.CodeAnalysis.BuildTasks.Csc" task could not be loaded from the assembly
C:\Users.nuget\packages\microsoft.net.compilers\2.6.1\build..\tools\Microsoft.Build.Tasks.CodeAnalysis.dll. Assembly with same name is already loaded Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
When I go to that project directory and run dotnet build
It has no issues building the project, but when I run dotnet build against the solution that's when I get this error. If I build the solution from Visual Studio it also has no issues building. Really strange behavior, not quite sure how to get around it.