BuildCheck template targets NETStandard 2.0, while referenced Microsoft.Build does not
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 141
Description
### Context
In order to support custom Check compatibility between NETFx and .NET MSBuild hosting - the checks should target .NETStandard 2.0.
At the same time the Checks need to reference `Microsoft.Build` (for the OM) - that however only targets net472 and current .NET. This can create possible issues.
### Repro
* `dotnet install msbuildcheck`
* `dotnet new msbuildcheck -n test`
* `dotnet build`
**Result:**
```
C:\repro\Contoso.BuildChecks.csproj : warning NU1701: Package 'Microsoft.Build 17.11.4' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.
```
### Notes
* Targeting Microsoft.Build (and transitively other assemblies) to NETSTandard isn't likely viable.
* Another alternative is revisiting the option of having contracts assembly: https://github.com/dotnet/msbuild/issues/9826
* Or since we are anyway loading this into MSBuild that's going to have the .NET or .NETFx TFM - this might be 'just fine'. If that's the case - then we can simply add NU1701 NoWarn into the packet Directory.Build.props https://github.com/dotnet/msbuild/blob/main/template_feed/content/Microsoft.CheckTemplate/Directory.Packages.props
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.