Skip to content

Support for VS 2017 cross-targeting builds #1118

Closed
@clairernovotny

Description

@clairernovotny

VS 2017 now has support for cross-targeting builds that can generate a NuGet package. This operates with an inner and outer loop. The inner loop builds each TFM and works with the current GitVersionTask package as-is. The outer-loop (where things like Pack/Publish) targets run needs one update to the packaging of the targets: a copy of the targets also needs to go into \buildCrossTargeting. This name may change as per dotnet/sdk#486 to \buildMultiTargeting, so for now, easiest just to put a copy of the targets in each.

Instead of being a copy, it can be a new set of targets that have this:

<Import Project="..\build\GitVersionTask.targets"/>

There may be some other updates too. Instead of/in addition to doing a CoreCompile hook for the inner loop, it would be good to use CoreGenerateAssemblyInfo since that task using the new SDK build system is what writes the assembly info.

Here's some more info:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting look there and you can see how you can distinguish between MSBuild running on CoreCLR and Desktop as to load the right version of a task...

In the outer loop, you'd want to inject the logic before the GenerateNuspec target

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions