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

Add props file to buildMultiTargeting in Microsoft.NET.Test.Sdk nuspec #580

Merged
merged 4 commits into from
Mar 15, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/package/nuspec/Microsoft.NET.Test.Sdk.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
</dependencies>
</metadata>
<files>
<file src="Microsoft.NET.Test.Sdk.props" target="buildMultiTargeting\" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to include the targets file as well ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't need to. NuGet will still import and execute the targets file on the "inner" build. It looks like the current targets file only generates a "Program.cs" file, and which depends on TargetFrameworkIdentifier being set. It probably will work incorrectly when running in the "outer" build.

Btw, if you're not familiar with inner vs outer, here is conceptually what MSBuild is doing in multi-targeting projects:

<!-- this executes when `msbuild.exe /t:Build` runs on the project -->
<Target Name="Build" Condition="'$(TargetFrameworks)' != '' AND '$(TargetFramework)' == ''">
    <!-- import buildMultiTargeting/Microsoft.NET.Test.Sdk.props  -->
    <ItemGroup>
      <_TargetFramework Include="$(TargetFrameworks)" />
    </ItemGroup>
    <!-- starts a new "build" of the project, once per target framework -->
    <MSBuild Projects="$(MSBuildProjectFile)"
             Targets="InnerBuild"
             Properties="TargetFramework=%(_TargetFramework.Identity)" />
</Target>

<Target Name="InnerBuild" Condition="'$(TargetFramework)' != ''">
   <!-- import build/$(TargetFramework)/Microsoft.NET.Test.Sdk.{props, targets} -->
   <!-- gather *.cs files, run compiler, etc. -->
</Target>

<file src="Microsoft.NET.Test.Sdk.props" target="build\netcoreapp1.0\" />
<file src="Microsoft.NET.Test.Sdk.targets" target="build\netcoreapp1.0\" />
<file src="Microsoft.NET.Test.Sdk.props" target="build\net45\" />
<file src="Microsoft.NET.Test.Sdk.targets" target="build\net45\" />
</files>
</package>
</package>