diff options
author | Anirudh Agnihotry <anirudhagnihotry098@gmail.com> | 2021-07-02 18:43:52 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-02 18:43:52 +0300 |
commit | b26d811385f54084ce1c64591ba70721df96a7b9 (patch) | |
tree | 8408b26d0cc7490c814c8c3020b2a5cf5ea921f4 /eng | |
parent | bbb7d90f4242de6fc3259a95ac30214d5180bdff (diff) |
Add Csproj pack infra for packages with ref and runtime assemblies and symbols. (#54250)
* add infra for adding ref and runtime assemblies
delete the project
add a comment
move the warning disable to cenral location
moving props/targets to packaging.props and packaging.targets
use intellisense package for ref and runtime xml files
add comments, flag for ref assemblies, remove xml from runtimes, use outputItem to get the reference assembly
addressing some more feedback
remove ref assemblies
add suppression file and update package validatio
* move PackageValidationBaselineVersion to packaging.targets
* update the package validation version
Diffstat (limited to 'eng')
-rw-r--r-- | eng/Versions.props | 2 | ||||
-rw-r--r-- | eng/packaging.props | 10 | ||||
-rw-r--r-- | eng/packaging.targets | 37 |
3 files changed, 44 insertions, 5 deletions
diff --git a/eng/Versions.props b/eng/Versions.props index 765b461a291..1c8ae0b1d33 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -64,7 +64,7 @@ <MicrosoftDotNetVersionToolsTasksVersion>6.0.0-beta.21330.2</MicrosoftDotNetVersionToolsTasksVersion> <MicrosoftDotNetPackageTestingVersion>6.0.0-beta.21330.2</MicrosoftDotNetPackageTestingVersion> <!-- NuGet dependencies --> - <NuGetBuildTasksPackVersion>5.9.0-preview.2</NuGetBuildTasksPackVersion> + <NuGetBuildTasksPackVersion>6.0.0-preview.1.102</NuGetBuildTasksPackVersion> <!-- Installer dependencies --> <MicrosoftNETCoreAppVersion>6.0.0-alpha.1.20612.4</MicrosoftNETCoreAppVersion> <MicrosoftNETCoreDotNetHostVersion>6.0.0-preview.7.21321.2</MicrosoftNETCoreDotNetHostVersion> diff --git a/eng/packaging.props b/eng/packaging.props index 534d3ddcf32..9e992bbf7a3 100644 --- a/eng/packaging.props +++ b/eng/packaging.props @@ -13,6 +13,7 @@ <PackageVersion Condition="'$(PackageVersion)' == '' and '$(MSBuildProjectExtension)' == '.pkgproj'">6.0.0</PackageVersion> <SkipValidatePackageTargetFramework>true</SkipValidatePackageTargetFramework> <SkipGenerationCheck>true</SkipGenerationCheck> + <DefaultAllowedOutputExtensionsInPackageBuildOutputFolder>.dll;.exe;.winmd;.json;.pri;</DefaultAllowedOutputExtensionsInPackageBuildOutputFolder> </PropertyGroup> <PropertyGroup Condition="'$(DotNetBuildFromSource)' == 'true'"> @@ -29,10 +30,6 @@ <Import Condition="Exists('$(PkgDir)baseline\baseline.props') and '$(MSBuildProjectExtension)' == '.pkgproj'" Project="$(PkgDir)baseline\baseline.props" /> - <PropertyGroup Condition="'$(IsPackable)' == 'true'"> - <PackageDesignerMarkerFile>$(MSBuildThisFileDirectory)useSharedDesignerContext.txt</PackageDesignerMarkerFile> - </PropertyGroup> - <ItemGroup Condition="'$(IsPackable)' == 'true'"> <!-- Add a marker to help the designer optimize & share .NET Core packages --> <None Include="$(PackageDesignerMarkerFile)" @@ -50,4 +47,9 @@ <RuntimeIDs>@(NETCoreApp30RIDs)</RuntimeIDs> </DefaultValidateFramework> </ItemGroup> + + <!-- TODO: Remove when all required nuget pack features are part of the consumed SDK. --> + <ItemGroup Condition="'$(IsPackable)' == 'true' and '$(IsSourceProject)' == 'true'"> + <PackageReference Include="NuGet.Build.Tasks.Pack" Version="$(NuGetBuildTasksPackVersion)" PrivateAssets="all" IsImplicitlyDefined="true" /> + </ItemGroup> </Project> diff --git a/eng/packaging.targets b/eng/packaging.targets index 1f19f57c98a..d6344a0b666 100644 --- a/eng/packaging.targets +++ b/eng/packaging.targets @@ -1,4 +1,15 @@ <Project InitialTargets="_OverridePackDependsOnForCsProjToPkgProj"> + + <PropertyGroup Condition="'$(IsPackable)' == 'true'"> + <TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);AddRuntimeSpecificAssemblies;LibIntellisenseDocs</TargetsForTfmSpecificContentInPackage> + <TargetsForTfmSpecificDebugSymbolsInPackage>$(TargetsForTfmSpecificDebugSymbolsInPackage);AddRuntimeDebugSymbolsWithTfm</TargetsForTfmSpecificDebugSymbolsInPackage> + <IncludeBuildOutput Condition="'$(TargetsAnyOS)' != 'true' or '$(ExcludeFromPackage)' == 'true'">false</IncludeBuildOutput> + <!-- Don't include target platform specific dependencies, since we use the target platform to represent RIDs instead --> + <SuppressDependenciesWhenPacking Condition="'$(ExcludeFromPackage)' == 'true' or ('$(TargetsAnyOS)' != 'true' and $([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net5.0')))">true</SuppressDependenciesWhenPacking> + <PackageDesignerMarkerFile>$(MSBuildThisFileDirectory)useSharedDesignerContext.txt</PackageDesignerMarkerFile> + <PackageValidationBaselineVersion Condition="'$(PackageValidationBaselineVersion)' == ''">$([MSBuild]::Subtract($(MajorVersion), 1)).0.0</PackageValidationBaselineVersion> + </PropertyGroup> + <!-- There are some packages where we require only one ref for a specific framework to be present. In order to avoid problems with this package when targetting dektop with RAR we will make sure there are no exclude=compile references in the package. For more info, please check issues: @@ -42,4 +53,30 @@ <MSBuild Projects="$(PkgProjPath)" Targets="Build" /> </Target> + + <Target Name="AddRuntimeSpecificAssemblies" + DependsOnTargets="BuiltProjectOutputGroup;SatelliteDllsProjectOutputGroup;$(TargetsForTfmSpecificBuildOutput)" + Condition="'$(TargetsAnyOS)' != 'true' and '$(ExcludeFromPackage)' == ''"> + <ItemGroup> + <TfmSpecificPackageFile Include="@(SatelliteDllsProjectOutputGroupOutput); + @(BuiltProjectOutputGroupOutput)"> + <PackagePath>runtimes/$(_runtimeOS)/lib/$(TargetFrameworkWithoutSuffix)</PackagePath> + </TfmSpecificPackageFile> + </ItemGroup> + </Target> + + <!-- Runtime independent symbols are automatically added by the pack task.--> + <Target Name="AddRuntimeDebugSymbolsWithTfm" + Condition="'$(IncludeSymbols)' == 'true' and '$(TargetsAnyOS)' != 'true' and '$(ExcludeFromPackage)' == ''"> + <PropertyGroup> + <RuntimeSymbolPath>$([System.IO.Path]::GetDirectoryName($(TargetPath)))\$(TargetName).pdb</RuntimeSymbolPath> + </PropertyGroup> + + <ItemGroup Condition="Exists('$(RuntimeSymbolPath)')"> + <TfmSpecificDebugSymbolsFile Include="$(RuntimeSymbolPath)"> + <TargetPath>/runtimes/$(_runtimeOS)/lib/$(TargetFrameworkWithoutSuffix)/$(TargetName).pdb</TargetPath> + <TargetFramework>$(TargetFrameworkWithoutSuffix)</TargetFramework> + </TfmSpecificDebugSymbolsFile> + </ItemGroup> + </Target> </Project> |