--- /dev/null
+<!--
+***********************************************************************************************
+Microsoft.NuGet.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">
+ <UsingTask TaskName="Microsoft.NuGet.Build.Tasks.ResolveNuGetPackageAssets" AssemblyFile="Microsoft.NuGet.Build.Tasks.dll" />
+
+ <PropertyGroup Condition="'$(ProjectLockFile)' == ''">
+ <_ProjectSpecificProjectJsonFile>$(MSBuildProjectName).project.json</_ProjectSpecificProjectJsonFile>
+ <ProjectLockFile Condition="Exists('$(_ProjectSpecificProjectJsonFile)')">$(MSBuildProjectName).project.lock.json</ProjectLockFile>
+ <ProjectLockFile Condition="!Exists('$(_ProjectSpecificProjectJsonFile)')">project.lock.json</ProjectLockFile>
+ </PropertyGroup>
+
+ <PropertyGroup>
+ <ResolveNuGetPackages Condition="'$(ResolveNuGetPackages)' == '' and '$(MSBuildProjectExtension)' != '.xproj'">true</ResolveNuGetPackages>
+
+ <BaseNuGetRuntimeIdentifier Condition="'$(BaseNuGetRuntimeIdentifier)' == '' and '$(TargetPlatformIdentifier)' == 'UAP'">win10</BaseNuGetRuntimeIdentifier>
+ <BaseNuGetRuntimeIdentifier Condition="'$(BaseNuGetRuntimeIdentifier)' == ''">win</BaseNuGetRuntimeIdentifier>
+
+ <UseTargetPlatformAsNuGetTargetMoniker Condition="'$(UseTargetPlatformAsNuGetTargetMoniker)' == '' AND '$(TargetFrameworkMoniker)' == '.NETCore,Version=v5.0'">true</UseTargetPlatformAsNuGetTargetMoniker>
+ <NuGetTargetMoniker Condition="'$(NuGetTargetMoniker)' == '' AND '$(UseTargetPlatformAsNuGetTargetMoniker)' == 'true'">$(TargetPlatformIdentifier),Version=v$([System.Version]::Parse('$(TargetPlatformMinVersion)').ToString(3))</NuGetTargetMoniker>
+ <NuGetTargetMoniker Condition="'$(NuGetTargetMoniker)' == '' AND '$(UseTargetPlatformAsNuGetTargetMoniker)' != 'true'">$(TargetFrameworkMoniker)</NuGetTargetMoniker>
+
+ <CopyNuGetImplementations Condition="'$(CopyNuGetImplementations)' == '' and (('$(OutputType)' != 'library' and ('$(OutputType)' != 'winmdobj' or '$(AppxPackage)' == 'true')) or '$(TargetFrameworkIdentifier)' == '.NETFramework')">true</CopyNuGetImplementations>
+ <IncludeFrameworkReferencesFromNuGet Condition="'$(IncludeFrameworkReferencesFromNuGet)' == ''">true</IncludeFrameworkReferencesFromNuGet>
+
+ <_NuGetRuntimeIdentifierPlatformTargetSuffix Condition="'$(PlatformTarget)' != '' and '$(PlatformTarget)' != 'AnyCPU'">-$(PlatformTarget.ToLower())</_NuGetRuntimeIdentifierPlatformTargetSuffix>
+ <_NuGetRuntimeIdentifierWithoutAot>$(BaseNuGetRuntimeIdentifier)$(_NuGetRuntimeIdentifierPlatformTargetSuffix)</_NuGetRuntimeIdentifierWithoutAot>
+ </PropertyGroup>
+
+ <!-- If a NuGetRuntimeIdentifier wasn't already specified, let's go generate it -->
+ <PropertyGroup Condition="'$(NuGetRuntimeIdentifier)' == '' and '$(CopyNuGetImplementations)' == 'true'">
+ <NuGetRuntimeIdentifier>$(_NuGetRuntimeIdentifierWithoutAot)</NuGetRuntimeIdentifier>
+ <NuGetRuntimeIdentifier Condition="'$(UseDotNetNativeToolchain)' == 'true'">$(_NuGetRuntimeIdentifierWithoutAot)-aot</NuGetRuntimeIdentifier>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <!-- If we are resolving from project.lock.json, we need to consider any edit to it as something that forces a rebuild -->
+ <CustomAdditionalCompileInputs Include="$(ProjectLockFile)" Condition="'$(ResolveNuGetPackages)' == 'true' and Exists('$(ProjectLockFile)')" />
+ </ItemGroup>
+
+ <PropertyGroup Condition="'$(TargetPlatformIdentifier)' == 'UAP'">
+ <_NuGetTargetFallbackMoniker>UAP,Version=v10.0</_NuGetTargetFallbackMoniker>
+ <ImplicitlyExpandTargetFramework>false</ImplicitlyExpandTargetFramework>
+ <EnableAppLocalFXWorkaround>false</EnableAppLocalFXWorkaround>
+ <UseNetNativeCustomFramework>true</UseNetNativeCustomFramework>
+ </PropertyGroup>
+
+ <!--
+ ============================================================
+ GetProjectsReferencingProjectJsonFiles
+ ============================================================
+ -->
+ <Target Name="GetProjectsReferencingProjectJson" DependsOnTargets="_SplitProjectReferencesByFileExistence" Returns="@(_ProjectReferencingProjectJsonFile)">
+ <ItemGroup Condition="'$(ResolveNuGetPackages)' == 'true'">
+ <_ProjectReferencingProjectJsonFile Include="$(MSBuildProjectFullPath)">
+ <ProjectReferences>@(ProjectReference)</ProjectReferences>
+ <ProjectJson>$(MSBuildProjectDirectory)\project.json</ProjectJson>
+ </_ProjectReferencingProjectJsonFile>
+ </ItemGroup>
+
+ <MSBuild
+ Projects="@(_MSBuildProjectReferenceExistent)"
+ Targets="GetProjectsReferencingProjectJson"
+ BuildInParallel="$(BuildInParallel)"
+ Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration); %(_MSBuildProjectReferenceExistent.SetPlatform)"
+ RemoveProperties="%(_MSBuildProjectReferenceExistent.GlobalPropertiesToRemove)">
+
+ <Output TaskParameter="TargetOutputs" ItemName="_ProjectReferencingProjectJsonFile" />
+ </MSBuild>
+ </Target>
+
+ <ItemGroup>
+ <NuGetPreprocessorValue Include="rootnamespace">
+ <Value>$(RootNamespace)</Value>
+ </NuGetPreprocessorValue>
+ <NuGetPreprocessorValue Include="assemblyname">
+ <Value>$(AssemblyName)</Value>
+ </NuGetPreprocessorValue>
+ <NuGetPreprocessorValue Include="fullpath">
+ <Value>$(MSBuildProjectDirectory)</Value>
+ </NuGetPreprocessorValue>
+ <NuGetPreprocessorValue Include="outputfilename">
+ <Value>$(TargetFileName)</Value>
+ </NuGetPreprocessorValue>
+ <NuGetPreprocessorValue Include="filename">
+ <Value>$(MSBuildProjectFile)</Value>
+ </NuGetPreprocessorValue>
+ </ItemGroup>
+
+ <!--
+ ============================================================
+ ResolveNuGetPackageAssets
+
+ Resolve assets from consumed NuGet packages listed in the project.lock.json
+
+ [OUT]
+ @(Analyzer) - Paths to build-time diagnostic analyzers
+ @(Reference) - Paths to build-time NuGet dependencies
+ @(ReferenceCopyLocalPaths) - Paths to run-time dependencies to copy
+ ============================================================
+ -->
+ <PropertyGroup>
+ <ResolveAssemblyReferencesDependsOn>$(ResolveAssemblyReferencesDependsOn);ResolveNuGetPackageAssets</ResolveAssemblyReferencesDependsOn>
+ <PrepareResourcesDependsOn>ResolveNuGetPackageAssets;$(PrepareResourcesDependsOn)</PrepareResourcesDependsOn>
+ </PropertyGroup>
+
+ <PropertyGroup>
+ <ResolveNuGetPackageAssetsDependsOn>ResolveProjectReferences</ResolveNuGetPackageAssetsDependsOn>
+ <ResolveNuGetPackageAssetsDependsOn Condition="'$(ImplicitlyExpandTargetFramework)' == 'true'">$(ResolveNuGetPackageAssetsDependsOn);ImplicitlyExpandTargetFramework</ResolveNuGetPackageAssetsDependsOn>
+ </PropertyGroup>
+
+ <Target Name="ResolveNuGetPackageAssets" DependsOnTargets="$(ResolveNuGetPackageAssetsDependsOn)" Condition="'$(ResolveNuGetPackages)' == 'true' and exists('$(ProjectLockFile)')">
+ <!-- We need to figure out the output path of any dependent xproj projects -->
+ <MSBuild
+ Projects="@(_MSBuildProjectReferenceExistent)"
+ Targets="GetTargetDir"
+ BuildInParallel="$(BuildInParallel)"
+ Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration); %(_MSBuildProjectReferenceExistent.SetPlatform)"
+ RemoveProperties="%(_MSBuildProjectReferenceExistent.GlobalPropertiesToRemove)"
+ Condition="'%(_MSBuildProjectReferenceExistent.Extension)' == '.xproj'">
+
+ <Output TaskParameter="TargetOutputs" ItemName="_XProjTargetDirs" />
+ </MSBuild>
+
+ <!-- The items in _XProjTargetDirs have the target directories as the main itemspecs and the originating project as metadata; reverse them -->
+ <ItemGroup>
+ <ProjectReferenceCreatingPackage Include="%(_XProjTargetDirs.OriginalItemSpec)">
+ <OutputBasePath>%(_XProjTargetDirs.Identity)</OutputBasePath>
+ </ProjectReferenceCreatingPackage>
+ </ItemGroup>
+
+ <ResolveNuGetPackageAssets AllowFallbackOnTargetSelection="$(DesignTimeBuild)"
+ ContinueOnError="$(ContinueOnError)"
+ IncludeFrameworkReferences="$(IncludeFrameworkReferencesFromNuGet)"
+ NuGetPackagesDirectory="$(NuGetPackagesDirectory)"
+ RuntimeIdentifier="$(NuGetRuntimeIdentifier)"
+ ProjectLanguage="$(Language)"
+ ProjectLockFile="$(ProjectLockFile)"
+ ProjectReferencesCreatingPackages="@(ProjectReferenceCreatingPackage)"
+ ContentPreprocessorValues="@(NuGetPreprocessorValue)"
+ ContentPreprocessorOutputDirectory="$(IntermediateOutputPath)\NuGet"
+ TargetMonikers="$(NuGetTargetMoniker);$(_NuGetTargetFallbackMoniker)">
+
+ <Output TaskParameter="ResolvedAnalyzers" ItemName="Analyzer" />
+ <Output TaskParameter="ResolvedCopyLocalItems" ItemName="ReferenceCopyLocalPaths" />
+ <Output TaskParameter="ResolvedReferences" ItemName="_ReferencesFromNuGetPackages" />
+ <Output TaskParameter="ReferencedPackages" ItemName="ReferencedNuGetPackages" />
+ <Output TaskParameter="ContentItems" ItemName="_NuGetContentItems" />
+ <Output TaskParameter="FileWrites" ItemName="FileWrites" />
+ </ResolveNuGetPackageAssets>
+
+ <ItemGroup>
+ <!-- Remove exact references, such as if a package had a framework reference to 'System' that we already have -->
+ <Reference Remove="@(_ReferencesFromNuGetPackages)" />
+
+ <!-- Remove simple name references that are already implicitly added -->
+ <_ReferencesFromNuGetPackages Remove="%(ReferencePath.FileName)" Condition="'%(ReferencePath.ResolvedFrom)' == 'ImplicitlyExpandTargetFramework'" />
+
+ <!-- Include NuGet references in the proper groups. Project-to-project references must go in the
+ _ResolvedProjectReferencePaths group which matches the behavior of the ResolveProjectReferences
+ target. This ensures that even if the assembly is missing on disk, it still makes it to the compiler. -->
+ <Reference Include="@(_ReferencesFromNuGetPackages)" Condition="'%(_ReferencesFromNuGetPackages.NuGetSourceType)' != 'Project'" />
+ <_ResolvedProjectReferencePaths Include="@(_ReferencesFromNuGetPackages)" Condition="'%(_ReferencesFromNuGetPackages.NuGetSourceType)' == 'Project'" />
+
+ <!-- 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 -->
+ <Reference Remove="%(_ReferencesFromNuGetPackages.FileName)" Condition="'%(_ReferencesFromNuGetPackages.NuGetIsFrameworkReference)' == 'false'"/>
+ </ItemGroup>
+
+ <PropertyGroup Condition=" '$(AutoUnifyAssemblyReferences)' == 'true' ">
+ <!-- Normally Design Time Assembly Resolution (DTAR) won't consider these references.
+ Put DTAR in a mode where it will prefer the output of RAR and unify. -->
+ <DTARUseReferencesFromProject>true</DTARUseReferencesFromProject>
+ </PropertyGroup>
+
+ <!-- The items in _NuGetContentItems need to go into the appropriately-named item group, but the names depend upon the items
+ themselves. Split it apart. -->
+ <CreateItem Include="@(_NuGetContentItems)" Condition="'@(_NuGetContentItems)' != ''">
+ <Output TaskParameter="Include" ItemName="%(_NuGetContentItems.NuGetItemType)" />
+ </CreateItem>
+ </Target>
+
+ <Target Name="RuntimeImplementationProjectOutputGroup" Returns="@(RuntimeImplementationProjectOutputGroupOutput)" Condition="'$(ResolveNuGetPackages)' == 'true' and exists('$(ProjectLockFile)')">
+ <!-- This output group must contain the implementation assemblies for the host (i.e. design time) environment, not the
+ target environment. Thus, we explicitly pass the RuntimeIdentifier that doesn't have the -aot suffix -->
+ <ResolveNuGetPackageAssets AllowFallbackOnTargetSelection="$(DesignTimeBuild)"
+ NuGetPackagesDirectory="$(NuGetPackagesDirectory)"
+ RuntimeIdentifier="$(_NuGetRuntimeIdentifierWithoutAot)"
+ ProjectLanguage="$(Language)"
+ ProjectLockFile="$(ProjectLockFile)"
+ TargetMonikers="$(NuGetTargetMoniker);$(_NuGetTargetFallbackMoniker)">
+
+ <Output TaskParameter="ResolvedCopyLocalItems" ItemName="NonAheadOfTimeRuntimeImplementations" />
+ </ResolveNuGetPackageAssets>
+
+ <ItemGroup>
+ <RuntimeImplementationProjectOutputGroupOutput Include="%(NonAheadOfTimeRuntimeImplementations.Identity)">
+ <FinalOutputPath>%(NonAheadOfTimeRuntimeImplementations.FullPath)</FinalOutputPath>
+ <TargetPath>%(NonAheadOfTimeRuntimeImplementations.FullPath)</TargetPath>
+ </RuntimeImplementationProjectOutputGroupOutput>
+ </ItemGroup>
+ </Target>
+
+ <!--
+ ============================================================
+ Framework injection into mixed-target applications
+ ============================================================
+ -->
+ <PropertyGroup>
+ <NuGetTargetFrameworkMonikerToInject Condition="'$(NuGetTargetFrameworkMonikerToInject)' == ''">.NETCore,Version=v5.0</NuGetTargetFrameworkMonikerToInject>
+ <NuGetTargetMonikerToInject Condition="'$(NuGetTargetMonikerToInject)' == ''">.NETCore,Version=v5.0</NuGetTargetMonikerToInject>
+ <_ComputeNetCoreFrameworkInjectionParametersBeforeTargets Condition="'$(AppxPackage)' == 'true' and '$(TargetPlatformIdentifier)' == 'UAP'">BeforeGenerateProjectPriFile</_ComputeNetCoreFrameworkInjectionParametersBeforeTargets>
+ </PropertyGroup>
+
+ <Target Name="ComputeNetCoreFrameworkInjectionParameters" BeforeTargets="$(_ComputeNetCoreFrameworkInjectionParametersBeforeTargets)" DependsOnTargets="_AddUnionWinmd" Condition="'$(_ComputeNetCoreFrameworkInjectionParametersBeforeTargets)' != ''">
+ <PropertyGroup>
+ <_PackagingOutputsIncludesFramework Condition="'%(PackagingOutputs.FileName)%(PackagingOutputs.Extension)' == 'System.Runtime.dll'">true</_PackagingOutputsIncludesFramework>
+ <_AppContainsManagedCodeForInjection Condition="'%(PackagingOutputs.Identity)' == '$(_TargetPlatformSdkDir)UnionMetadata\Windows.winmd'">true</_AppContainsManagedCodeForInjection>
+ </PropertyGroup>
+
+ <PropertyGroup>
+ <_NetCoreFrameworkInjectionNeeded Condition="'$(_PackagingOutputsIncludesFramework)' != 'true' and '$(_AppContainsManagedCodeForInjection)' == 'true'">true</_NetCoreFrameworkInjectionNeeded>
+ </PropertyGroup>
+ </Target>
+
+ <Target Name="InjectNetCoreFrameworkBlockIfLockFileExists" AfterTargets="ComputeNetCoreFrameworkInjectionParameters" Condition="'$(_NetCoreFrameworkInjectionNeeded)' == 'true' and '$(ResolveNuGetPackages)' == 'true' and Exists('$(ProjectLockFile)')">
+ <Error Text="One of your dependencies requires the .NET Framework, but the .NET Framework could not be found in the NuGet packages installed in this project. Please install the appropriate .NET Framework packages required by your dependency." />
+ </Target>
+
+ <Target Name="InjectNetCoreFramework" AfterTargets="ComputeNetCoreFrameworkInjectionParameters" Condition="'$(_NetCoreFrameworkInjectionNeeded)' == 'true' and ('$(ResolveNuGetPackages)' != 'true' or !Exists('$(ProjectLockFile)'))">
+ <GetReferenceAssemblyPaths TargetFrameworkMoniker="$(NuGetTargetFrameworkMonikerToInject)" Condition="'$(FrameworkInjectionLockFile)' == ''">
+ <Output TaskParameter="ReferenceAssemblyPaths" ItemName="_NuGetInjectionSourceDirectories" />
+ </GetReferenceAssemblyPaths>
+
+ <PropertyGroup>
+ <FrameworkInjectionLockFile Condition="'$(FrameworkInjectionLockFile)' == ''">@(_NuGetInjectionSourceDirectories->'%(Identity)\project.lock.json')</FrameworkInjectionLockFile>
+ <FrameworkInjectionPackagesDirectory Condition="'$(FrameworkInjectionPackagesDirectory)' == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\NuGet\Repository', 'NETCoreSDK', null, RegistryView.Registry32, RegistryView.Default))</FrameworkInjectionPackagesDirectory>
+ </PropertyGroup>
+
+ <ResolveNuGetPackageAssets Condition="Exists('$(FrameworkInjectionLockFile)')"
+ NuGetPackagesDirectory="$(FrameworkInjectionPackagesDirectory)"
+ RuntimeIdentifier="$(NuGetRuntimeIdentifier)"
+ TargetMonikers="$(NuGetTargetMonikerToInject)"
+ ProjectLockFile="$(FrameworkInjectionLockFile)">
+
+ <Output TaskParameter="ResolvedCopyLocalItems" ItemName="_InjectNetCoreFrameworkPayload" />
+ </ResolveNuGetPackageAssets>
+
+ <PropertyGroup>
+ <_CoreRuntimePackageId Condition="'%(_InjectNetCoreFrameworkPayload.FileName)%(_InjectNetCoreFrameworkPayload.Extension)' == 'mscorlib.dll' OR '%(_InjectNetCoreFrameworkPayload.FileName)%(_InjectNetCoreFrameworkPayload.Extension)' == 'mscorlib.ni.dll'">%(_InjectNetCoreFrameworkPayload.NuGetPackageId)</_CoreRuntimePackageId>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackagingOutputs Include="@(_InjectNetCoreFrameworkPayload)" Condition="'%(_InjectNetCoreFrameworkPayload.NuGetPackageId)' != '$(_CoreRuntimePackageId)' or '$(UseDotNetNativeToolchain)' == 'true'">
+ <TargetPath>%(Filename)%(Extension)</TargetPath>
+ <ProjectName>$(ProjectName)</ProjectName>
+ <OutputGroup>CopyLocalFilesOutputGroup</OutputGroup>
+ </PackagingOutputs>
+ </ItemGroup>
+ </Target>
+
+ <Import Project="$(MSBuildProjectDirectory)\$(MSBuildProjectName).nuget.targets" Condition="Exists('$(MSBuildProjectDirectory)\$(MSBuildProjectName).nuget.targets') AND '$(IncludeNuGetImports)' != 'false'" />
+</Project>