dotnet / dotnet/msbuild

Import fallback paths do not apply to UsingTasks (and other property expansions)

Open
#1,600 0 comments 0 reactions 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

I think MSBuild 15's subtle trickery about loading .targets from multiple locations is defeating me here.

Two issues + one bonus:
1. MSBuild 15's spoofing MSBuild 14 extensions into its own directories is breaking the build, which blocks my dogfooding of MSBuild 15 and VS2017.
1. MSBuild 15's spoofing MSBuild 14 extensions leads to errors from files from non-existent paths.
1. Shouldn't MAT work with MSBuild 15? Why doesn't it if MSBuild 15 is supposed to read from MSBuild 14 extension locations?

I have VS2015 and VS2017 installed SXS. I also have the [Multilingual App Toolkit](https://www.microsoft.com/en-us/translator/mat.aspx) installed, which only supports VS2015. When MAT is not installed, a warning is emitted during the build. But because MSBuild 15 *tries* (unsuccessfully) to "find" this extension from the MSBuild 14 directory, it causes the builds to fail instead when MSBuild 15 is used to build the project.

But the most interesting part of the failure might be that the build error claims to be coming from a .targets file that does not exist. MSBuild appears to be pretending a .targets file is in the MSBuild 15 location when in fact it is not. It is only in the MSBuild 14 location. This makes it harder to troubleshoot the failure because I can't open the file at the path given.

From a VS2017 Developer Command Prompt, run this:

```
git clone https://github.com/microsoft/vs-threading.git
cd vs-threading
.\init.ps1
cd src
msbuild
```

This is the output:

```
1>------ Build started: Project: Microsoft.VisualStudio.Threading.Analyzers, Configuration: Debug Any CPU ------
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\d15prerel\MSBuild\Microsoft\Multilingual App Toolkit\v4.0\Microsoft.Multilingual.ResxResources.targets(23,5): error MSB4062: The "MultilingualBuild" task could not be loaded from the assembly C:\Program Files (x86)\Microsoft Visual Studio\2017\d15prerel\MSBuild\Microsoft\Multilingual App Toolkit\v4.0\Microsoft.Multilingual.Build.ResxResources.dll. Could not load file or assembly 'file:///C:\Program Files (x86)\Microsoft Visual Studio\2017\d15prerel\MSBuild\Microsoft\Multilingual App Toolkit\v4.0\Microsoft.Multilingual.Build.ResxResources.dll' or one of its dependencies. 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.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.