Open dfederm opened 6 years ago
Hello I am having the same issue.
MSB4062 The "Microsoft.CodeAnalysis.BuildTasks.Csc" task could not be loaded from the assembly C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Roslyn\Microsoft.Build.Tasks.CodeAnalysis.dll. Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the
Can Anyone tell me solution if found? I am using 2017 15.8.2 Version.
Please help. Thanks
@manish10sharma I think that is a distinct problem. Are you also using a custom MSBuild host executable? If so, I suspect you need to add binding redirects for MSBuild assemblies to the 15.0 versions. Using the Microsoft.Build.Locator package can help with that.
I have tried that even, But it throwing same error. I am attaching my packages file. May be something conflicting.
@manish10sharma I think the Locator package only adds the binding redirects for you if you use PackageReference
style NuGet references. Did you try manually adding binding redirects like the ones we use in MSBuild.exe?
Yes, I already tried that all. See the errors, I am facing When I hit Build Command
Steps to reproduce
Minimal repro located here: https://github.com/dfederm/msbuild/tree/csc-not-found-custom-toolset/src/Samples/CscNotFoundWithCustomToolset
After building, run something like:
Expected behavior
The Compile target succeeds
Actual behavior
Output:
Environment data
Using the latest version of Microsoft.Build.Runtime (15.5.180.1)
Other
Talked with @cdmihai and one guess to a solution would be to change Microsoft.Common.tasks from:
to
That way it always looks next to Roslyn adjacent to the same place it imported the targets from.
Or actually I wonder why the Roslyn tasks aren't defined as a
<UsingTask>
in the Roslyn targets in the first place like any other task. IMHO the Csc task doesn't need to be "special".