Description
Hi,
When helping with issue #1503 the concern was arised that any new .NET Core releases have potential to break the UtilPack task factory used by GitVersionTask. This stems from the fact that while it is possible to lock down the NuGet assemblies version on .NET Desktop (and Mono), it is not possible to do so on .NET Core. This because NuGet assemblies are part of Trusted Platform Assembly list when dotnet build
command is invoked, and it is not possible to load another version of them by the task factory. This will cause crashes as new versions of .NET Core introduce potentially binary-incompatible changes to the used APIs of NuGet assemblies.
So the root problem can be solved if there is a way to lock down NuGet assembly version on .NET Core build
environment. One such way is to use .NET Core Global Tools, since they run using plain dotnet
instead of dotnet build
.
It seems that you are publishing GitVersionTask already as .NET Core Global Tool, according to #1463 . Maybe the most straightforward way is to just invoke the GitVersionTask as global tool from .targets file, installing it if it is missing from local system? Would it produce all information that is required by the .targets file?
This would essentially split the behaviour of GitVersionTask in MSBuild usage into two parts:
- On .NET Desktop (and Mono) environment, the UtilPack task factory would be continued to be used
- On .NET Core environment, the global tool would be installed if needed, and invoked, parsing the potential output parameters from the output or file. The UtilPack task factory would not be used at all.