Last active
March 10, 2025 07:56
-
-
Save Lamparter/4cab01901801e27bf4a08635d3f1a413 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
*********************************************************************************************** | |
NuGet.Build.Tasks.Pack.targets | |
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have | |
created a backup copy. Incorrect changes to this file will make it | |
impossible to load or build your projects from the command-line or the IDE. | |
Copyright (c) .NET Foundation. All rights reserved. | |
*********************************************************************************************** | |
--> | |
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<!-- Load NuGet.Build.Tasks.Pack.dll, this can be overridden to use a different version with $(NuGetPackTaskAssemblyFile) --> | |
<PropertyGroup Condition="$(NuGetPackTaskAssemblyFile) == ''"> | |
<NuGetPackTaskAssemblyFile Condition="'$(MSBuildRuntimeType)' == 'Core'">..\CoreCLR\NuGet.Build.Tasks.Pack.dll</NuGetPackTaskAssemblyFile> | |
<NuGetPackTaskAssemblyFile Condition="'$(MSBuildRuntimeType)' != 'Core'">..\Desktop\NuGet.Build.Tasks.Pack.dll</NuGetPackTaskAssemblyFile> | |
</PropertyGroup> | |
<!-- Tasks --> | |
<UsingTask TaskName="NuGet.Build.Tasks.Pack.PackTask" AssemblyFile="$(NuGetPackTaskAssemblyFile)" /> | |
<UsingTask TaskName="NuGet.Build.Tasks.Pack.GetPackOutputItemsTask" AssemblyFile="$(NuGetPackTaskAssemblyFile)" /> | |
<UsingTask TaskName="NuGet.Build.Tasks.GetProjectTargetFrameworksTask" AssemblyFile="$(NuGetPackTaskAssemblyFile)" /> | |
<UsingTask TaskName="NuGet.Build.Tasks.Pack.GetProjectReferencesFromAssetsFileTask" AssemblyFile="$(NuGetPackTaskAssemblyFile)" /> | |
<UsingTask TaskName="NuGet.Build.Tasks.Pack.IsPackableFalseWarningTask" AssemblyFile="$(NuGetPackTaskAssemblyFile)" /> | |
<PropertyGroup> | |
<PackageId Condition=" '$(PackageId)' == '' ">$(AssemblyName)</PackageId> | |
<PackageVersion Condition=" '$(PackageVersion)' == '' ">$(Version)</PackageVersion> | |
<IncludeContentInPack Condition="'$(IncludeContentInPack)'==''">true</IncludeContentInPack> | |
<GenerateNuspecDependsOn>_LoadPackInputItems; _GetTargetFrameworksOutput; _WalkEachTargetPerFramework; _GetPackageFiles; $(GenerateNuspecDependsOn)</GenerateNuspecDependsOn> | |
<PackageDescription Condition="'$(PackageDescription)'==''">$(Description)</PackageDescription> | |
<PackageDescription Condition="'$(PackageDescription)'==''">Package Description</PackageDescription> | |
<IsPackable Condition="'$(IsPackable)'=='' AND '$(IsTestProject)'=='true'">false</IsPackable> | |
<IsPackable Condition="'$(IsPackable)'==''">true</IsPackable> | |
<IncludeBuildOutput Condition="'$(IncludeBuildOutput)'==''">true</IncludeBuildOutput> | |
<BuildOutputTargetFolder Condition="'$(BuildOutputTargetFolder)' == '' AND '$(IsTool)' == 'true'">tools</BuildOutputTargetFolder> | |
<BuildOutputTargetFolder Condition="'$(BuildOutputTargetFolder)' == ''">lib</BuildOutputTargetFolder> | |
<ContentTargetFolders Condition="'$(ContentTargetFolders)' == ''">content;contentFiles</ContentTargetFolders> | |
<PackDependsOn>$(BeforePack); _IntermediatePack; GenerateNuspec; $(PackDependsOn)</PackDependsOn> | |
<IsInnerBuild Condition="'$(TargetFramework)' != '' AND '$(TargetFrameworks)' != ''">true</IsInnerBuild> | |
<SymbolPackageFormat Condition="'$(SymbolPackageFormat)' == ''">symbols.nupkg</SymbolPackageFormat> | |
<AddPriFileDependsOn Condition="'$(MicrosoftPortableCurrentVersionPropsHasBeenImported)' == 'true'">DeterminePortableBuildCapabilities</AddPriFileDependsOn> | |
<WarnOnPackingNonPackableProject Condition="'$(WarnOnPackingNonPackableProject)' == ''">false</WarnOnPackingNonPackableProject> | |
<ImportNuGetBuildTasksPackTargetsFromSdk Condition="'$(ImportNuGetBuildTasksPackTargetsFromSdk)' == ''">false</ImportNuGetBuildTasksPackTargetsFromSdk> | |
<DefaultAllowedOutputExtensionsInPackageBuildOutputFolder Condition="'$(DefaultAllowedOutputExtensionsInPackageBuildOutputFolder)' == ''">.dll; .exe; .winmd; .json; .pri; .xml</DefaultAllowedOutputExtensionsInPackageBuildOutputFolder> | |
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(DefaultAllowedOutputExtensionsInPackageBuildOutputFolder) ;$(AllowedOutputExtensionsInPackageBuildOutputFolder)</AllowedOutputExtensionsInPackageBuildOutputFolder> | |
<AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder Condition="'$(SymbolPackageFormat)' != 'snupkg'">.pdb; .mdb; $(AllowedOutputExtensionsInPackageBuildOutputFolder); $(AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder)</AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder> | |
<AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder Condition="'$(SymbolPackageFormat)' == 'snupkg'">.pdb</AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder> | |
<SuppressDependenciesWhenPacking Condition="'$(SuppressDependenciesWhenPacking)' == ''">false</SuppressDependenciesWhenPacking> | |
</PropertyGroup> | |
<PropertyGroup Condition="'$(NoBuild)' == 'true' or '$(GeneratePackageOnBuild)' == 'true'"> | |
<GenerateNuspecDependsOn>$(GenerateNuspecDependsOn)</GenerateNuspecDependsOn> | |
</PropertyGroup> | |
<PropertyGroup Condition="'$(NoBuild)' != 'true' and '$(GeneratePackageOnBuild)' != 'true'"> | |
<GenerateNuspecDependsOn>Build;$(GenerateNuspecDependsOn)</GenerateNuspecDependsOn> | |
</PropertyGroup> | |
<ItemGroup> | |
<ProjectCapability Include="Pack"/> | |
</ItemGroup> | |
<ItemDefinitionGroup> | |
<BuildOutputInPackage> | |
<TargetFramework>$(TargetFramework)</TargetFramework> | |
</BuildOutputInPackage> | |
</ItemDefinitionGroup> | |
<PropertyGroup> | |
<RestoreOutputPath Condition="'$(RestoreOutputPath)' == ''">$(MSBuildProjectExtensionsPath)</RestoreOutputPath> | |
<PackageOutputPath Condition="'$(PackageOutputPath)' == ''">$(BaseOutputPath)$(Configuration)\</PackageOutputPath> | |
<NuspecOutputPath Condition="'$(NuspecOutputPath)' == ''">$(BaseIntermediateOutputPath)$(Configuration)\</NuspecOutputPath> | |
</PropertyGroup> | |
<!-- | |
============================================================ | |
_GetAbsoluteOutputPathsForPack | |
Gets the absolute output paths for Pack. | |
============================================================ | |
--> | |
<Target Name="_GetAbsoluteOutputPathsForPack"> | |
<ConvertToAbsolutePath Paths="$(RestoreOutputPath)"> | |
<Output TaskParameter="AbsolutePaths" PropertyName="RestoreOutputAbsolutePath" /> | |
</ConvertToAbsolutePath> | |
<ConvertToAbsolutePath Paths="$(PackageOutputPath)"> | |
<Output TaskParameter="AbsolutePaths" PropertyName="PackageOutputAbsolutePath" /> | |
</ConvertToAbsolutePath> | |
<ConvertToAbsolutePath Paths="$(NuspecOutputPath)"> | |
<Output TaskParameter="AbsolutePaths" PropertyName="NuspecOutputAbsolutePath" /> | |
</ConvertToAbsolutePath> | |
</Target> | |
<!-- | |
============================================================ | |
_GetOutputItemsFromPack | |
Gets the output '.nupkg' and '.nuspec' absolute file paths. | |
============================================================ | |
--> | |
<Target Name="_GetOutputItemsFromPack" | |
DependsOnTargets="_GetAbsoluteOutputPathsForPack" | |
Returns="@(_OutputPackItems)"> | |
<!-- 'PackageOutputAbsolutePath' and 'NuspecOutputAbsolutePath' will be provided by '_GetAbsoluteOutputPathsForPack' target --> | |
<GetPackOutputItemsTask | |
PackageOutputPath="$(PackageOutputAbsolutePath)" | |
NuspecOutputPath="$(NuspecOutputAbsolutePath)" | |
PackageId="$(PackageId)" | |
PackageVersion="$(PackageVersion)" | |
IncludeSymbols="$(IncludeSymbols)" | |
IncludeSource="$(IncludeSource)" | |
SymbolPackageFormat="$(SymbolPackageFormat)"> | |
<Output | |
TaskParameter="OutputPackItems" | |
ItemName="_OutputPackItems" /> | |
</GetPackOutputItemsTask> | |
</Target> | |
<!-- | |
============================================================ | |
_GetTargetFrameworksOutput | |
Read target frameworks from the project. | |
============================================================ | |
--> | |
<Target Name="_GetTargetFrameworksOutput" | |
Returns="@(_TargetFrameworks)"> | |
<PropertyGroup> | |
<_ProjectFrameworks/> | |
</PropertyGroup> | |
<GetProjectTargetFrameworksTask | |
ProjectPath="$(MSBuildProjectFullPath)" | |
TargetFrameworks="$(TargetFrameworks)" | |
TargetFramework="$(TargetFramework)" | |
TargetFrameworkMoniker="$(TargetFrameworkMoniker)" | |
TargetPlatformIdentifier="$(TargetPlatformIdentifier)" | |
TargetPlatformVersion="$(TargetPlatformVersion)" | |
TargetPlatformMinVersion="$(TargetPlatformMinVersion)"> | |
<Output | |
TaskParameter="ProjectTargetFrameworks" | |
PropertyName="_ProjectFrameworks" /> | |
</GetProjectTargetFrameworksTask> | |
<ItemGroup Condition=" '$(_ProjectFrameworks)' != '' "> | |
<_TargetFrameworks Include="$(_ProjectFrameworks.Split(';'))" /> | |
</ItemGroup> | |
</Target> | |
<!-- | |
============================================================ | |
Pack | |
Post Build Target | |
============================================================ | |
--> | |
<Target Name="_PackAsBuildAfterTarget" | |
AfterTargets="Build" | |
Condition="'$(GeneratePackageOnBuild)' == 'true' AND '$(IsInnerBuild)' != 'true'" | |
DependsOnTargets="Pack"> | |
</Target> | |
<Target Name="_CleanPackageFiles" | |
DependsOnTargets="_GetOutputItemsFromPack" | |
AfterTargets="Clean" | |
Condition="'$(GeneratePackageOnBuild)' == 'true' AND '$(IsInnerBuild)' != 'true'"> | |
<ItemGroup> | |
<_PackageFilesToDelete Include="@(_OutputPackItems)"/> | |
</ItemGroup> | |
<Delete Files="@(_PackageFilesToDelete)"/> | |
</Target> | |
<Target Name="_CalculateInputsOutputsForPack" DependsOnTargets="_GetOutputItemsFromPack"> | |
<PropertyGroup Condition="$(ContinuePackingAfterGeneratingNuspec) == '' "> | |
<ContinuePackingAfterGeneratingNuspec>false</ContinuePackingAfterGeneratingNuspec> | |
</PropertyGroup> | |
<ItemGroup> | |
<!--This catches changes to properties--> | |
<NuGetPackInput Include="$(MSBuildAllProjects)"/> | |
<NuGetPackInput Include="@(_PackageFiles)"/> | |
<NuGetPackInput Include="@(_PackageFilesToExclude)"/> | |
<NuGetPackInput Include="@(_BuildOutputInPackage->'%(FinalOutputPath)')"/> | |
<NuGetPackInput Include="@(_TargetPathsToSymbols->'%(FinalOutputPath)')"/> | |
<NuGetPackInput Include="@(_SourceFiles)"/> | |
<NuGetPackInput Include="@(_References)"/> | |
<NuGetPackOutput Include="@(_OutputPackItems)" /> | |
</ItemGroup> | |
</Target> | |
<!-- | |
============================================================ | |
Pack | |
Main entry point for packing packages | |
============================================================ | |
--> | |
<Target Name="Pack" DependsOnTargets="$(PackDependsOn)"> | |
<IsPackableFalseWarningTask Condition="'$(IsPackable)' == 'false' AND '$(WarnOnPackingNonPackableProject)' == 'true'"/> | |
</Target> | |
<Target Name="_IntermediatePack"> | |
<PropertyGroup> | |
<ContinuePackingAfterGeneratingNuspec>true</ContinuePackingAfterGeneratingNuspec> | |
</PropertyGroup> | |
</Target> | |
<Target Name="GenerateNuspec" | |
Condition="'$(IsPackable)' == 'true'" | |
Inputs="@(NuGetPackInput)" Outputs="@(NuGetPackOutput)" | |
DependsOnTargets="$(GenerateNuspecDependsOn);_CalculateInputsOutputsForPack;_GetProjectReferenceVersions;_InitializeNuspecRepositoryInformationProperties"> | |
<ConvertToAbsolutePath Condition="$(NuspecFile) != ''" Paths="$(NuspecFile)"> | |
<Output TaskParameter="AbsolutePaths" PropertyName="NuspecFileAbsolutePath" /> | |
</ConvertToAbsolutePath> | |
<!-- Call Pack --> | |
<PackTask PackItem="$(PackProjectInputFile)" | |
PackageFiles="@(_PackageFiles)" | |
PackageFilesToExclude="@(_PackageFilesToExclude)" | |
PackageVersion="$(PackageVersion)" | |
PackageId="$(PackageId)" | |
Title="$(Title)" | |
Authors="$(Authors)" | |
Description="$(PackageDescription)" | |
Copyright="$(Copyright)" | |
RequireLicenseAcceptance="$(PackageRequireLicenseAcceptance)" | |
LicenseUrl="$(PackageLicenseUrl)" | |
ProjectUrl="$(PackageProjectUrl)" | |
IconUrl="$(PackageIconUrl)" | |
ReleaseNotes="$(PackageReleaseNotes)" | |
Tags="$(PackageTags)" | |
DevelopmentDependency="$(DevelopmentDependency)" | |
BuildOutputInPackage="@(_BuildOutputInPackage)" | |
ProjectReferencesWithVersions="@(_ProjectReferencesWithVersions)" | |
TargetPathsToSymbols="@(_TargetPathsToSymbols)" | |
TargetFrameworks="@(_TargetFrameworks)" | |
FrameworksWithSuppressedDependencies="@(_FrameworksWithSuppressedDependencies)" | |
AssemblyName="$(AssemblyName)" | |
PackageOutputPath="$(PackageOutputAbsolutePath)" | |
IncludeSymbols="$(IncludeSymbols)" | |
IncludeSource="$(IncludeSource)" | |
PackageTypes="$(PackageType)" | |
IsTool="$(IsTool)" | |
RepositoryUrl="$(RepositoryUrl)" | |
RepositoryType="$(RepositoryType)" | |
RepositoryBranch="$(RepositoryBranch)" | |
RepositoryCommit="$(RepositoryCommit)" | |
SourceFiles="@(_SourceFiles->Distinct())" | |
NoPackageAnalysis="$(NoPackageAnalysis)" | |
NoDefaultExcludes="$(NoDefaultExcludes)" | |
MinClientVersion="$(MinClientVersion)" | |
Serviceable="$(Serviceable)" | |
FrameworkAssemblyReferences="@(_FrameworkAssemblyReferences)" | |
ContinuePackingAfterGeneratingNuspec="$(ContinuePackingAfterGeneratingNuspec)" | |
NuspecOutputPath="$(NuspecOutputAbsolutePath)" | |
IncludeBuildOutput="$(IncludeBuildOutput)" | |
BuildOutputFolders="$(BuildOutputTargetFolder)" | |
ContentTargetFolders="$(ContentTargetFolders)" | |
RestoreOutputPath="$(RestoreOutputAbsolutePath)" | |
NuspecFile="$(NuspecFileAbsolutePath)" | |
NuspecBasePath="$(NuspecBasePath)" | |
NuspecProperties="$(NuspecProperties)" | |
AllowedOutputExtensionsInPackageBuildOutputFolder="$(AllowedOutputExtensionsInPackageBuildOutputFolder)" | |
AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder="$(AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder)" | |
NoWarn="$(NoWarn)" | |
WarningsAsErrors="$(WarningsAsErrors)" | |
WarningsNotAsErrors="$(WarningsNotAsErrors)" | |
TreatWarningsAsErrors="$(TreatWarningsAsErrors)" | |
OutputFileNamesWithoutVersion="$(OutputFileNamesWithoutVersion)" | |
InstallPackageToOutputPath="$(InstallPackageToOutputPath)" | |
SymbolPackageFormat="$(SymbolPackageFormat)" | |
PackageLicenseFile="$(PackageLicenseFile)" | |
PackageLicenseExpression="$(PackageLicenseExpression)" | |
PackageLicenseExpressionVersion="$(PackageLicenseExpressionVersion)" | |
Readme="$(PackageReadmeFile)" | |
Deterministic="$(Deterministic)" | |
PackageIcon="$(PackageIcon)" | |
/> | |
</Target> | |
<!-- | |
Initialize Repository* properties from properties set by a source control package, if available in the project. | |
--> | |
<Target Name="_InitializeNuspecRepositoryInformationProperties" | |
DependsOnTargets="InitializeSourceControlInformation" | |
Condition="'$(SourceControlInformationFeatureSupported)' == 'true'"> | |
<PropertyGroup> | |
<!-- The project must specify PublishRepositoryUrl=true in order to publish the URL or branch, in order to prevent inadvertent leak of internal data. --> | |
<RepositoryUrl Condition="'$(RepositoryUrl)' == '' and '$(PublishRepositoryUrl)' == 'true'">$(PrivateRepositoryUrl)</RepositoryUrl> | |
<RepositoryCommit Condition="'$(RepositoryCommit)' == ''">$(SourceRevisionId)</RepositoryCommit> | |
<RepositoryBranch Condition="'$(RepositoryBranch)' == '' and '$(PublishRepositoryUrl)' == 'true' and '$(SourceBranchName)' != ''">$(SourceBranchName)</RepositoryBranch> | |
</PropertyGroup> | |
</Target> | |
<!-- | |
============================================================ | |
_LoadPackGraphEntryPoints | |
Find project entry point and load them into items. | |
============================================================ | |
--> | |
<Target Name="_LoadPackInputItems"> | |
<!-- Allow overriding items with PackProjectInputFile --> | |
<PropertyGroup Condition="'$(PackProjectInputFile)' == ''"> | |
<PackProjectInputFile>$(MSBuildProjectFullPath)</PackProjectInputFile> | |
</PropertyGroup> | |
</Target> | |
<Target Name="_GetProjectReferenceVersions" | |
Condition="'$(NuspecFile)' == ''" | |
DependsOnTargets="_GetAbsoluteOutputPathsForPack;$(GetPackageVersionDependsOn)"> | |
<!-- 'RestoreOutputAbsolutePath' will be provided by '_GetAbsoluteOutputPathsForPack' target --> | |
<ConvertToAbsolutePath Condition="'$(ProjectAssetsFile)' != ''" Paths="$(ProjectAssetsFile)"> | |
<Output TaskParameter="AbsolutePaths" PropertyName="ProjectAssetsFileAbsolutePath" /> | |
</ConvertToAbsolutePath> | |
<GetProjectReferencesFromAssetsFileTask | |
RestoreOutputAbsolutePath="$(RestoreOutputAbsolutePath)" | |
ProjectAssetsFileAbsolutePath="$(ProjectAssetsFileAbsolutePath)"> | |
<Output | |
TaskParameter="ProjectReferences" | |
ItemName="_ProjectReferencesFromAssetsFile" /> | |
</GetProjectReferencesFromAssetsFileTask> | |
<MSBuild | |
Projects="@(_ProjectReferencesFromAssetsFile)" | |
Targets="_GetProjectVersion" | |
SkipNonexistentTargets="true" | |
SkipNonexistentProjects="true" | |
Properties="BuildProjectReferences=false;"> | |
<Output | |
TaskParameter="TargetOutputs" | |
ItemName="_ProjectReferencesWithVersions"/> | |
</MSBuild> | |
</Target> | |
<Target Name="_GetProjectVersion" DependsOnTargets="$(GetPackageVersionDependsOn)" | |
Returns="@(_ProjectPathWithVersion)"> | |
<ItemGroup> | |
<_ProjectPathWithVersion Include="$(MSBuildProjectFullPath)"> | |
<ProjectVersion Condition="'$(PackageVersion)' != ''">$(PackageVersion)</ProjectVersion> | |
<ProjectVersion Condition="'$(PackageVersion)' == ''">1.0.0</ProjectVersion> | |
</_ProjectPathWithVersion> | |
</ItemGroup> | |
</Target> | |
<Target Name="_WalkEachTargetPerFramework"> | |
<ItemGroup> | |
<_ProjectsWithTFM Include="$(MSBuildProjectFullPath)" AdditionalProperties="TargetFramework=%(_TargetFrameworks.Identity)" /> | |
<_ProjectsWithTFMNoBuild Include="$(MSBuildProjectFullPath)" AdditionalProperties="TargetFramework=%(_TargetFrameworks.Identity);BuildProjectReferences=false" /> | |
</ItemGroup> | |
<MSBuild | |
Condition="'$(IncludeBuildOutput)' == 'true'" | |
Projects="@(_ProjectsWithTFM)" | |
Targets="_GetBuildOutputFilesWithTfm" | |
BuildInParallel="$(BuildInParallel)"> | |
<Output | |
TaskParameter="TargetOutputs" | |
ItemName="_BuildOutputInPackage" /> | |
</MSBuild> | |
<MSBuild | |
Condition="'$(TargetsForTfmSpecificContentInPackage)' != ''" | |
Projects="@(_ProjectsWithTFM)" | |
Targets="_GetTfmSpecificContentForPackage" | |
BuildInParallel="$(BuildInParallel)"> | |
<Output | |
TaskParameter="TargetOutputs" | |
ItemName="_PackageFiles"/> | |
</MSBuild> | |
<MSBuild | |
Condition="'$(IncludeBuildOutput)' == 'true'" | |
Projects="@(_ProjectsWithTFM)" | |
Targets="_GetDebugSymbolsWithTfm" | |
BuildInParallel="$(BuildInParallel)"> | |
<Output | |
TaskParameter="TargetOutputs" | |
ItemName="_TargetPathsToSymbols" /> | |
</MSBuild> | |
<MSBuild | |
Condition="'$(IncludeSource)' == 'true'" | |
Projects="@(_ProjectsWithTFMNoBuild)" | |
Targets="SourceFilesProjectOutputGroup" | |
BuildInParallel="$(BuildInParallel)"> | |
<Output | |
TaskParameter="TargetOutputs" | |
ItemName="_SourceFiles" /> | |
</MSBuild> | |
<MSBuild | |
Projects="@(_ProjectsWithTFMNoBuild)" | |
Targets="_GetFrameworkAssemblyReferences" | |
BuildInParallel="$(BuildInParallel)"> | |
<Output | |
TaskParameter="TargetOutputs" | |
ItemName="_FrameworkAssemblyReferences" /> | |
</MSBuild> | |
<MSBuild | |
Projects="@(_ProjectsWithTFMNoBuild)" | |
Targets="_GetFrameworksWithSuppressedDependencies" | |
BuildInParallel="$(BuildInParallel)"> | |
<Output | |
TaskParameter="TargetOutputs" | |
ItemName="_FrameworksWithSuppressedDependencies" /> | |
</MSBuild> | |
</Target> | |
<Target Name ="_GetFrameworksWithSuppressedDependencies" Returns="@(_TfmWithDependenciesSuppressed)"> | |
<ItemGroup> | |
<_TfmWithDependenciesSuppressed Include="$(TargetFramework)" Condition="'$(SuppressDependenciesWhenPacking)' == 'true'"/> | |
</ItemGroup> | |
</Target> | |
<Target Name ="_GetFrameworkAssemblyReferences" DependsOnTargets="ResolveReferences" Returns="@(TfmSpecificFrameworkAssemblyReferences)"> | |
<ItemGroup> | |
<TfmSpecificFrameworkAssemblyReferences Include="@(ReferencePath->'%(OriginalItemSpec)')" | |
Condition="'%(ReferencePath.Pack)' != 'false' AND '%(ReferencePath.ResolvedFrom)' == '{TargetFrameworkDirectory}'"> | |
<TargetFramework>$(TargetFramework)</TargetFramework> | |
</TfmSpecificFrameworkAssemblyReferences> | |
</ItemGroup> | |
</Target> | |
<Target Name="_GetBuildOutputFilesWithTfm" | |
DependsOnTargets="BuiltProjectOutputGroup;DocumentationProjectOutputGroup;SatelliteDllsProjectOutputGroup;_AddPriFileToPackBuildOutput;$(TargetsForTfmSpecificBuildOutput)" | |
Returns="@(BuildOutputInPackage)"> | |
<ItemGroup Condition="'$(IncludeBuildOutput)' == 'true'"> | |
<BuildOutputInPackage Include="@(SatelliteDllsProjectOutputGroupOutput); | |
@(BuiltProjectOutputGroupOutput); | |
@(DocumentationProjectOutputGroupOutput); | |
@(_PathToPriFile)"/> | |
</ItemGroup> | |
</Target> | |
<Target Name="_GetTfmSpecificContentForPackage" | |
DependsOnTargets="$(TargetsForTfmSpecificContentInPackage)" | |
Returns="@(TfmSpecificPackageFileWithRecursiveDir)"> | |
<!-- The below workaround needs to be done due to msbuild bug https://github.com/Microsoft/msbuild/issues/3121 --> | |
<ItemGroup> | |
<TfmSpecificPackageFileWithRecursiveDir Include="@(TfmSpecificPackageFile)"> | |
<NuGetRecursiveDir>%(TfmSpecificPackageFile.RecursiveDir)</NuGetRecursiveDir> | |
<BuildAction>%(TfmSpecificPackageFile.BuildAction)</BuildAction> | |
</TfmSpecificPackageFileWithRecursiveDir> | |
</ItemGroup> | |
</Target> | |
<Target Name="_GetDebugSymbolsWithTfm" | |
DependsOnTargets="DebugSymbolsProjectOutputGroup;$(TargetsForTfmSpecificDebugSymbolsInPackage)" | |
Returns="@(_TargetPathsToSymbolsWithTfm)"> | |
<ItemGroup Condition="'$(IncludeBuildOutput)' == 'true'"> | |
<_TargetPathsToSymbolsWithTfm Include="@(DebugSymbolsProjectOutputGroupOutput)"> | |
<TargetFramework>$(TargetFramework)</TargetFramework> | |
</_TargetPathsToSymbolsWithTfm> | |
</ItemGroup> | |
<ItemGroup> | |
<_TargetPathsToSymbolsWithTfm Include="@(TfmSpecificDebugSymbolsFile)" /> | |
</ItemGroup> | |
</Target> | |
<!--Projects with target framework like UWP, Win8, wpa81 produce a Pri file | |
in their bin dir. This Pri file is not included in the BuiltProjectGroupOutput, and | |
has to be added manually here.--> | |
<Target Name="_AddPriFileToPackBuildOutput" | |
Returns="@(_PathToPriFile)" | |
DependsOnTargets="$(AddPriFileDependsOn)"> | |
<ItemGroup Condition="'$(IncludeProjectPriFile)' == 'true'"> | |
<_PathToPriFile Include="$(ProjectPriFullPath)"> | |
<FinalOutputPath>$(ProjectPriFullPath)</FinalOutputPath> | |
<TargetPath>$(ProjectPriFileName)</TargetPath> | |
</_PathToPriFile> | |
</ItemGroup> | |
</Target> | |
<!-- | |
============================================================ | |
_GetPackageFiles | |
Entry point for generating the project to project references. | |
============================================================ | |
--> | |
<Target Name="_GetPackageFiles" Condition="$(IncludeContentInPack) == 'true'"> | |
<ItemGroup> | |
<_PackageFilesToExclude Include="@(Content)" Condition="'%(Content.Pack)' == 'false'"/> | |
</ItemGroup> | |
<!-- Include PackageFiles and Content of the project being packed --> | |
<ItemGroup> | |
<_PackageFiles Include="@(Content)" Condition=" %(Content.Pack) != 'false' "> | |
<BuildAction Condition="'%(Content.BuildAction)' == ''">Content</BuildAction> | |
<ResolvedPath Condition="!$([System.IO.Path]::IsPathRooted('%(Content.Identity)'))">$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', '%(Content.Identity)'))</ResolvedPath> | |
<ResolvedPath Condition="$([System.IO.Path]::IsPathRooted('%(Content.Identity)'))">%(Content.Identity)</ResolvedPath> | |
</_PackageFiles> | |
<_PackageFiles Include="@(Compile)" Condition=" %(Compile.Pack) == 'true' "> | |
<BuildAction Condition="'%(Compile.BuildAction)' == ''">Compile</BuildAction> | |
<ResolvedPath Condition="!$([System.IO.Path]::IsPathRooted('%(Compile.Identity)'))">$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', '%(Compile.Identity)'))</ResolvedPath> | |
<ResolvedPath Condition="$([System.IO.Path]::IsPathRooted('%(Compile.Identity)'))">%(Compile.Identity)</ResolvedPath> | |
</_PackageFiles> | |
<_PackageFiles Include="@(None)" Condition=" %(None.Pack) == 'true' "> | |
<BuildAction Condition="'%(None.BuildAction)' == ''">None</BuildAction> | |
<ResolvedPath Condition="!$([System.IO.Path]::IsPathRooted('%(None.Identity)'))">$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', '%(None.Identity)'))</ResolvedPath> | |
<ResolvedPath Condition="$([System.IO.Path]::IsPathRooted('%(None.Identity)'))">%(None.Identity)</ResolvedPath> | |
</_PackageFiles> | |
<_PackageFiles Include="@(EmbeddedResource)" Condition=" %(EmbeddedResource.Pack) == 'true' "> | |
<BuildAction Condition="'%(EmbeddedResource.BuildAction)' == ''">EmbeddedResource</BuildAction> | |
<ResolvedPath Condition="!$([System.IO.Path]::IsPathRooted('%(EmbeddedResource.Identity)'))">$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', '%(EmbeddedResource.Identity)'))</ResolvedPath> | |
<ResolvedPath Condition="$([System.IO.Path]::IsPathRooted('%(EmbeddedResource.Identity)'))">%(EmbeddedResource.Identity)</ResolvedPath> | |
</_PackageFiles> | |
<_PackageFiles Include="@(ApplicationDefinition)" Condition=" %(ApplicationDefinition.Pack) == 'true' "> | |
<BuildAction Condition="'%(ApplicationDefinition.BuildAction)' == ''">ApplicationDefinition</BuildAction> | |
<ResolvedPath Condition="!$([System.IO.Path]::IsPathRooted('%(ApplicationDefinition.Identity)'))">$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', '%(ApplicationDefinition.Identity)'))</ResolvedPath> | |
<ResolvedPath Condition="$([System.IO.Path]::IsPathRooted('%(ApplicationDefinition.Identity)'))">%(ApplicationDefinition.Identity)</ResolvedPath> | |
</_PackageFiles> | |
<_PackageFiles Include="@(Page)" Condition=" %(Page.Pack) == 'true' "> | |
<BuildAction Condition="'%(Page.BuildAction)' == ''">Page</BuildAction> | |
<ResolvedPath Condition="!$([System.IO.Path]::IsPathRooted('%(Page.Identity)'))">$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', '%(Page.Identity)'))</ResolvedPath> | |
<ResolvedPath Condition="$([System.IO.Path]::IsPathRooted('%(Page.Identity)'))">%(Page.Identity)</ResolvedPath> | |
</_PackageFiles> | |
<_PackageFiles Include="@(Resource)" Condition=" %(Resource.Pack) == 'true' "> | |
<BuildAction Condition="'%(Resource.BuildAction)' == ''">Resource</BuildAction> | |
<ResolvedPath Condition="!$([System.IO.Path]::IsPathRooted('%(Resource.Identity)'))">$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', '%(Resource.Identity)'))</ResolvedPath> | |
<ResolvedPath Condition="$([System.IO.Path]::IsPathRooted('%(Resource.Identity)'))">%(Resource.Identity)</ResolvedPath> | |
</_PackageFiles> | |
<_PackageFiles Include="@(SplashScreen)" Condition=" %(SplashScreen.Pack) == 'true' "> | |
<BuildAction Condition="'%(SplashScreen.BuildAction)' == ''">SplashScreen</BuildAction> | |
<ResolvedPath Condition="!$([System.IO.Path]::IsPathRooted('%(SplashScreen.Identity)'))">$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', '%(SplashScreen.Identity)'))</ResolvedPath> | |
<ResolvedPath Condition="$([System.IO.Path]::IsPathRooted('%(SplashScreen.Identity)'))">%(SplashScreen.Identity)</ResolvedPath> | |
</_PackageFiles> | |
<_PackageFiles Include="@(DesignData)" Condition=" %(DesignData.Pack) == 'true' "> | |
<BuildAction Condition="'%(DesignData.BuildAction)' == ''">DesignData</BuildAction> | |
<ResolvedPath Condition="!$([System.IO.Path]::IsPathRooted('%(DesignData.Identity)'))">$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', '%(DesignData.Identity)'))</ResolvedPath> | |
<ResolvedPath Condition="$([System.IO.Path]::IsPathRooted('%(DesignData.Identity)'))">%(DesignData.Identity)</ResolvedPath> | |
</_PackageFiles> | |
<_PackageFiles Include="@(DesignDataWithDesignTimeCreatableTypes)" Condition=" %(DesignDataWithDesignTimeCreatableTypes.Pack) == 'true' "> | |
<BuildAction Condition="'%(DesignDataWithDesignTimeCreatableTypes.BuildAction)' == ''">DesignDataWithDesignTimeCreatableTypes</BuildAction> | |
<ResolvedPath Condition="!$([System.IO.Path]::IsPathRooted('%(DesignDataWithDesignTimeCreatableTypes.Identity)'))">$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', '%(DesignDataWithDesignTimeCreatableTypes.Identity)'))</ResolvedPath> | |
<ResolvedPath Condition="$([System.IO.Path]::IsPathRooted('%(DesignDataWithDesignTimeCreatableTypes.Identity)'))">%(DesignDataWithDesignTimeCreatableTypes.Identity)</ResolvedPath> | |
</_PackageFiles> | |
<_PackageFiles Include="@(CodeAnalysisDictionary)" Condition=" %(CodeAnalysisDictionary.Pack) == 'true' "> | |
<BuildAction Condition="'%(CodeAnalysisDictionary.BuildAction)' == ''">CodeAnalysisDictionary</BuildAction> | |
<ResolvedPath Condition="!$([System.IO.Path]::IsPathRooted('%(CodeAnalysisDictionary.Identity)'))">$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', '%(CodeAnalysisDictionary.Identity)'))</ResolvedPath> | |
<ResolvedPath Condition="$([System.IO.Path]::IsPathRooted('%(CodeAnalysisDictionary.Identity)'))">%(CodeAnalysisDictionary.Identity)</ResolvedPath> | |
</_PackageFiles> | |
<_PackageFiles Include="@(AndroidAsset)" Condition=" %(AndroidAsset.Pack) == 'true' "> | |
<BuildAction Condition="'%(AndroidAsset.BuildAction)' == ''">AndroidAsset</BuildAction> | |
<ResolvedPath Condition="!$([System.IO.Path]::IsPathRooted('%(AndroidAsset.Identity)'))">$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', '%(AndroidAsset.Identity)'))</ResolvedPath> | |
<ResolvedPath Condition="$([System.IO.Path]::IsPathRooted('%(AndroidAsset.Identity)'))">%(AndroidAsset.Identity)</ResolvedPath> | |
</_PackageFiles> | |
<_PackageFiles Include="@(AndroidResource)" Condition=" %(AndroidResource.Pack) == 'true' "> | |
<BuildAction Condition="'%(AndroidResource.BuildAction)' == ''">AndroidResource</BuildAction> | |
<ResolvedPath Condition="!$([System.IO.Path]::IsPathRooted('%(AndroidResource.Identity)'))">$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', '%(AndroidResource.Identity)'))</ResolvedPath> | |
<ResolvedPath Condition="$([System.IO.Path]::IsPathRooted('%(AndroidResource.Identity)'))">%(AndroidResource.Identity)</ResolvedPath> | |
</_PackageFiles> | |
<_PackageFiles Include="@(BundleResource)" Condition=" %(BundleResource.Pack) == 'true' "> | |
<BuildAction Condition="'%(BundleResource.BuildAction)' == ''">BundleResource</BuildAction> | |
<ResolvedPath Condition="!$([System.IO.Path]::IsPathRooted('%(BundleResource.Identity)'))">$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', '%(BundleResource.Identity)'))</ResolvedPath> | |
<ResolvedPath Condition="$([System.IO.Path]::IsPathRooted('%(BundleResource.Identity)'))">%(BundleResource.Identity)</ResolvedPath> | |
</_PackageFiles> | |
</ItemGroup> | |
</Target> | |
</Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
*********************************************************************************************** | |
NuGet.Build.Tasks.Pack.targets | |
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have | |
created a backup copy. Incorrect changes to this file will make it | |
impossible to load or build your projects from the command-line or the IDE. | |
Copyright (c) .NET Foundation. All rights reserved. | |
*********************************************************************************************** | |
--> | |
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<!-- Load NuGet.Build.Tasks.Pack.dll, this can be overridden to use a different version with $(NuGetPackTaskAssemblyFile) --> | |
<PropertyGroup Condition="$(NuGetPackTaskAssemblyFile) == ''"> | |
<NuGetPackTaskAssemblyFile Condition="'$(MSBuildRuntimeType)' == 'Core'">..\CoreCLR\NuGet.Build.Tasks.Pack.dll</NuGetPackTaskAssemblyFile> | |
<NuGetPackTaskAssemblyFile Condition="'$(MSBuildRuntimeType)' != 'Core'">..\Desktop\NuGet.Build.Tasks.Pack.dll</NuGetPackTaskAssemblyFile> | |
</PropertyGroup> | |
<!-- Tasks --> | |
<UsingTask TaskName="NuGet.Build.Tasks.Pack.PackTask" AssemblyFile="$(NuGetPackTaskAssemblyFile)" /> | |
<UsingTask TaskName="NuGet.Build.Tasks.Pack.GetPackOutputItemsTask" AssemblyFile="$(NuGetPackTaskAssemblyFile)" /> | |
<UsingTask TaskName="NuGet.Build.Tasks.GetProjectTargetFrameworksTask" AssemblyFile="$(NuGetPackTaskAssemblyFile)" /> | |
<UsingTask TaskName="NuGet.Build.Tasks.Pack.GetProjectReferencesFromAssetsFileTask" AssemblyFile="$(NuGetPackTaskAssemblyFile)" /> | |
<UsingTask TaskName="NuGet.Build.Tasks.Pack.IsPackableFalseWarningTask" AssemblyFile="$(NuGetPackTaskAssemblyFile)" /> | |
<PropertyGroup> | |
<PackageId Condition=" '$(PackageId)' == '' ">$(AssemblyName)</PackageId> | |
<PackageVersion Condition=" '$(PackageVersion)' == '' ">$(Version)</PackageVersion> | |
<IncludeContentInPack Condition="'$(IncludeContentInPack)'==''">true</IncludeContentInPack> | |
<GenerateNuspecDependsOn>_LoadPackInputItems; _GetTargetFrameworksOutput; _WalkEachTargetPerFramework; _GetPackageFiles; $(GenerateNuspecDependsOn)</GenerateNuspecDependsOn> | |
<PackageDescription Condition="'$(PackageDescription)'==''">$(Description)</PackageDescription> | |
<PackageDescription Condition="'$(PackageDescription)'==''">Package Description</PackageDescription> | |
<IsPackable Condition="'$(IsPackable)'=='' AND '$(IsTestProject)'=='true'">false</IsPackable> | |
<IsPackable Condition="'$(IsPackable)'==''">true</IsPackable> | |
<IncludeBuildOutput Condition="'$(IncludeBuildOutput)'==''">true</IncludeBuildOutput> | |
<BuildOutputTargetFolder Condition="'$(BuildOutputTargetFolder)' == '' AND '$(IsTool)' == 'true'">tools</BuildOutputTargetFolder> | |
<BuildOutputTargetFolder Condition="'$(BuildOutputTargetFolder)' == ''">lib</BuildOutputTargetFolder> | |
<ContentTargetFolders Condition="'$(ContentTargetFolders)' == ''">content;contentFiles</ContentTargetFolders> | |
<PackDependsOn>$(BeforePack); _IntermediatePack; GenerateNuspec; $(PackDependsOn)</PackDependsOn> | |
<IsInnerBuild Condition="'$(TargetFramework)' != '' AND '$(TargetFrameworks)' != ''">true</IsInnerBuild> | |
<SymbolPackageFormat Condition="'$(SymbolPackageFormat)' == ''">symbols.nupkg</SymbolPackageFormat> | |
<AddPriFileDependsOn Condition="'$(MicrosoftPortableCurrentVersionPropsHasBeenImported)' == 'true'">DeterminePortableBuildCapabilities</AddPriFileDependsOn> | |
<WarnOnPackingNonPackableProject Condition="'$(WarnOnPackingNonPackableProject)' == ''">false</WarnOnPackingNonPackableProject> | |
<ImportNuGetBuildTasksPackTargetsFromSdk Condition="'$(ImportNuGetBuildTasksPackTargetsFromSdk)' == ''">false</ImportNuGetBuildTasksPackTargetsFromSdk> | |
<DefaultAllowedOutputExtensionsInPackageBuildOutputFolder Condition="'$(DefaultAllowedOutputExtensionsInPackageBuildOutputFolder)' == ''">.dll; .exe; .winmd; .json; .pri; .xml</DefaultAllowedOutputExtensionsInPackageBuildOutputFolder> | |
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(DefaultAllowedOutputExtensionsInPackageBuildOutputFolder) ;$(AllowedOutputExtensionsInPackageBuildOutputFolder)</AllowedOutputExtensionsInPackageBuildOutputFolder> | |
<AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder Condition="'$(SymbolPackageFormat)' != 'snupkg'">.pdb; .mdb; $(AllowedOutputExtensionsInPackageBuildOutputFolder); $(AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder)</AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder> | |
<AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder Condition="'$(SymbolPackageFormat)' == 'snupkg'">.pdb</AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder> | |
<SuppressDependenciesWhenPacking Condition="'$(SuppressDependenciesWhenPacking)' == ''">false</SuppressDependenciesWhenPacking> | |
</PropertyGroup> | |
<PropertyGroup Condition="'$(NoBuild)' == 'true' or '$(GeneratePackageOnBuild)' == 'true'"> | |
<GenerateNuspecDependsOn>$(GenerateNuspecDependsOn)</GenerateNuspecDependsOn> | |
</PropertyGroup> | |
<PropertyGroup Condition="'$(NoBuild)' != 'true' and '$(GeneratePackageOnBuild)' != 'true'"> | |
<GenerateNuspecDependsOn>Build;$(GenerateNuspecDependsOn)</GenerateNuspecDependsOn> | |
</PropertyGroup> | |
<ItemGroup> | |
<ProjectCapability Include="Pack"/> | |
</ItemGroup> | |
<ItemDefinitionGroup> | |
<BuildOutputInPackage> | |
<TargetFramework>$(TargetFramework)</TargetFramework> | |
</BuildOutputInPackage> | |
</ItemDefinitionGroup> | |
<PropertyGroup> | |
<RestoreOutputPath Condition="'$(RestoreOutputPath)' == ''">$(MSBuildProjectExtensionsPath)</RestoreOutputPath> | |
<PackageOutputPath Condition="'$(PackageOutputPath)' == ''">$(BaseOutputPath)$(Configuration)\</PackageOutputPath> | |
<NuspecOutputPath Condition="'$(NuspecOutputPath)' == ''">$(BaseIntermediateOutputPath)$(Configuration)\</NuspecOutputPath> | |
</PropertyGroup> | |
<!-- | |
============================================================ | |
_GetAbsoluteOutputPathsForPack | |
Gets the absolute output paths for Pack. | |
============================================================ | |
--> | |
<Target Name="_GetAbsoluteOutputPathsForPack"> | |
<ConvertToAbsolutePath Paths="$(RestoreOutputPath)"> | |
<Output TaskParameter="AbsolutePaths" PropertyName="RestoreOutputAbsolutePath" /> | |
</ConvertToAbsolutePath> | |
<ConvertToAbsolutePath Paths="$(PackageOutputPath)"> | |
<Output TaskParameter="AbsolutePaths" PropertyName="PackageOutputAbsolutePath" /> | |
</ConvertToAbsolutePath> | |
<ConvertToAbsolutePath Paths="$(NuspecOutputPath)"> | |
<Output TaskParameter="AbsolutePaths" PropertyName="NuspecOutputAbsolutePath" /> | |
</ConvertToAbsolutePath> | |
</Target> | |
<!-- | |
============================================================ | |
_GetOutputItemsFromPack | |
Gets the output '.nupkg' and '.nuspec' absolute file paths. | |
============================================================ | |
--> | |
<Target Name="_GetOutputItemsFromPack" | |
DependsOnTargets="_GetAbsoluteOutputPathsForPack" | |
Returns="@(_OutputPackItems)"> | |
<!-- 'PackageOutputAbsolutePath' and 'NuspecOutputAbsolutePath' will be provided by '_GetAbsoluteOutputPathsForPack' target --> | |
<GetPackOutputItemsTask | |
PackageOutputPath="$(PackageOutputAbsolutePath)" | |
NuspecOutputPath="$(NuspecOutputAbsolutePath)" | |
PackageId="$(PackageId)" | |
PackageVersion="$(PackageVersion)" | |
IncludeSymbols="$(IncludeSymbols)" | |
IncludeSource="$(IncludeSource)" | |
SymbolPackageFormat="$(SymbolPackageFormat)"> | |
<Output | |
TaskParameter="OutputPackItems" | |
ItemName="_OutputPackItems" /> | |
</GetPackOutputItemsTask> | |
</Target> | |
<!-- | |
============================================================ | |
_GetTargetFrameworksOutput | |
Read target frameworks from the project. | |
============================================================ | |
--> | |
<Target Name="_GetTargetFrameworksOutput" | |
Returns="@(_TargetFrameworks)"> | |
<PropertyGroup> | |
<_ProjectFrameworks/> | |
</PropertyGroup> | |
<GetProjectTargetFrameworksTask | |
ProjectPath="$(MSBuildProjectFullPath)" | |
TargetFrameworks="$(TargetFrameworks)" | |
TargetFramework="$(TargetFramework)" | |
TargetFrameworkMoniker="$(TargetFrameworkMoniker)" | |
TargetPlatformIdentifier="$(TargetPlatformIdentifier)" | |
TargetPlatformVersion="$(TargetPlatformVersion)" | |
TargetPlatformMinVersion="$(TargetPlatformMinVersion)"> | |
<Output | |
TaskParameter="ProjectTargetFrameworks" | |
PropertyName="_ProjectFrameworks" /> | |
</GetProjectTargetFrameworksTask> | |
<ItemGroup Condition=" '$(_ProjectFrameworks)' != '' "> | |
<_TargetFrameworks Include="$(_ProjectFrameworks.Split(';'))" /> | |
</ItemGroup> | |
</Target> | |
<!-- | |
============================================================ | |
Pack | |
Post Build Target | |
============================================================ | |
--> | |
<Target Name="_PackAsBuildAfterTarget" | |
AfterTargets="Build" | |
Condition="'$(GeneratePackageOnBuild)' == 'true' AND '$(IsInnerBuild)' != 'true'" | |
DependsOnTargets="Pack"> | |
</Target> | |
<Target Name="_CleanPackageFiles" | |
DependsOnTargets="_GetOutputItemsFromPack" | |
AfterTargets="Clean" | |
Condition="'$(GeneratePackageOnBuild)' == 'true' AND '$(IsInnerBuild)' != 'true'"> | |
<ItemGroup> | |
<_PackageFilesToDelete Include="@(_OutputPackItems)"/> | |
</ItemGroup> | |
<Delete Files="@(_PackageFilesToDelete)"/> | |
</Target> | |
<Target Name="_CalculateInputsOutputsForPack" DependsOnTargets="_GetOutputItemsFromPack"> | |
<PropertyGroup Condition="$(ContinuePackingAfterGeneratingNuspec) == '' "> | |
<ContinuePackingAfterGeneratingNuspec>false</ContinuePackingAfterGeneratingNuspec> | |
</PropertyGroup> | |
<ItemGroup> | |
<!--This catches changes to properties--> | |
<NuGetPackInput Include="$(MSBuildAllProjects)"/> | |
<NuGetPackInput Include="@(_PackageFiles)"/> | |
<NuGetPackInput Include="@(_PackageFilesToExclude)"/> | |
<NuGetPackInput Include="@(_BuildOutputInPackage->'%(FinalOutputPath)')"/> | |
<NuGetPackInput Include="@(_TargetPathsToSymbols->'%(FinalOutputPath)')"/> | |
<NuGetPackInput Include="@(_SourceFiles)"/> | |
<NuGetPackInput Include="@(_References)"/> | |
<NuGetPackOutput Include="@(_OutputPackItems)" /> | |
</ItemGroup> | |
</Target> | |
<!-- | |
============================================================ | |
Pack | |
Main entry point for packing packages | |
============================================================ | |
--> | |
<Target Name="Pack" DependsOnTargets="$(PackDependsOn)"> | |
<IsPackableFalseWarningTask Condition="'$(IsPackable)' == 'false' AND '$(WarnOnPackingNonPackableProject)' == 'true'"/> | |
</Target> | |
<Target Name="_IntermediatePack"> | |
<PropertyGroup> | |
<ContinuePackingAfterGeneratingNuspec>true</ContinuePackingAfterGeneratingNuspec> | |
</PropertyGroup> | |
</Target> | |
<Target Name="GenerateNuspec" | |
Condition="'$(IsPackable)' == 'true'" | |
Inputs="@(NuGetPackInput)" Outputs="@(NuGetPackOutput)" | |
DependsOnTargets="$(GenerateNuspecDependsOn);_CalculateInputsOutputsForPack;_GetProjectReferenceVersions;_InitializeNuspecRepositoryInformationProperties"> | |
<ConvertToAbsolutePath Condition="$(NuspecFile) != ''" Paths="$(NuspecFile)"> | |
<Output TaskParameter="AbsolutePaths" PropertyName="NuspecFileAbsolutePath" /> | |
</ConvertToAbsolutePath> | |
<!-- Call Pack --> | |
<PackTask PackItem="$(PackProjectInputFile)" | |
PackageFiles="@(_PackageFiles)" | |
PackageFilesToExclude="@(_PackageFilesToExclude)" | |
PackageVersion="$(PackageVersion)" | |
PackageId="$(PackageId)" | |
Title="$(Title)" | |
Authors="$(Authors)" | |
Description="$(PackageDescription)" | |
Copyright="$(Copyright)" | |
RequireLicenseAcceptance="$(PackageRequireLicenseAcceptance)" | |
LicenseUrl="$(PackageLicenseUrl)" | |
ProjectUrl="$(PackageProjectUrl)" | |
IconUrl="$(PackageIconUrl)" | |
ReleaseNotes="$(PackageReleaseNotes)" | |
Tags="$(PackageTags)" | |
DevelopmentDependency="$(DevelopmentDependency)" | |
BuildOutputInPackage="@(_BuildOutputInPackage)" | |
ProjectReferencesWithVersions="@(_ProjectReferencesWithVersions)" | |
TargetPathsToSymbols="@(_TargetPathsToSymbols)" | |
TargetFrameworks="@(_TargetFrameworks)" | |
FrameworksWithSuppressedDependencies="@(_FrameworksWithSuppressedDependencies)" | |
AssemblyName="$(AssemblyName)" | |
PackageOutputPath="$(PackageOutputAbsolutePath)" | |
IncludeSymbols="$(IncludeSymbols)" | |
IncludeSource="$(IncludeSource)" | |
PackageTypes="$(PackageType)" | |
IsTool="$(IsTool)" | |
RepositoryUrl="$(RepositoryUrl)" | |
RepositoryType="$(RepositoryType)" | |
RepositoryBranch="$(RepositoryBranch)" | |
RepositoryCommit="$(RepositoryCommit)" | |
SourceFiles="@(_SourceFiles->Distinct())" | |
NoPackageAnalysis="$(NoPackageAnalysis)" | |
NoDefaultExcludes="$(NoDefaultExcludes)" | |
MinClientVersion="$(MinClientVersion)" | |
Serviceable="$(Serviceable)" | |
FrameworkAssemblyReferences="@(_FrameworkAssemblyReferences)" | |
ContinuePackingAfterGeneratingNuspec="$(ContinuePackingAfterGeneratingNuspec)" | |
NuspecOutputPath="$(NuspecOutputAbsolutePath)" | |
IncludeBuildOutput="$(IncludeBuildOutput)" | |
BuildOutputFolders="$(BuildOutputTargetFolder)" | |
ContentTargetFolders="$(ContentTargetFolders)" | |
RestoreOutputPath="$(RestoreOutputAbsolutePath)" | |
NuspecFile="$(NuspecFileAbsolutePath)" | |
NuspecBasePath="$(NuspecBasePath)" | |
NuspecProperties="$(NuspecProperties)" | |
AllowedOutputExtensionsInPackageBuildOutputFolder="$(AllowedOutputExtensionsInPackageBuildOutputFolder)" | |
AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder="$(AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder)" | |
NoWarn="$(NoWarn)" | |
WarningsAsErrors="$(WarningsAsErrors)" | |
WarningsNotAsErrors="$(WarningsNotAsErrors)" | |
TreatWarningsAsErrors="$(TreatWarningsAsErrors)" | |
OutputFileNamesWithoutVersion="$(OutputFileNamesWithoutVersion)" | |
InstallPackageToOutputPath="$(InstallPackageToOutputPath)" | |
SymbolPackageFormat="$(SymbolPackageFormat)" | |
PackageLicenseFile="$(PackageLicenseFile)" | |
PackageLicenseExpression="$(PackageLicenseExpression)" | |
PackageLicenseExpressionVersion="$(PackageLicenseExpressionVersion)" | |
Readme="$(PackageReadmeFile)" | |
Deterministic="$(Deterministic)" | |
PackageIcon="$(PackageIcon)" | |
/> | |
</Target> | |
<!-- | |
Initialize Repository* properties from properties set by a source control package, if available in the project. | |
--> | |
<Target Name="_InitializeNuspecRepositoryInformationProperties" | |
DependsOnTargets="InitializeSourceControlInformation" | |
Condition="'$(SourceControlInformationFeatureSupported)' == 'true'"> | |
<PropertyGroup> | |
<!-- The project must specify PublishRepositoryUrl=true in order to publish the URL or branch, in order to prevent inadvertent leak of internal data. --> | |
<RepositoryUrl Condition="'$(RepositoryUrl)' == '' and '$(PublishRepositoryUrl)' == 'true'">$(PrivateRepositoryUrl)</RepositoryUrl> | |
<RepositoryCommit Condition="'$(RepositoryCommit)' == ''">$(SourceRevisionId)</RepositoryCommit> | |
<RepositoryBranch Condition="'$(RepositoryBranch)' == '' and '$(PublishRepositoryUrl)' == 'true' and '$(SourceBranchName)' != ''">$(SourceBranchName)</RepositoryBranch> | |
</PropertyGroup> | |
</Target> | |
<!-- | |
============================================================ | |
_LoadPackGraphEntryPoints | |
Find project entry point and load them into items. | |
============================================================ | |
--> | |
<Target Name="_LoadPackInputItems"> | |
<!-- Allow overriding items with PackProjectInputFile --> | |
<PropertyGroup Condition="'$(PackProjectInputFile)' == ''"> | |
<PackProjectInputFile>$(MSBuildProjectFullPath)</PackProjectInputFile> | |
</PropertyGroup> | |
</Target> | |
<Target Name="_GetProjectReferenceVersions" | |
Condition="'$(NuspecFile)' == ''" | |
DependsOnTargets="_GetAbsoluteOutputPathsForPack;$(GetPackageVersionDependsOn)"> | |
<!-- 'RestoreOutputAbsolutePath' will be provided by '_GetAbsoluteOutputPathsForPack' target --> | |
<ConvertToAbsolutePath Condition="'$(ProjectAssetsFile)' != ''" Paths="$(ProjectAssetsFile)"> | |
<Output TaskParameter="AbsolutePaths" PropertyName="ProjectAssetsFileAbsolutePath" /> | |
</ConvertToAbsolutePath> | |
<GetProjectReferencesFromAssetsFileTask | |
RestoreOutputAbsolutePath="$(RestoreOutputAbsolutePath)" | |
ProjectAssetsFileAbsolutePath="$(ProjectAssetsFileAbsolutePath)"> | |
<Output | |
TaskParameter="ProjectReferences" | |
ItemName="_ProjectReferencesFromAssetsFile" /> | |
</GetProjectReferencesFromAssetsFileTask> | |
<MSBuild | |
Projects="@(_ProjectReferencesFromAssetsFile)" | |
Targets="_GetProjectVersion" | |
SkipNonexistentTargets="true" | |
SkipNonexistentProjects="true" | |
Properties="BuildProjectReferences=false;"> | |
<Output | |
TaskParameter="TargetOutputs" | |
ItemName="_ProjectReferencesWithVersions"/> | |
</MSBuild> | |
</Target> | |
<Target Name="_GetProjectVersion" DependsOnTargets="$(GetPackageVersionDependsOn)" | |
Returns="@(_ProjectPathWithVersion)"> | |
<ItemGroup> | |
<_ProjectPathWithVersion Include="$(MSBuildProjectFullPath)"> | |
<ProjectVersion Condition="'$(PackageVersion)' != ''">$(PackageVersion)</ProjectVersion> | |
<ProjectVersion Condition="'$(PackageVersion)' == ''">1.0.0</ProjectVersion> | |
</_ProjectPathWithVersion> | |
</ItemGroup> | |
</Target> | |
<Target Name="_WalkEachTargetPerFramework"> | |
<ItemGroup> | |
<_ProjectsWithTFM Include="$(MSBuildProjectFullPath)" AdditionalProperties="TargetFramework=%(_TargetFrameworks.Identity)" /> | |
<_ProjectsWithTFMNoBuild Include="$(MSBuildProjectFullPath)" AdditionalProperties="TargetFramework=%(_TargetFrameworks.Identity);BuildProjectReferences=false" /> | |
</ItemGroup> | |
<MSBuild | |
Condition="'$(IncludeBuildOutput)' == 'true'" | |
Projects="@(_ProjectsWithTFM)" | |
Targets="_GetBuildOutputFilesWithTfm" | |
BuildInParallel="$(BuildInParallel)"> | |
<Output | |
TaskParameter="TargetOutputs" | |
ItemName="_BuildOutputInPackage" /> | |
</MSBuild> | |
<MSBuild | |
Condition="'$(TargetsForTfmSpecificContentInPackage)' != ''" | |
Projects="@(_ProjectsWithTFM)" | |
Targets="_GetTfmSpecificContentForPackage" | |
BuildInParallel="$(BuildInParallel)"> | |
<Output | |
TaskParameter="TargetOutputs" | |
ItemName="_PackageFiles"/> | |
</MSBuild> | |
<MSBuild | |
Condition="'$(IncludeBuildOutput)' == 'true'" | |
Projects="@(_ProjectsWithTFM)" | |
Targets="_GetDebugSymbolsWithTfm" | |
BuildInParallel="$(BuildInParallel)"> | |
<Output | |
TaskParameter="TargetOutputs" | |
ItemName="_TargetPathsToSymbols" /> | |
</MSBuild> | |
<MSBuild | |
Condition="'$(IncludeSource)' == 'true'" | |
Projects="@(_ProjectsWithTFMNoBuild)" | |
Targets="SourceFilesProjectOutputGroup" | |
BuildInParallel="$(BuildInParallel)"> | |
<Output | |
TaskParameter="TargetOutputs" | |
ItemName="_SourceFiles" /> | |
</MSBuild> | |
<MSBuild | |
Projects="@(_ProjectsWithTFMNoBuild)" | |
Targets="_GetFrameworkAssemblyReferences" | |
BuildInParallel="$(BuildInParallel)"> | |
<Output | |
TaskParameter="TargetOutputs" | |
ItemName="_FrameworkAssemblyReferences" /> | |
</MSBuild> | |
<MSBuild | |
Projects="@(_ProjectsWithTFMNoBuild)" | |
Targets="_GetFrameworksWithSuppressedDependencies" | |
BuildInParallel="$(BuildInParallel)"> | |
<Output | |
TaskParameter="TargetOutputs" | |
ItemName="_FrameworksWithSuppressedDependencies" /> | |
</MSBuild> | |
</Target> | |
<Target Name ="_GetFrameworksWithSuppressedDependencies" Returns="@(_TfmWithDependenciesSuppressed)"> | |
<ItemGroup> | |
<_TfmWithDependenciesSuppressed Include="$(TargetFramework)" Condition="'$(SuppressDependenciesWhenPacking)' == 'true'"/> | |
</ItemGroup> | |
</Target> | |
<Target Name ="_GetFrameworkAssemblyReferences" DependsOnTargets="ResolveReferences" Returns="@(TfmSpecificFrameworkAssemblyReferences)"> | |
<ItemGroup> | |
<TfmSpecificFrameworkAssemblyReferences Include="@(ReferencePath->'%(OriginalItemSpec)')" | |
Condition="'%(ReferencePath.Pack)' != 'false' AND '%(ReferencePath.ResolvedFrom)' == '{TargetFrameworkDirectory}'"> | |
<TargetFramework>$(TargetFramework)</TargetFramework> | |
</TfmSpecificFrameworkAssemblyReferences> | |
</ItemGroup> | |
</Target> | |
<Target Name="_GetBuildOutputFilesWithTfm" | |
DependsOnTargets="BuiltProjectOutputGroup;DocumentationProjectOutputGroup;SatelliteDllsProjectOutputGroup;_AddPriFileToPackBuildOutput;$(TargetsForTfmSpecificBuildOutput)" | |
Returns="@(BuildOutputInPackage)"> | |
<ItemGroup Condition="'$(IncludeBuildOutput)' == 'true'"> | |
<BuildOutputInPackage Include="@(SatelliteDllsProjectOutputGroupOutput); | |
@(BuiltProjectOutputGroupOutput); | |
@(DocumentationProjectOutputGroupOutput); | |
@(_PathToPriFile)"/> | |
</ItemGroup> | |
</Target> | |
<Target Name="_GetTfmSpecificContentForPackage" | |
DependsOnTargets="$(TargetsForTfmSpecificContentInPackage)" | |
Returns="@(TfmSpecificPackageFileWithRecursiveDir)"> | |
<!-- The below workaround needs to be done due to msbuild bug https://github.com/Microsoft/msbuild/issues/3121 --> | |
<ItemGroup> | |
<TfmSpecificPackageFileWithRecursiveDir Include="@(TfmSpecificPackageFile)"> | |
<NuGetRecursiveDir>%(TfmSpecificPackageFile.RecursiveDir)</NuGetRecursiveDir> | |
<BuildAction>%(TfmSpecificPackageFile.BuildAction)</BuildAction> | |
</TfmSpecificPackageFileWithRecursiveDir> | |
</ItemGroup> | |
</Target> | |
<Target Name="_GetDebugSymbolsWithTfm" | |
DependsOnTargets="DebugSymbolsProjectOutputGroup;$(TargetsForTfmSpecificDebugSymbolsInPackage)" | |
Returns="@(_TargetPathsToSymbolsWithTfm)"> | |
<ItemGroup Condition="'$(IncludeBuildOutput)' == 'true'"> | |
<_TargetPathsToSymbolsWithTfm Include="@(DebugSymbolsProjectOutputGroupOutput)"> | |
<TargetFramework>$(TargetFramework)</TargetFramework> | |
</_TargetPathsToSymbolsWithTfm> | |
</ItemGroup> | |
<ItemGroup> | |
<_TargetPathsToSymbolsWithTfm Include="@(TfmSpecificDebugSymbolsFile)" /> | |
</ItemGroup> | |
</Target> | |
<!--Projects with target framework like UWP, Win8, wpa81 produce a Pri file | |
in their bin dir. This Pri file is not included in the BuiltProjectGroupOutput, and | |
has to be added manually here.--> | |
<Target Name="_AddPriFileToPackBuildOutput" | |
Returns="@(_PathToPriFile)" | |
DependsOnTargets="$(AddPriFileDependsOn)"> | |
<ItemGroup Condition="'$(IncludeProjectPriFile)' == 'true'"> | |
<_PathToPriFile Include="$(ProjectPriFullPath)"> | |
<FinalOutputPath>$(ProjectPriFullPath)</FinalOutputPath> | |
<TargetPath>$(ProjectPriFileName)</TargetPath> | |
</_PathToPriFile> | |
</ItemGroup> | |
</Target> | |
<!-- | |
============================================================ | |
_GetPackageFiles | |
Entry point for generating the project to project references. | |
============================================================ | |
--> | |
<Target Name="_GetPackageFiles" Condition="$(IncludeContentInPack) == 'true'"> | |
<ItemGroup> | |
<_PackageFilesToExclude Include="@(Content)" Condition="'%(Content.Pack)' == 'false'"/> | |
</ItemGroup> | |
<!-- Include PackageFiles and Content of the project being packed --> | |
<ItemGroup> | |
<_PackageFiles Include="@(Content)" Condition=" %(Content.Pack) != 'false' "> | |
<BuildAction Condition="'%(Content.BuildAction)' == ''">Content</BuildAction> | |
</_PackageFiles> | |
<_PackageFiles Include="@(Compile)" Condition=" %(Compile.Pack) == 'true' "> | |
<BuildAction Condition="'%(Compile.BuildAction)' == ''">Compile</BuildAction> | |
</_PackageFiles> | |
<_PackageFiles Include="@(None)" Condition=" %(None.Pack) == 'true' "> | |
<BuildAction Condition="'%(None.BuildAction)' == ''">None</BuildAction> | |
</_PackageFiles> | |
<_PackageFiles Include="@(EmbeddedResource)" Condition=" %(EmbeddedResource.Pack) == 'true' "> | |
<BuildAction Condition="'%(EmbeddedResource.BuildAction)' == ''">EmbeddedResource</BuildAction> | |
</_PackageFiles> | |
<_PackageFiles Include="@(ApplicationDefinition)" Condition=" %(ApplicationDefinition.Pack) == 'true' "> | |
<BuildAction Condition="'%(ApplicationDefinition.BuildAction)' == ''">ApplicationDefinition</BuildAction> | |
</_PackageFiles> | |
<_PackageFiles Include="@(Page)" Condition=" %(Page.Pack) == 'true' "> | |
<BuildAction Condition="'%(Page.BuildAction)' == ''">Page</BuildAction> | |
</_PackageFiles> | |
<_PackageFiles Include="@(Resource)" Condition=" %(Resource.Pack) == 'true' "> | |
<BuildAction Condition="'%(Resource.BuildAction)' == ''">Resource</BuildAction> | |
</_PackageFiles> | |
<_PackageFiles Include="@(SplashScreen)" Condition=" %(SplashScreen.Pack) == 'true' "> | |
<BuildAction Condition="'%(SplashScreen.BuildAction)' == ''">SplashScreen</BuildAction> | |
</_PackageFiles> | |
<_PackageFiles Include="@(DesignData)" Condition=" %(DesignData.Pack) == 'true' "> | |
<BuildAction Condition="'%(DesignData.BuildAction)' == ''">DesignData</BuildAction> | |
</_PackageFiles> | |
<_PackageFiles Include="@(DesignDataWithDesignTimeCreatableTypes)" Condition=" %(DesignDataWithDesignTimeCreatableTypes.Pack) == 'true' "> | |
<BuildAction Condition="'%(DesignDataWithDesignTimeCreatableTypes.BuildAction)' == ''">DesignDataWithDesignTimeCreatableTypes</BuildAction> | |
</_PackageFiles> | |
<_PackageFiles Include="@(CodeAnalysisDictionary)" Condition=" %(CodeAnalysisDictionary.Pack) == 'true' "> | |
<BuildAction Condition="'%(CodeAnalysisDictionary.BuildAction)' == ''">CodeAnalysisDictionary</BuildAction> | |
</_PackageFiles> | |
<_PackageFiles Include="@(AndroidAsset)" Condition=" %(AndroidAsset.Pack) == 'true' "> | |
<BuildAction Condition="'%(AndroidAsset.BuildAction)' == ''">AndroidAsset</BuildAction> | |
</_PackageFiles> | |
<_PackageFiles Include="@(AndroidResource)" Condition=" %(AndroidResource.Pack) == 'true' "> | |
<BuildAction Condition="'%(AndroidResource.BuildAction)' == ''">AndroidResource</BuildAction> | |
</_PackageFiles> | |
<_PackageFiles Include="@(BundleResource)" Condition=" %(BundleResource.Pack) == 'true' "> | |
<BuildAction Condition="'%(BundleResource.BuildAction)' == ''">BundleResource</BuildAction> | |
</_PackageFiles> | |
</ItemGroup> | |
</Target> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment