Skip to content

Commit

Permalink
Add fixes for dotnet/sdk#1360 (comment) and set existing workarounds …
Browse files Browse the repository at this point in the history
…for < 2.0 sdk
  • Loading branch information
Oren Novotny committed Jun 21, 2017
1 parent c34202d commit d1b5527
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ skip_commits:
- '**/*.md'

build_script:
- cmd: nuget pack MSBuild.Sdk.Extras.nuspec -Version 1.0.3-beta.%APPVEYOR_BUILD_NUMBER% -NoPackageAnalysis
- cmd: nuget pack MSBuild.Sdk.Extras.nuspec -Version 1.0.4-beta.%APPVEYOR_BUILD_NUMBER% -NoPackageAnalysis

artifacts:
- path: '*.nupkg'
Expand Down
6 changes: 6 additions & 0 deletions src/build/netstandard1.0/MSBuild.Sdk.Extras.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildSDKExtrasTargets>$(MSBuildThisFileDirectory)MSBuildSdkExtras.Common.targets</MSBuildSDKExtrasTargets>

<!-- Detect the SDK version. For now, we have to check the BundledNETCoreAppTargetFrameworkVersion prop
since there's no separate SDK version property
-->
<_ExtrasSdkVersion>$(BundledNETCoreAppTargetFrameworkVersion)</_ExtrasSdkVersion>
<_ExtrasSdkVersion Condition="'$(_ExtrasSdkVersion)' == ''">1.0</_ExtrasSdkVersion>
</PropertyGroup>
</Project>
19 changes: 17 additions & 2 deletions src/build/netstandard1.0/MSBuild.Sdk.Extras.targets
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)..\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets"/>
<Import Condition="'$(_ExtrasSdkVersion)' &lt; 2.0 "
Project="$(MSBuildThisFileDirectory)..\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets"/>

<!-- https://raw.githubusercontent.com/AArnott/NuGet4698Workaround/master/build/NuGet4698Workaround.targets -->
<Target Name="PackSatelliteAssemblies"
BeforeTargets="_WalkEachTargetPerFramework"
DependsOnTargets="SatelliteDllsProjectOutputGroupWithTargetFramework"
Condition=" '$(IncludeBuildOutput)' != 'false' ">
Condition=" '$(IncludeBuildOutput)' != 'false' and '$(_ExtrasSdkVersion)' &lt; 2.0">

This comment has been minimized.

Copy link
@AArnott

AArnott Jun 21, 2017

Collaborator

Don't you want to turn this off for msbuild.exe (full .NET Framework version) as well? Your check here will only turn it off for dotnet pack, I think.

This comment has been minimized.

Copy link
@clairernovotny

clairernovotny Jun 21, 2017

Collaborator

I'm pretty sure it applies to both since the SDK targets are now the same for both. If you do an msbuild /pp, it should show BundledNETCoreAppTargetFrameworkVersion in it since it's the same sdk used for both cli and msbuild

This comment has been minimized.

Copy link
@AArnott

AArnott Jun 21, 2017

Collaborator

Ok, great. :)

This comment has been minimized.

Copy link
@clairernovotny

clairernovotny Jun 21, 2017

Collaborator

I'll test this out on a few projects tonight/tomorrow before pushing to nuget. just want to sanity check these

<ItemGroup>
<Content Include="@(_SatelliteDllsProjectOutputGroupOutputWithTargetFramework)"
Condition=" '%(_SatelliteDllsProjectOutputGroupOutputWithTargetFramework.Culture)' != '' ">
Expand All @@ -31,4 +32,18 @@
</_SatelliteDllsProjectOutputGroupOutputWithTargetFramework>
</ItemGroup>
</Target>


<!-- Work around bug in Microsoft.NET.Sdk < v2.0 where satellites were deployed on top of each other in root. -->
<!-- https://github.com/dotnet/sdk/issues/1360 -->
<Target Name="WorkaroundIncorrectSatelliteDeployment"
AfterTargets="ResolveLockFileCopyLocalProjectDeps"
Condition="'$(_ExtrasSdkVersion)' &lt; 2.0 " >
<ItemGroup>
<ReferenceCopyLocalPaths Remove="@(ResourceCopyLocalItems)" />
<ReferenceCopyLocalPaths Include="@(ResourceCopyLocalItems)">
<DestinationSubDirectory>$([System.IO.Directory]::GetParent(%(ResourceCopyLocalItems.FullPath)).get_Name())\</DestinationSubDirectory>
</ReferenceCopyLocalPaths>
</ItemGroup>
</Target>
</Project>
2 changes: 1 addition & 1 deletion src/buildMultiTargeting/MSBuild.Sdk.Extras.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<!-- Fix NuGet Pack to include satellite assemblies.
See https://github.com/NuGet/Home/issues/4698 -->
<Target Name="PackSatelliteAssemblies" BeforeTargets="_WalkEachTargetPerFramework">
<MSBuild Condition="'$(IncludeBuildOutput)' == 'true'"
<MSBuild Condition="'$(IncludeBuildOutput)' == 'true' and '$(_ExtrasSdkVersion)' &lt; 2.0"
Projects="$(MSBuildProjectFullPath)"
Targets="SatelliteDllsProjectOutputGroupWithTargetFramework"
BuildInParallel="$(BuildInParallel)"
Expand Down

0 comments on commit d1b5527

Please sign in to comment.