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

Error MSB3086: Task could not find "al.exe" #326

Closed
mrmonday opened this issue Jul 18, 2019 · 4 comments

Comments

@mrmonday
Copy link

commented Jul 18, 2019

Using the following:

ClassLibrary1.zip

Expand-Archive .\ClassLibrary1.zip -DestinationPath .
cd .\ClassLibrary1\
docker build --no-cache .

Gives:

Sending build context to Docker daemon  22.02kB
Step 1/4 : FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019 AS build
 ---> c4fa4ec9c73e
Step 2/4 : WORKDIR /app
 ---> Running in 90fecf98cd9e
Removing intermediate container 90fecf98cd9e
 ---> e7579afcccce
Step 3/4 : COPY . .
 ---> 228b37d71341
Step 4/4 : RUN msbuild.exe /restore ClassLibrary1.csproj
 ---> Running in 10e4beba041a
Microsoft (R) Build Engine version 16.1.76+g14b0a930a7 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 7/18/2019 2:51:58 PM.
Project "C:\app\ClassLibrary1.csproj" on node 1 (Restore target(s)).
Restore:
  Restoring packages for C:\app\ClassLibrary1.csproj...
  Committing restore...
  Generating MSBuild file C:\app\obj\ClassLibrary1.csproj.nuget.g.props.
  Generating MSBuild file C:\app\obj\ClassLibrary1.csproj.nuget.g.targets.
  Writing assets file to disk. Path: C:\app\obj\project.assets.json
  Restore completed in 208.07 ms for C:\app\ClassLibrary1.csproj.

  NuGet Config files used:
      C:\Users\ContainerAdministrator\AppData\Roaming\NuGet\NuGet.Config

  Feeds used:
      https://api.nuget.org/v3/index.json
Done Building Project "C:\app\ClassLibrary1.csproj" (Restore target(s)).
Project "C:\app\ClassLibrary1.csproj" on node 1 (default targets).
PrepareForBuild:
  Creating directory "bin\Debug\net48\".
  Creating directory "obj\Debug\net48\".
CoreResGen:
  resgen.exe /useSourcePath /r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\mscorlib.dll" /r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Core.dll" /r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Data.dll" /r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.dll" /r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Drawing.dll" /r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.IO.Compression.FileSystem.dll" /r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Numerics.dll" /r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Runtime.Serialization.dll" /r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Xml.dll" /r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Xml.Linq.dll" /compile Resource1.resx,obj\Debug\net48\ClassLibrary1.Resource1.resources Resource1.en-GB.resx,obj\Debug\net48\ClassLibrary1.Resource1.en-GB.resources
  Processing resource file "Resource1.resx" into "obj\Debug\net48\ClassLibrary1.Resource1.resources".
  Processing resource file "Resource1.en-GB.resx" into "obj\Debug\net48\ClassLibrary1.Resource1.en-GB.resources".
CoreCompile:
  C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\Roslyn\csc.exe /noconfig /unsafe- /checked- /nowarn:1701,1702,1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:TRACE;DEBUG;NETFRAMEWORK;NET48 /highentropyva+ /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Data.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Drawing.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.IO.Compression.FileSystem.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Numerics.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Runtime.Serialization.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Xml.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Xml.Linq.dll" /debug+ /debug:portable /filealign:512 /optimize- /out:obj\Debug\net48\ClassLibrary1.dll /subsystemversion:6.00 /resource:obj\Debug\net48\ClassLibrary1.Resource1.resources /target:library /warnaserror- /utf8output /deterministic+ Class1.cs Resource1.Designer.cs Resource1.en-GB.Designer.cs "C:\Users\ContainerAdministrator\AppData\Local\Temp\.NETFramework,Version=v4.8.AssemblyAttributes.cs" obj\Debug\net48\ClassLibrary1.AssemblyInfo.cs /warnaserror+:NU1605
  Using shared compilation with compiler from directory: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\Roslyn
GenerateSatelliteAssemblies:
  Creating directory "obj\Debug\net48\en-GB".
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(3628,5): error MSB3086: Task could not find "al.exe" using the SdkToolsPath "" or the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\NETFXSDK\4.7.2\WinSDK-NetFx40Tools-x86". Make sure the SdkToolsPath is set and the tool exists in the correct processor specific location under the SdkToolsPath and that the Microsoft Windows SDK is installed [C:\app\ClassLibrary1.csproj]
Done Building Project "C:\app\ClassLibrary1.csproj" (default targets) -- FAILED.

Build FAILED.

"C:\app\ClassLibrary1.csproj" (default target) (1:7) ->
(GenerateSatelliteAssemblies target) ->
  C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(3628,5): error MSB3086: Task could not find "al.exe" using the SdkToolsPath "" or the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\NETFXSDK\4.7.2\WinSDK-NetFx40Tools-x86". Make sure the SdkToolsPath is set and the tool exists in the correct processor specific location under the SdkToolsPath and that the Microsoft Windows SDK is installed [C:\app\ClassLibrary1.csproj]

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:03.02
The command 'powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; msbuild.exe /restore ClassLibrary1.csproj' returned a non-zero code: 1

If you uncomment the other RUN line in the docker file, the build succeeds.

RUN $toolsDirectory = \"${Env:ProgramFiles(x86)}\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\"; msbuild.exe /property:TargetFrameworkSDKToolsDirectory=\"$toolsDirectory\" ClassLibrary1.csproj
#RUN msbuild.exe ClassLibrary1.csproj

This might be a duplicate of #313 - please close if it is.

@mthalman

This comment has been minimized.

Copy link
Member

commented Jul 18, 2019

I'm confused by the title of this issue, 'Task could not find "al.exe"', since the error message provided mentions nothing about al.exe.

The error message that you see indicates what the problem is. NuGet package restore needs to be run for the project. Running msbuild.exe doesn't do that. Indeed, uncommenting the $toolsDirectory line in the Dockerfile as you suggest doesn't make it work; the error still occurs. Instead, the Dockerfile should be using dotnet build which will automatically run NuGet package restore.

Changing the Dockerfile to the following will cause the build to succeed:

FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019 AS build

WORKDIR /app
COPY . .
RUN dotnet build ClassLibrary1.csproj

See our sample project Dockerfile at https://github.com/microsoft/dotnet-framework-docker/blob/master/samples/dotnetapp/Dockerfile.

@mrmonday

This comment has been minimized.

Copy link
Author

commented Jul 18, 2019

Sorry - my bad. It seems I made a last minute tweak to this and the error changed. I'll close this and re-open once I reproduce the original error.

@mrmonday mrmonday closed this Jul 18, 2019

@mrmonday

This comment has been minimized.

Copy link
Author

commented Jul 18, 2019

I missed the /restore in the build command - with that added, I get the error I intended to report.

@mrmonday mrmonday reopened this Jul 18, 2019

@mthalman

This comment has been minimized.

Copy link
Member

commented Jul 18, 2019

Ok, I can repro it now. Yes, this is a duplicate of #313.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.