diff options
author | Eric StJohn <ericstj@microsoft.com> | 2017-05-24 01:24:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-24 01:24:04 +0300 |
commit | 915891cdc76d8b1d28a3040da393c10510694191 (patch) | |
tree | 9bf3c5ec1c79b767b8fb5b8c1133a6f2180a379b /pkg | |
parent | 9dc502ae1c740f7367808044075c614cb28380b7 (diff) | |
parent | 4df259cf16fea52ec0e39b8ec31c7515d55d5091 (diff) |
Merge pull request #20021 from ericstj/simpleNameConflict
Move reference expansion to a target and handle simple name conflicts
Diffstat (limited to 'pkg')
5 files changed, 66 insertions, 15 deletions
diff --git a/pkg/NETStandard.Library.NETFramework/NETStandard.Library.NETFramework.pkgproj b/pkg/NETStandard.Library.NETFramework/NETStandard.Library.NETFramework.pkgproj index 4703ae47ab..ecf97ce0ac 100644 --- a/pkg/NETStandard.Library.NETFramework/NETStandard.Library.NETFramework.pkgproj +++ b/pkg/NETStandard.Library.NETFramework/NETStandard.Library.NETFramework.pkgproj @@ -26,6 +26,9 @@ <File Include="targets\**\*.*" Exclude="@(StampFile)"> <TargetPath>build/%(RecursiveDir)</TargetPath> </File> + <File Include="$(PlaceHolderFile)"> + <TargetPath>build/net471</TargetPath> + </File> </ItemGroup> <ItemGroup> diff --git a/pkg/NETStandard.Library.NETFramework/targets/NETStandard.Library.NETFramework.common.targets b/pkg/NETStandard.Library.NETFramework/targets/NETStandard.Library.NETFramework.common.targets new file mode 100644 index 0000000000..1fa7fa8024 --- /dev/null +++ b/pkg/NETStandard.Library.NETFramework/targets/NETStandard.Library.NETFramework.common.targets @@ -0,0 +1,59 @@ +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Choose> + <!-- Allow completely disabling the conflict resolution targets--> + <When Condition="'$(ImplicitlyExpandNETStandardFacades)' != 'true'" /> + <!-- Condition here is a hack until https://github.com/dotnet/sdk/issues/534 is fixed --> + <When Condition="'$(TargetFramework)' != '' or '$(TargetFrameworks)' != ''"> + <!-- NuGet 4, run after references are resolved --> + <PropertyGroup> + <ImplicitlyExpandNETStandardFacadesAfter>ResolveLockFileReferences</ImplicitlyExpandNETStandardFacadesAfter> + </PropertyGroup> + </When> + <When Condition="'$(ResolveNuGetPackages)' == 'true' and Exists('$(ProjectLockFile)')"> + <!-- NuGet 3, run after nuget assets are resolved --> + <PropertyGroup> + <ImplicitlyExpandNETStandardFacadesAfter>ResolveNuGetPackageAssets</ImplicitlyExpandNETStandardFacadesAfter> + </PropertyGroup> + </When> + <Otherwise> + <!-- NuGet 2, run before targets that consume references --> + <PropertyGroup> + <ResolveAssemblyReferencesDependsOn>ImplicitlyExpandNETStandardFacades;$(ResolveAssemblyReferencesDependsOn)</ResolveAssemblyReferencesDependsOn> + <PrepareResourcesDependsOn>ImplicitlyExpandNETStandardFacades;$(PrepareResourcesDependsOn)</PrepareResourcesDependsOn> + </PropertyGroup> + </Otherwise> + </Choose> + + <PropertyGroup> + <!-- Ensure this runs before conflict resolution since the added files may cause conflicts --> + <HandlePackageFileConflictsDependsOn>ImplicitlyExpandNETStandardFacades;$(HandlePackageFileConflictsDependsOn)</HandlePackageFileConflictsDependsOn> + </PropertyGroup> + + <Target Name="ImplicitlyExpandNETStandardFacades" + AfterTargets="$(ImplicitlyExpandNETStandardFacadesAfter)"> + <ItemGroup> + <!-- Remove simple name references if we're directly providing a reference assembly to the compiler. For example, + consider a project with an Reference Include="System", and some NuGet package is providing System.dll. + Simple references can also come from NuGet framework assemblies, hence this statement should occur after + including all computed references. --> + <Reference Remove="%(_NETStandardLibraryNETFrameworkReference.FileName)" /> + + <Reference Include="@(_NETStandardLibraryNETFrameworkReference)"> + <!-- Private = false to make these reference only --> + <Private>false</Private> + <NuGetPackageId>NETStandard.Library.NETFramework</NuGetPackageId> + <NuGetPackageVersion>$(NETStandardLibraryNETFrameworkPackageVersion)</NuGetPackageVersion> + <NuGetIsFrameworkReference>false</NuGetIsFrameworkReference> + <NuGetSourceType>Package</NuGetSourceType> + </Reference> + + <ReferenceCopyLocalPaths Include="@(_NETStandardLibraryNETFrameworkLib)"> + <Private>false</Private> + <NuGetPackageId>NETStandard.Library.NETFramework</NuGetPackageId> + <NuGetPackageVersion>$(NETStandardLibraryPackageVersion)</NuGetPackageVersion> + <NuGetIsFrameworkReference>false</NuGetIsFrameworkReference> + <NuGetSourceType>Package</NuGetSourceType> + </ReferenceCopyLocalPaths> + </ItemGroup> + </Target> +</Project> diff --git a/pkg/NETStandard.Library.NETFramework/targets/net461/NETStandard.Library.NETFramework.targets b/pkg/NETStandard.Library.NETFramework/targets/net461/NETStandard.Library.NETFramework.targets index 307104ac66..1dc201bbe6 100644 --- a/pkg/NETStandard.Library.NETFramework/targets/net461/NETStandard.Library.NETFramework.targets +++ b/pkg/NETStandard.Library.NETFramework/targets/net461/NETStandard.Library.NETFramework.targets @@ -2,23 +2,10 @@ <ItemGroup Condition="'$(ImplicitlyExpandNETStandardFacades)' == 'true'"> <_NETStandardLibraryNETFrameworkReference Include="$(MSBuildThisFileDirectory)\ref\*.dll" Exclude="@(_NETStandardLibraryNETFrameworkReference->'$(MSBuildThisFileDirectory)\ref\%(FileName).dll'" /> - <Reference Include="@(_NETStandardLibraryNETFrameworkReference)"> - <!-- Private = false to make these reference only --> - <Private>false</Private> - <NuGetPackageId>NETStandard.Library.NETFramework</NuGetPackageId> - <NuGetPackageVersion>$(NETStandardLibraryNETFrameworkPackageVersion)</NuGetPackageVersion> - <NuGetIsFrameworkReference>false</NuGetIsFrameworkReference> - <NuGetSourceType>Package</NuGetSourceType> - </Reference> <_NETStandardLibraryNETFrameworkLib Include="$(MSBuildThisFileDirectory)\lib\*.dll" Exclude="@(_NETStandardLibraryNETFrameworkLib->'$(MSBuildThisFileDirectory)\ref\%(FileName).dll'" /> - <ReferenceCopyLocalPaths Include="@(_NETStandardLibraryNETFrameworkLib)"> - <Private>false</Private> - <NuGetPackageId>NETStandard.Library.NETFramework</NuGetPackageId> - <NuGetPackageVersion>$(NETStandardLibraryPackageVersion)</NuGetPackageVersion> - <NuGetIsFrameworkReference>false</NuGetIsFrameworkReference> - <NuGetSourceType>Package</NuGetSourceType> - </ReferenceCopyLocalPaths> </ItemGroup> + + <Import Project="..\$(MSBuildThisFileName).common.targets" /> </Project> diff --git a/pkg/NETStandard.Library.NETFramework/targets/net462/NETStandard.Library.NETFramework.targets b/pkg/NETStandard.Library.NETFramework/targets/net462/NETStandard.Library.NETFramework.targets index a9b288c2f2..f895bdb42b 100644 --- a/pkg/NETStandard.Library.NETFramework/targets/net462/NETStandard.Library.NETFramework.targets +++ b/pkg/NETStandard.Library.NETFramework/targets/net462/NETStandard.Library.NETFramework.targets @@ -8,4 +8,5 @@ </ItemGroup> <Import Project="..\net461\$(MSBuildThisFile)" /> + <Import Project="..\$(MSBuildThisFileName).common.targets" /> </Project> diff --git a/pkg/NETStandard.Library.NETFramework/targets/net47/NETStandard.Library.NETFramework.targets b/pkg/NETStandard.Library.NETFramework/targets/net47/NETStandard.Library.NETFramework.targets index 3bc8421a38..9282977714 100644 --- a/pkg/NETStandard.Library.NETFramework/targets/net47/NETStandard.Library.NETFramework.targets +++ b/pkg/NETStandard.Library.NETFramework/targets/net47/NETStandard.Library.NETFramework.targets @@ -8,4 +8,5 @@ </ItemGroup> <Import Project="..\net462\$(MSBuildThisFile)" /> + <Import Project="..\$(MSBuildThisFileName).common.targets" /> </Project> |