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

The "WebCompiler.CompilerBuildTask" task could not be loaded from the assembly #351

Open
ecoffman opened this issue Dec 13, 2017 · 4 comments

Comments

@ecoffman
Copy link

Installed product versions

  • Visual Studio: VS Enterprise 2017
  • This extension: 1.11.326

Description

The "WebCompiler.CompilerBuildTask" task could not be loaded from the assembly

Steps to recreate

dotnet restore .\src
dotnet publish "$scriptPath\src" -c Release -r win10-x64 -o "$scriptPath\build"

Current behavior

C:\Users\eric.nuget\packages\buildwebcompiler\1.11.326\build\BuildWebCompiler.targets(15,9): error MSB4062: The "WebCompiler.CompilerBuildTask" task could not be loaded from the assembly C:\Users\eric.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 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. [C:\develop\pattnc\src\pattnc\pattnc.csproj]

Expected behavior

Compile SCSS into CSS.

@tjdavis1111
Copy link

tjdavis1111 commented Dec 29, 2017

Installed Products

  • Microsoft Visual Studio Community 2017 - Version 15.5.2
  • Web Compiler - 1.11.326

Steps to Recreate
dotnet ef migrations add "Identity" -o "Data\Migrations" -v

Current Behavior
C:\Users\davistj.nuget\packages\buildwebcompiler\1.11.326\build\BuildWebCompiler.targets(15,9): error MSB4062: The "WebCompiler.CompilerBuildTask" task could not be loaded from the assembly C:\Users\davistj.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 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. [C:\LNGOAKTFSA001\0_Internal\TestMakerFree\TestMakerFreeWebApp\TestMakerFreeWebApp.csproj]

Expected Behavior
Compiled into Migration

@tjdavis1111
Copy link

tjdavis1111 commented Dec 29, 2017

Here's how I resolved:

1.) Updated "Microsoft.Build.Utilities.Core" to V15.5.180

2.) Add the following to .csproj
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="15.5.180" />

3.) Rebuilt the solution

4.) Ran "dotnet ef migrations add "Identity" -o "Data\Migrations" -v"

@JimiSweden
Copy link

JimiSweden commented Jun 5, 2018

My solution:
use BuildWebCompiler version 1.11.375
do a forced restore av packages (this was a crucial part)

cmd lines:
dotnet add package version 1.11.375
dotnet restore -- force

.csproj
<PackageReference Include="BuildWebCompiler" Version="1.11.375" />

Problem:
I had a similar problem (the same error) on our buildserver, build was successfull in VS 2017. The same error occurred locally when using cmd "dotnet build"
I followed suggestion above and added "Microsoft.Build.Utilities.Core" with no success.

Related problem and solution:
I also use BuildBundlerMinifier and with version 2.8.391 I got the build error message "Bundler & Minifier error 0: Could not load file or assembly 'NUglify, Version=1.5.10.0"
as pointed out in madskristensen/BundlerMinifier#353 (comment) I downgraded to version 2.6.362

<PackageReference Include="BuildBundlerMinifier" Version="2.6.362" />

Note: if you use bootstrap 4 read the issue linked above as there is a bug in 2.6.362 and a workaround for build steps are pointed out by axelheer

motivity-chris added a commit to motivity-chris/WebCompiler that referenced this issue Oct 1, 2019
madskristensen#351: the _WebCompilerTaskAssembly paths defined in build/BuildWebCompiler.targets are intended to be relative to that file, but may not always be interpreted as such.  using $(MSBuildThisFileDirectory) ensures that they always are.
@motivity-chris
Copy link

i was unable to work around the problem by pinning the aforementioned versions, so i addressed the problem directly in PR #437, which ensures that the _WebCompilerTaskAssembly paths defined in build/BuildWebCompiler.targets are always relative that file (as they were intended to be).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants