Skip to content

Commit 6252351

Browse files
authored
Targeting pack and shared framework fixups (#7794)
* Fix package type to match spec ('DotnetPlatform') * Fix missing metadata in MSI installer * Fix incorrect target order which caused duplicate assemblies in netcore.app and aspnetcore.app
1 parent 51e2bea commit 6252351

File tree

5 files changed

+44
-29
lines changed

5 files changed

+44
-29
lines changed

src/Framework/ref/Microsoft.AspNetCore.App.Ref.csproj

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@ This package is an internal implementation of the .NET Core SDK and is not meant
1818
<PackageTags>aspnetcore;targeting-pack</PackageTags>
1919
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
2020

21-
<!-- Subject to change: see https://github.com/dotnet/designs/pull/50 -->
22-
<PackageType>TargetingPack</PackageType>
21+
<PackageType>DotnetPlatform</PackageType>
2322
<RefAssemblyPackagePath>ref/$(TargetFramework)/</RefAssemblyPackagePath>
2423

25-
<LayoutTargetDir>$(TargetingPackLayoutRoot)packs/Microsoft.AspNetCore.App.Ref/$(PackageVersion)/$(RefAssemblyPackagePath)</LayoutTargetDir>
24+
<LayoutTargetDir>$(TargetingPackLayoutRoot)packs/Microsoft.AspNetCore.App.Ref/$(PackageVersion)/</LayoutTargetDir>
2625
<ArchiveOutputFileName>aspnetcore-targeting-pack-$(PackageVersion).zip</ArchiveOutputFileName>
2726
<ArchiveOutputPath>$(InstallersOutputPath)$(ArchiveOutputFileName)</ArchiveOutputPath>
2827

@@ -56,7 +55,6 @@ This package is an internal implementation of the .NET Core SDK and is not meant
5655
$(BuildDependsOn);
5756
GeneratePackageConflictManifest;
5857
_ResolveTargetingPackContent;
59-
_BatchCopyToOutputDirectory;
6058
_BatchCopyToLayoutTargetDir;
6159
_CreateTargetingPackArchive;
6260
</BuildDependsOn>
@@ -87,15 +85,11 @@ This package is an internal implementation of the .NET Core SDK and is not meant
8785

8886
<AspNetCoreReferenceDocXml Include="@(AspNetCoreReferenceAssemblyPath->'%(RootDir)%(Directory)%(FileName).xml')" />
8987

90-
<!-- Exclude known missing XML docs files. Time-boxing this workaround because we want XML docs for everything. This can be removed when we get a new build with https://github.com/dotnet/core-setup/pull/5109. -->
91-
<AspNetCoreReferenceDocXml Remove="@(AspNetCoreReferenceDocXml)"
92-
Condition="'$(MicrosoftNETCoreAppPackageVersion)' == '3.0.0-preview-27405-2' AND ('%(FileName)' == 'Microsoft.Extensions.DependencyModel' OR '%(FileName)' == 'Microsoft.DotNet.PlatformAbstractions' )" />
88+
<RefPackContent Include="@(AspNetCoreReferenceAssemblyPath)" PackagePath="$(RefAssemblyPackagePath)" />
89+
<RefPackContent Include="@(AspNetCoreReferenceDocXml)" PackagePath="$(RefAssemblyPackagePath)" />
90+
<RefPackContent Include="$(TargetDir)$(PackageConflictManifestFileName)" PackagePath="$(PackageConflictManifestPackagePath)" />
9391

94-
<RefPackContent Include="@(AspNetCoreReferenceAssemblyPath)" />
95-
<RefPackContent Include="@(AspNetCoreReferenceDocXml)" />
96-
97-
<_PackageFiles Include="@(RefPackContent)" PackagePath="$(RefAssemblyPackagePath)" />
98-
<_PackageFiles Include="$(TargetDir)$(PackageConflictManifestFileName)" PackagePath="$(PackageConflictManifestPackagePath)" />
92+
<_PackageFiles Include="@(RefPackContent)" />
9993
</ItemGroup>
10094
</Target>
10195

@@ -114,25 +108,14 @@ This package is an internal implementation of the .NET Core SDK and is not meant
114108
Overwrite="true" />
115109
</Target>
116110

117-
<!-- Written to take advantage of target batching in MSBuild. -->
118-
<Target Name="_BatchCopyToOutputDirectory"
119-
DependsOnTargets="_ResolveTargetingPackContent"
120-
Inputs="@(RefPackContent)"
121-
Outputs="@(RefPackContent->'$(TargetDir)%(FileName)%(Extension)')">
122-
123-
<Copy SourceFiles="@(RefPackContent)"
124-
DestinationFiles="@(RefPackContent->'$(TargetDir)%(FileName)%(Extension)')"
125-
UseHardlinksIfPossible="true" />
126-
</Target>
127-
128111
<!-- Written to take advantage of target batching in MSBuild. -->
129112
<Target Name="_BatchCopyToLayoutTargetDir"
130113
DependsOnTargets="_ResolveTargetingPackContent"
131114
Inputs="@(RefPackContent)"
132-
Outputs="@(RefPackContent->'$(LayoutTargetDir)%(FileName)%(Extension)')">
115+
Outputs="@(RefPackContent->'$(LayoutTargetDir)%(PackagePath)%(FileName)%(Extension)')">
133116

134117
<Copy SourceFiles="@(RefPackContent)"
135-
DestinationFiles="@(RefPackContent->'$(LayoutTargetDir)%(FileName)%(Extension)')"
118+
DestinationFiles="@(RefPackContent->'$(LayoutTargetDir)%(PackagePath)%(FileName)%(Extension)')"
136119
UseHardlinksIfPossible="true" />
137120
</Target>
138121

src/Framework/src/Microsoft.AspNetCore.App.Runtime.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
<SharedFxName>Microsoft.AspNetCore.App</SharedFxName>
1616
<PackageId>$(MSBuildProjectName).$(RuntimeIdentifier)</PackageId>
1717
<IsShippingPackage>true</IsShippingPackage>
18+
<!-- Undo for Preview4. Preview 3 is shipping using the runtime.$(rid) packages instead. -->
19+
<IsPackable Condition="'$(PreReleaseLabel)'=='preview3'">false</IsPackable>
1820

1921
<PackageDescription>Provides a default set of APIs for building an ASP.NET Core application. Contains assets used for self-contained deployments.
2022

@@ -23,8 +25,7 @@ This package is an internal implementation of the .NET Core SDK and is not meant
2325
<PackageTags>aspnetcore;shared-framework</PackageTags>
2426
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
2527

26-
<!-- Subject to change: see https://github.com/dotnet/designs/pull/50 -->
27-
<PackageType>RuntimePack</PackageType>
28+
<PackageType>DotnetPlatform</PackageType>
2829
<!-- NuGet appends target framework to this value. Example: runtimes/win-x64/lib/netcoreapp3.0/ -->
2930
<BuildOutputTargetFolder>runtimes/$(RuntimeIdentifier)/lib/</BuildOutputTargetFolder>
3031
<!-- Target framework is not append to this because native assets to not have a target framework. -->

src/Framework/src/SharedFx.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ This targets file should only be imported by .shfxproj files.
1515
GenerateSharedFxVersionsFile;
1616
GenerateBuildDependencyFile;
1717
PrepareForPublish;
18-
GeneratePublishDependencyFile;
19-
GenerateSharedFxMetadataFiles;
2018
GenerateBuildRuntimeConfigurationFiles;
2119
ComputeAndCopyFilesToPublishDirectory;
20+
GeneratePublishDependencyFile;
21+
GenerateSharedFxMetadataFiles;
2222
CopySharedFxToOutput;
2323
CollectSharedFxOutput;
2424
PostBuildEvent;

src/Framework/test/Microsoft.AspNetCore.App.UnitTests.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@
4949
<_Parameter1>ManifestOutputDir</_Parameter1>
5050
<_Parameter2>%(_ResolvedFrameworkReference.ManifestOutputDir)</_Parameter2>
5151
</AssemblyAttribute>
52+
<AssemblyAttribute Include="Microsoft.AspNetCore.TestData">
53+
<_Parameter1>RuntimeAssetsOutputPath</_Parameter1>
54+
<_Parameter2>%(_ResolvedFrameworkReference.RuntimeAssetsOutputPath)</_Parameter2>
55+
</AssemblyAttribute>
5256
</ItemGroup>
5357
</Target>
5458

src/Framework/test/SharedFxTests.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,33 @@ public SharedFxTests(ITestOutputHelper output)
2424
_expectedRid = TestData.GetSharedFxRuntimeIdentifier();
2525
}
2626

27+
[Fact]
28+
public void SharedFrameworkContainsExpectedFiles()
29+
{
30+
var actualAssemblies = Directory.GetFiles(TestData.GetTestDataValue("RuntimeAssetsOutputPath"), "*.dll")
31+
.Select(Path.GetFileNameWithoutExtension)
32+
.ToHashSet();
33+
var expectedAssemblies = TestData.GetSharedFxDependencies()
34+
.Split(';', StringSplitOptions.RemoveEmptyEntries)
35+
.ToHashSet();
36+
37+
_output.WriteLine("==== actual assemblies ====");
38+
_output.WriteLine(string.Join('\n', actualAssemblies));
39+
_output.WriteLine("==== expected assemblies ====");
40+
_output.WriteLine(string.Join('\n', expectedAssemblies));
41+
42+
var missing = expectedAssemblies.Except(actualAssemblies);
43+
var unexpected = actualAssemblies.Except(expectedAssemblies);
44+
45+
_output.WriteLine("==== missing assemblies from the framework ====");
46+
_output.WriteLine(string.Join('\n', missing));
47+
_output.WriteLine("==== unexpected assemblies in the framework ====");
48+
_output.WriteLine(string.Join('\n', unexpected));
49+
50+
Assert.Empty(missing);
51+
Assert.Empty(unexpected);
52+
}
53+
2754
[Fact]
2855
public void PlatformManifestListsAllFiles()
2956
{

0 commit comments

Comments
 (0)