Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for VS 2017 cross-targeting builds #1118

Closed
clairernovotny opened this issue Dec 14, 2016 · 3 comments
Closed

Support for VS 2017 cross-targeting builds #1118

clairernovotny opened this issue Dec 14, 2016 · 3 comments
Labels

Comments

@clairernovotny
Copy link

clairernovotny commented Dec 14, 2016

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

@clairernovotny
Copy link
Author

Example of how to load different build tasks for desktop vs coreclr:

  <PropertyGroup Condition="$(NugetTaskAssemblyFile) == ''">
    <NugetTaskAssemblyFile Condition="'$(MSBuildRuntimeType)' == 'Core'">..\CoreCLR\NuGet.Build.Tasks.Pack.dll</NugetTaskAssemblyFile>
    <NugetTaskAssemblyFile Condition="'$(MSBuildRuntimeType)' != 'Core'">..\Desktop\NuGet.Build.Tasks.Pack.dll</NugetTaskAssemblyFile>
  </PropertyGroup>

@kzu
Copy link

kzu commented Aug 24, 2017

Or you could just switch to GitInfo which supports this already (see devlooped/GitInfo#53)

@stale
Copy link

stale bot commented Jun 29, 2019

This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 29, 2019
@stale stale bot closed this as completed Jul 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants