dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
https://docs.microsoft.com/visualstudio/msbuild/msbuild
MIT License
5.24k stars 1.35k forks source link

XamlBuildTask.dll is not in $(MSBuildToolsPath64) #3956

Open KirillOsenkov opened 6 years ago

KirillOsenkov commented 6 years ago

Steps to reproduce

https://github.com/KirillOsenkov/SourceBrowser/files/2611685/WorkflowConsoleApplication1.zip

Problem:

https://github.com/Microsoft/msbuild/blob/701ed49b20b860c17bcfd62d4e7845647a590760/src/Tasks/Microsoft.Xaml.targets#L16 It says that XamlBuildTask.dll should be in $(MSBuildToolsPath64), which on my machine is C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\amd64, but XamlBuildTask.dll isn't there. It's only found in the GAC and Reference Assemblies:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\XamlBuildTask.dll
...
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\XamlBuildTask.dll
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\XamlBuildTask.dll
C:\Windows\Microsoft.NET\Framework\v4.0.30319\XamlBuildTask.dll
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\XamlBuildTask\v4.0_4.0.0.0__31bf3856ad364e35\XamlBuildTask.dll

Actual behavior

"C:\Temp\WorkflowConsoleApplication1\WorkflowConsoleApplication1\ActivityLibrar
y1\ActivityLibrary1.csproj" (default target) (2) ->
(XamlMarkupCompilePass1 target) ->
  C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Xaml.targets(193,5):
error MSB4062: The "Microsoft.Build.Tasks.Xaml.PartialClassGenerationTask" task
 could not be loaded from the assembly C:\Program Files (x86)\Microsoft Visual
Studio\2017\Enterprise\MSBuild\15.0\bin\amd64\XamlBuildTask.dll. Could not load
 file or assembly 'file:///C:\Program Files (x86)\Microsoft Visual Studio\2017\
Enterprise\MSBuild\15.0\bin\amd64\XamlBuildTask.dll' or one of its dependencies
. The system cannot find the file specified. Confirm that the <UsingTask> decla
ration is correct, that the assembly and all its dependencies are available, an
d that the task contains a public class that implements Microsoft.Build.Framewo
rk.ITask. [C:\Temp\WorkflowConsoleApplication1\WorkflowConsoleApplication1\Acti
vityLibrary1\ActivityLibrary1.csproj]

Environment data

msbuild /version output:

Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
15.9.20.62856
KirillOsenkov commented 6 years ago

See related: https://github.com/KirillOsenkov/SourceBrowser/issues/102 https://github.com/Microsoft/msbuild/pull/2001

KirillOsenkov commented 6 years ago

Looks like XamlBuildTask.dll is supposed to be in bin\amd64, but it's not?

KirillOsenkov commented 6 years ago

Aha, this is because the Workflow component is not installed by Visual Studio by default: https://developercommunity.visualstudio.com/content/problem/2476/cannot-build-project-that-contains-windows-workflo.html#reply-7788

Wow, the experience isn't great. Should we talk to the VS Setup to always drop at least the build tools by default? Otherwise you can't build workflow projects.

hassanshamshir commented 2 years ago

@KirillOsenkov But how can we enable Workflow component in Dockerfile for window base image?