sdk: Can't run Desktop-Compiled MsBuild tasks installed from NuGet
Steps to reproduce
- Create empty Web / Library project.
- Add .less file with any valid content.
- Install Web Compiler extension.
- Enable compilation of the .less file.
- Enable compilation on build.
- Run
dotnet restore. - Run
dotnet build.
See MsBuildTask.zip.
Expected behavior
- The
WebCompiler.CompilerBuildTasktask should compile the .less file.
Actual behavior
An exception is thrown:
error MSB4062: The "WebCompiler.CompilerBuildTask" task could not be loaded from the assembly C:\Users\dusan\.nuget\packages\buildwebcompiler\1.11.326\build\..\tools\WebCompiler.exe. Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. Confirm that the <UsingTask> 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. [H:\~Temp\MsBuildTask\MsBuildTask\MsBuildTask.csproj]
It is not related to this particular MsBuild task. AFAIK every task installed from nuget won’t work from command line. Everything works when running build with VS 2017 RC (15.0.26020.0 D15REL) or msbuild command.
Environment data
.NET Command Line Tools (1.0.0-preview4-004233)
Product Information:
Version: 1.0.0-preview4-004233
Commit SHA-1 hash: 8cec61c6f7
Runtime Environment:
OS Name: Windows
OS Version: 10.0.15014
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\1.0.0-preview4-004233
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 16 (10 by maintainers)
@ViktorHofer same issue here but using msbuild instead is not an option as it runs into a different set of problems in a solution of 50+ projects targeting either netstandard2.0 or net461.
Some suggestions say use “dotnet build” instead of msbuild, some other sources suggest the opposite. Problem is none of the two works reliably. Running any of them against a solution file doesn’t work at all, so we created our own build tool. It’s a big mess from the perspective of a maintainer of old-ish code (net461, old/new csproj file format) and new code (netstandard2.0). It’s just sad and disappointing, cause a large amount of wasted time.
No need to reopen this issue. Just need to vent somewhere. 😃
Issue is resolved with newest Xamarin.Forms version! 👍
UPDATE: no it’s not. See below.