microsoft / microsoft/MSBuildSdks

NoTargets does not work with multi targeting when project extension is .msbuildproj

Open
#155 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Help Wanted
Dominant language
C#
Stars
508
Forks
94
Avg merge
6h 40m
Merged PRs (30d)
2

Description

Minimal, Reproducible Example

Source: https://github.com/bash/MSBuildNoTargetsIssueRepro
Failing Travis build: https://travis-ci.com/github/bash/MSBuildNoTargetsIssueRepro/builds/152979950
Error Message:

/usr/share/dotnet/sdk/3.1.102/Microsoft.Common.CurrentVersion.targets(1175,5): error MSB3644: The reference assemblies for .NETFramework,Version=v4.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks [/home/travis/build/bash/MSBuildNoTargetsIssueRepro/MSBuildNoTargetsIssueRepro.msbuildproj]

Possible Workaround

I believe the issue is that Microsoft.Common.CrossTargeting.targets is never imported when the project extension doesn't correspond to a language.
My workaround sets the propertyLanguageTargets to a custom file, that imports CrossTargeting.targets

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked minimal reproduction and the failing Travis build, then inspect LanguageAgnosticShim.targets and how the .msbuildproj extension selects its targets. Compare the workaround with the normal multi-targeting path and verify that the reported MSB3644 error no longer occurs for this project extension.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.