Debian Codegraph @

external/nuget-buildtasks/src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.targets

raw
1 <!--
2 ***********************************************************************************************
3 Microsoft.NuGet.targets
4
5 WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
6 created a backup copy. Incorrect changes to this file will make it
7 impossible to load or build your projects from the command-line or the IDE.
8
9 Copyright (c) .NET Foundation. All rights reserved.
10 ***********************************************************************************************
11 -->
12 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
13 <UsingTask TaskName="Microsoft.NuGet.Build.Tasks.ResolveNuGetPackageAssets" AssemblyFile="Microsoft.NuGet.Build.Tasks.dll" />
14
15 <!--
16 Identify the project asset/lock file in following order:
17 1. If ProjectAssetsFile exists, then simply use it since it means project uses PackageReference
18 2. If ProjectLockFile already defined, then use it instead of constructing our own
19 3. Construct our own project lock file for that first check for <ProjectName>.project.json file
20 4. And lastly check for project.json file existence, and use project.lock.json file
21
22 If none of these conditions satisfy then these NuGet build targets will not be executed.
23 -->
24 <Choose>
25 <When Condition="'$(ProjectAssetsFile)' != ''">
26 <!-- The ProjectAssetsFile has been specified which means it uses PackageReference, so use that. -->
27 <PropertyGroup>
28 <ProjectLockFile>$(ProjectAssetsFile)</ProjectLockFile>
29 </PropertyGroup>
30 </When>
31
32 <When Condition="'$(RestoreProjectStyle)' == 'PackageReference'">
33 <!-- The RestoreProjectStyle property has been specified to PackageReference, so use that. -->
34 <PropertyGroup>
35 <ProjectLockFile>$(BaseIntermediateOutputPath)project.assets.json</ProjectLockFile>
36 </PropertyGroup>
37 </When>
38
39 <When Condition="'$(ProjectLockFile)' != ''">
40 <!-- The ProjectLockFile has been specified; don't compute it. -->
41 </When>
42
43 <When Condition="Exists('$(MSBuildProjectName).project.json')">
44 <!-- There's a MyProj.project.json file, so use MyProj.project.lock.json. -->
45 <PropertyGroup>
46 <ProjectLockFile>$(MSBuildProjectName).project.lock.json</ProjectLockFile>
47 </PropertyGroup>
48 </When>
49
50 <When Condition="Exists('project.json')">
51 <!-- There's a project.json file, so use project.lock.json. -->
52 <PropertyGroup>
53 <ProjectLockFile>project.lock.json</ProjectLockFile>
54 </PropertyGroup>
55 </When>
56
57 <Otherwise>
58 <!-- No assets or lock file provided at all, so fallback to project.assets.json file.-->
59 <PropertyGroup>
60 <ProjectLockFile>$(BaseIntermediateOutputPath)project.assets.json</ProjectLockFile>
61 </PropertyGroup>
62 </Otherwise>
63 </Choose>
64
65 <!-- Add to MSBuildAllProjects in order to better support incremental builds. -->
66 <PropertyGroup>
67 <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
68 </PropertyGroup>
69
70 <PropertyGroup>
71 <ResolveNuGetPackages Condition="'$(ResolveNuGetPackages)' == '' and '$(MSBuildProjectExtension)' != '.xproj'">true</ResolveNuGetPackages>
72
73 <!--
74 if BaseNuGetRuntimeIdentifier is defined then simply use it as RuntimeIdentifier, otherwise
75 we'll set RuntimeIdentifiers to default value later on.
76 -->
77 <RuntimeIdentifier Condition="'$(BaseNuGetRuntimeIdentifier)' != ''">$(BaseNuGetRuntimeIdentifier)</RuntimeIdentifier>
78
79 <BaseNuGetRuntimeIdentifier Condition="'$(BaseNuGetRuntimeIdentifier)' == '' and '$(TargetPlatformIdentifier)' == 'UAP'">win10</BaseNuGetRuntimeIdentifier>
80 <BaseNuGetRuntimeIdentifier Condition="'$(BaseNuGetRuntimeIdentifier)' == ''">win</BaseNuGetRuntimeIdentifier>
81
82 <UseTargetPlatformAsNuGetTargetMoniker Condition="'$(UseTargetPlatformAsNuGetTargetMoniker)' == '' AND '$(TargetFrameworkMoniker)' == '.NETCore,Version=v5.0'">true</UseTargetPlatformAsNuGetTargetMoniker>
83 <NuGetTargetMoniker Condition="'$(NuGetTargetMoniker)' == '' AND '$(UseTargetPlatformAsNuGetTargetMoniker)' == 'true'">$(TargetPlatformIdentifier),Version=v$([System.Version]::Parse('$(TargetPlatformMinVersion)').ToString(3))</NuGetTargetMoniker>
84 <NuGetTargetMoniker Condition="'$(NuGetTargetMoniker)' == '' AND '$(UseTargetPlatformAsNuGetTargetMoniker)' != 'true'">$(TargetFrameworkMoniker)</NuGetTargetMoniker>
85
86 <CopyNuGetImplementations Condition="'$(CopyNuGetImplementations)' == '' and (('$(OutputType)' != 'library' and '$(OutputType)' != 'winmdobj') or ('$(AppxPackage)' == 'true') or '$(TargetFrameworkIdentifier)' == '.NETFramework')">true</CopyNuGetImplementations>
87 <IncludeFrameworkReferencesFromNuGet Condition="'$(IncludeFrameworkReferencesFromNuGet)' == ''">true</IncludeFrameworkReferencesFromNuGet>
88
89 <_NuGetRuntimeIdentifierPlatformTargetSuffix Condition="'$(PlatformTarget)' != '' and '$(PlatformTarget)' != 'AnyCPU'">-$(PlatformTarget.ToLower())</_NuGetRuntimeIdentifierPlatformTargetSuffix>
90 <_NuGetRuntimeIdentifierWithoutAot>$(BaseNuGetRuntimeIdentifier)$(_NuGetRuntimeIdentifierPlatformTargetSuffix)</_NuGetRuntimeIdentifierWithoutAot>
91 </PropertyGroup>
92
93 <!-- If a NuGetRuntimeIdentifier wasn't already specified, let's go generate it -->
94 <PropertyGroup Condition="'$(NuGetRuntimeIdentifier)' == '' and '$(CopyNuGetImplementations)' == 'true'">
95 <NuGetRuntimeIdentifier>$(_NuGetRuntimeIdentifierWithoutAot)</NuGetRuntimeIdentifier>
96 <NuGetRuntimeIdentifier Condition="'$(UseDotNetNativeToolchain)' == 'true'">$(_NuGetRuntimeIdentifierWithoutAot)-aot</NuGetRuntimeIdentifier>
97 </PropertyGroup>
98
99 <!-- If RuntimeIdentifiers weren't already specified for non-UAP projects, then generate it -->
100 <PropertyGroup Condition="'$(BaseNuGetRuntimeIdentifier)' == 'win' and '$(NuGetRuntimeIdentifier)' != '' and '$(RuntimeIdentifiers)' == '' and '$(RuntimeIdentifier)' == ''">
101 <RuntimeIdentifiers>win;win-x86;win-x64</RuntimeIdentifiers>
102 </PropertyGroup>
103
104 <ItemGroup>
105 <!-- If we are resolving from project.lock.json, we need to consider any edit to it as something that forces a rebuild -->
106 <CustomAdditionalCompileInputs Include="$(ProjectLockFile)" Condition="'$(ResolveNuGetPackages)' == 'true' and Exists('$(ProjectLockFile)')" />
107 </ItemGroup>
108
109 <PropertyGroup Condition="'$(TargetPlatformIdentifier)' == 'UAP'">
110 <_NuGetTargetFallbackMoniker>UAP,Version=v10.0</_NuGetTargetFallbackMoniker>
111 <ImplicitlyExpandTargetFramework>false</ImplicitlyExpandTargetFramework>
112 <EnableAppLocalFXWorkaround>false</EnableAppLocalFXWorkaround>
113 <UseNetNativeCustomFramework>true</UseNetNativeCustomFramework>
114 </PropertyGroup>
115
116 <!--
117 ============================================================
118 GetProjectsReferencingProjectJsonFiles
119 ============================================================
120 -->
121 <Target Name="GetProjectsReferencingProjectJson" DependsOnTargets="_SplitProjectReferencesByFileExistence" Returns="@(_ProjectReferencingProjectJsonFile)">
122 <ItemGroup Condition="'$(ResolveNuGetPackages)' == 'true'">
123 <_ProjectReferencingProjectJsonFile Include="$(MSBuildProjectFullPath)">
124 <ProjectReferences>@(ProjectReference)</ProjectReferences>
125 <ProjectJson>$(MSBuildProjectDirectory)\project.json</ProjectJson>
126 </_ProjectReferencingProjectJsonFile>
127 </ItemGroup>
128
129 <MSBuild
130 Projects="@(_MSBuildProjectReferenceExistent)"
131 Targets="GetProjectsReferencingProjectJson"
132 BuildInParallel="$(BuildInParallel)"
133 Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration); %(_MSBuildProjectReferenceExistent.SetPlatform)"
134 RemoveProperties="%(_MSBuildProjectReferenceExistent.GlobalPropertiesToRemove)">
135
136 <Output TaskParameter="TargetOutputs" ItemName="_ProjectReferencingProjectJsonFile" />
137 </MSBuild>
138 </Target>
139
140 <ItemGroup>
141 <NuGetPreprocessorValue Include="rootnamespace">
142 <Value>$(RootNamespace)</Value>
143 </NuGetPreprocessorValue>
144 <NuGetPreprocessorValue Include="assemblyname">
145 <Value>$(AssemblyName)</Value>
146 </NuGetPreprocessorValue>
147 <NuGetPreprocessorValue Include="fullpath">
148 <Value>$(MSBuildProjectDirectory)</Value>
149 </NuGetPreprocessorValue>
150 <NuGetPreprocessorValue Include="outputfilename">
151 <Value>$(TargetFileName)</Value>
152 </NuGetPreprocessorValue>
153 <NuGetPreprocessorValue Include="filename">
154 <Value>$(MSBuildProjectFile)</Value>
155 </NuGetPreprocessorValue>
156 </ItemGroup>
157
158 <!--
159 ============================================================
160 ResolveNuGetPackageAssets
161
162 Resolve assets from consumed NuGet packages listed in the project.lock.json.
163
164 Any changes made here must also be made to ResolveNuGetPackageAssetsNonAOT, below.
165
166 [OUT]
167 @(Analyzer) - Paths to build-time diagnostic analyzers
168 @(Reference) - Paths to build-time NuGet dependencies
169 @(ReferenceCopyLocalPaths) - Paths to run-time dependencies to copy
170 ============================================================
171 -->
172 <PropertyGroup>
173 <ResolveAssemblyReferencesDependsOn>$(ResolveAssemblyReferencesDependsOn);ResolveNuGetPackageAssets</ResolveAssemblyReferencesDependsOn>
174 <PrepareResourcesDependsOn>ResolveNuGetPackageAssets;$(PrepareResourcesDependsOn)</PrepareResourcesDependsOn>
175 </PropertyGroup>
176
177 <PropertyGroup>
178 <ResolveNuGetPackageAssetsDependsOn>ResolveProjectReferences</ResolveNuGetPackageAssetsDependsOn>
179 <ResolveNuGetPackageAssetsDependsOn Condition="'$(ImplicitlyExpandTargetFramework)' == 'true'">$(ResolveNuGetPackageAssetsDependsOn);ImplicitlyExpandTargetFramework</ResolveNuGetPackageAssetsDependsOn>
180 </PropertyGroup>
181
182 <Target Name="ResolveNuGetPackageAssets"
183 DependsOnTargets="$(ResolveNuGetPackageAssetsDependsOn)"
184 Condition="'$(ResolveNuGetPackages)' == 'true' and exists('$(ProjectLockFile)')">
185
186 <ResolveNuGetPackageAssets AllowFallbackOnTargetSelection="$(DesignTimeBuild)"
187 ContinueOnError="$(ContinueOnError)"
188 IncludeFrameworkReferences="$(IncludeFrameworkReferencesFromNuGet)"
189 NuGetPackagesDirectory="$(NuGetPackagesDirectory)"
190 RuntimeIdentifier="$(NuGetRuntimeIdentifier)"
191 ProjectLanguage="$(Language)"
192 ProjectLockFile="$(ProjectLockFile)"
193 ContentPreprocessorValues="@(NuGetPreprocessorValue)"
194 ContentPreprocessorOutputDirectory="$(IntermediateOutputPath)\NuGet"
195 TargetMonikers="$(NuGetTargetMoniker);$(_NuGetTargetFallbackMoniker)">
196
197 <Output TaskParameter="ResolvedAnalyzers" ItemName="Analyzer" />
198 <Output TaskParameter="ResolvedCopyLocalItems" ItemName="ReferenceCopyLocalPaths" />
199 <Output TaskParameter="ResolvedReferences" ItemName="_ReferencesFromNuGetPackages" />
200 <Output TaskParameter="ReferencedPackages" ItemName="ReferencedNuGetPackages" />
201 <Output TaskParameter="ContentItems" ItemName="_NuGetContentItems" />
202 <Output TaskParameter="FileWrites" ItemName="FileWrites" />
203 </ResolveNuGetPackageAssets>
204
205 <ItemGroup>
206 <!-- Remove exact references, such as if a package had a framework reference to 'System' that we already have -->
207 <Reference Remove="@(_ReferencesFromNuGetPackages)" />
208
209 <!-- Remove simple name references that are already implicitly added -->
210 <_ReferencesFromNuGetPackages Remove="%(ReferencePath.FileName)" Condition="'%(ReferencePath.ResolvedFrom)' == 'ImplicitlyExpandTargetFramework'" />
211
212 <!-- Include NuGet references in the proper groups. Project-to-project references must go in the
213 _ResolvedProjectReferencePaths group which matches the behavior of the ResolveProjectReferences
214 target. This ensures that even if the assembly is missing on disk, it still makes it to the compiler. -->
215 <Reference Include="@(_ReferencesFromNuGetPackages)" Condition="'%(_ReferencesFromNuGetPackages.NuGetSourceType)' != 'Project'" />
216 <_ResolvedProjectReferencePaths Include="@(_ReferencesFromNuGetPackages)" Condition="'%(_ReferencesFromNuGetPackages.NuGetSourceType)' == 'Project'" />
217
218 <!-- Remove simple name references if we're directly providing a reference assembly to the compiler. For example,
219 consider a project with an Reference Include="System", and some NuGet package is providing System.dll -->
220 <Reference Remove="%(_ReferencesFromNuGetPackages.FileName)" Condition="'%(_ReferencesFromNuGetPackages.NuGetIsFrameworkReference)' == 'false'"/>
221 </ItemGroup>
222
223 <PropertyGroup Condition=" '$(AutoUnifyAssemblyReferences)' == 'true' ">
224 <!-- Normally Design Time Assembly Resolution (DTAR) won't consider these references.
225 Put DTAR in a mode where it will prefer the output of RAR and unify. -->
226 <DTARUseReferencesFromProject>true</DTARUseReferencesFromProject>
227 </PropertyGroup>
228
229 <!-- The items in _NuGetContentItems need to go into the appropriately-named item group, but the names depend upon the items
230 themselves. Split it apart. -->
231 <CreateItem Include="@(_NuGetContentItems)" Condition="'@(_NuGetContentItems)' != ''">
232 <Output TaskParameter="Include" ItemName="%(_NuGetContentItems.NuGetItemType)" />
233 </CreateItem>
234 </Target>
235
236 <!--
237 ============================================================
238 ResolveNuGetPackageAssetsNonAOT
239
240 Resolve assets from consumed NuGet packages listed in the project.lock.json.
241
242 To support scenarios involving the XAML designer, always uses the non-AOT
243 version of the RuntimeIdentifier.
244
245 Any changes made here must also be made to ResolveNuGetPackageAssets, above.
246
247 [OUT]
248 @(Analyzer) - Paths to build-time diagnostic analyzers
249 @(Reference) - Paths to build-time NuGet dependencies
250 @(ReferenceCopyLocalPaths) - Paths to run-time dependencies to copy
251 ============================================================
252 -->
253
254 <PropertyGroup>
255 <_HandlePackageFileConflictsAfter>$(_HandlePackageFileConflictsAfter);ResolveNuGetPackageAssetsNonAOT</_HandlePackageFileConflictsAfter>
256 </PropertyGroup>
257
258 <Target Name="ResolveNuGetPackageAssetsNonAOT"
259 DependsOnTargets="$(ResolveNuGetPackageAssetsDependsOn)"
260 Condition="'$(ResolveNuGetPackages)' == 'true' and exists('$(ProjectLockFile)')">
261
262 <ResolveNuGetPackageAssets AllowFallbackOnTargetSelection="$(DesignTimeBuild)"
263 ContinueOnError="$(ContinueOnError)"
264 IncludeFrameworkReferences="$(IncludeFrameworkReferencesFromNuGet)"
265 NuGetPackagesDirectory="$(NuGetPackagesDirectory)"
266 RuntimeIdentifier="$(_NuGetRuntimeIdentifierWithoutAot)"
267 ProjectLanguage="$(Language)"
268 ProjectLockFile="$(ProjectLockFile)"
269 ContentPreprocessorValues="@(NuGetPreprocessorValue)"
270 ContentPreprocessorOutputDirectory="$(IntermediateOutputPath)\NuGet"
271 TargetMonikers="$(NuGetTargetMoniker);$(_NuGetTargetFallbackMoniker)">
272
273 <Output TaskParameter="ResolvedAnalyzers" ItemName="Analyzer" />
274 <Output TaskParameter="ResolvedCopyLocalItems" ItemName="ReferenceCopyLocalPaths" />
275 <Output TaskParameter="ResolvedReferences" ItemName="_ReferencesFromNuGetPackages" />
276 <Output TaskParameter="ReferencedPackages" ItemName="ReferencedNuGetPackages" />
277 <Output TaskParameter="ContentItems" ItemName="_NuGetContentItems" />
278 <Output TaskParameter="FileWrites" ItemName="FileWrites" />
279 </ResolveNuGetPackageAssets>
280
281 <ItemGroup>
282 <!-- Remove exact references, such as if a package had a framework reference to 'System' that we already have -->
283 <Reference Remove="@(_ReferencesFromNuGetPackages)" />
284
285 <!-- Remove simple name references that are already implicitly added -->
286 <_ReferencesFromNuGetPackages Remove="%(ReferencePath.FileName)" Condition="'%(ReferencePath.ResolvedFrom)' == 'ImplicitlyExpandTargetFramework'" />
287
288 <!-- Include NuGet references in the proper groups. Project-to-project references must go in the
289 _ResolvedProjectReferencePaths group which matches the behavior of the ResolveProjectReferences
290 target. This ensures that even if the assembly is missing on disk, it still makes it to the compiler. -->
291 <Reference Include="@(_ReferencesFromNuGetPackages)" Condition="'%(_ReferencesFromNuGetPackages.NuGetSourceType)' != 'Project'" />
292 <_ResolvedProjectReferencePaths Include="@(_ReferencesFromNuGetPackages)" Condition="'%(_ReferencesFromNuGetPackages.NuGetSourceType)' == 'Project'" />
293
294 <!-- Remove simple name references if we're directly providing a reference assembly to the compiler. For example,
295 consider a project with an Reference Include="System", and some NuGet package is providing System.dll -->
296 <Reference Remove="%(_ReferencesFromNuGetPackages.FileName)" Condition="'%(_ReferencesFromNuGetPackages.NuGetIsFrameworkReference)' == 'false'"/>
297 </ItemGroup>
298
299 <PropertyGroup Condition=" '$(AutoUnifyAssemblyReferences)' == 'true' ">
300 <!-- Normally Design Time Assembly Resolution (DTAR) won't consider these references.
301 Put DTAR in a mode where it will prefer the output of RAR and unify. -->
302 <DTARUseReferencesFromProject>true</DTARUseReferencesFromProject>
303 </PropertyGroup>
304
305 <!-- The items in _NuGetContentItems need to go into the appropriately-named item group, but the names depend upon the items
306 themselves. Split it apart. -->
307 <CreateItem Include="@(_NuGetContentItems)" Condition="'@(_NuGetContentItems)' != ''">
308 <Output TaskParameter="Include" ItemName="%(_NuGetContentItems.NuGetItemType)" />
309 </CreateItem>
310 </Target>
311
312 <Target Name="RuntimeImplementationProjectOutputGroup"
313 Returns="@(RuntimeImplementationProjectOutputGroupOutput)"
314 Condition="'$(ResolveNuGetPackages)' == 'true' and exists('$(ProjectLockFile)')"
315 DependsOnTargets="ResolveNuGetPackageAssetsNonAOT">
316
317 <ItemGroup>
318 <RuntimeImplementationProjectOutputGroupOutput Include="%(ReferenceCopyLocalPaths.Identity)">
319 <FinalOutputPath>%(ReferenceCopyLocalPaths.FullPath)</FinalOutputPath>
320 <TargetPath>%(ReferenceCopyLocalPaths.FullPath)</TargetPath>
321 </RuntimeImplementationProjectOutputGroupOutput>
322 </ItemGroup>
323 </Target>
324
325 <!--
326 ============================================================
327 Framework injection into mixed-target applications
328 ============================================================
329 -->
330 <PropertyGroup>
331 <NuGetTargetFrameworkMonikerToInject Condition="'$(NuGetTargetFrameworkMonikerToInject)' == ''">.NETCore,Version=v5.0</NuGetTargetFrameworkMonikerToInject>
332 <NuGetTargetMonikerToInject Condition="$(DotNetNativeVersion.StartsWith('2.')) and '$(NuGetTargetMonikerToInject)' == ''">UAP,Version=v10.0.15138</NuGetTargetMonikerToInject>
333 <NuGetTargetMonikerToInject Condition="'$(NuGetTargetMonikerToInject)' == ''">.NETCore,Version=v5.0</NuGetTargetMonikerToInject>
334 <_ComputeNetCoreFrameworkInjectionParametersBeforeTargets Condition="'$(AppxPackage)' == 'true' and '$(TargetPlatformIdentifier)' == 'UAP'">BeforeGenerateProjectPriFile</_ComputeNetCoreFrameworkInjectionParametersBeforeTargets>
335 </PropertyGroup>
336
337 <Target Name="ComputeNetCoreFrameworkInjectionParameters" BeforeTargets="$(_ComputeNetCoreFrameworkInjectionParametersBeforeTargets)" DependsOnTargets="_AddUnionWinmd" Condition="'$(_ComputeNetCoreFrameworkInjectionParametersBeforeTargets)' != ''">
338 <PropertyGroup>
339 <_PackagingOutputsIncludesFramework Condition="'%(PackagingOutputs.FileName)%(PackagingOutputs.Extension)' == 'System.Runtime.dll'">true</_PackagingOutputsIncludesFramework>
340 <_AppContainsManagedCodeForInjection Condition="'%(PackagingOutputs.Identity)' == '$(_TargetPlatformSdkDir)UnionMetadata\Windows.winmd'">true</_AppContainsManagedCodeForInjection>
341 <_AppContainsManagedCodeForInjection Condition="'%(PackagingOutputs.Identity)' == '$(WindowsSDK_UnionMetadataPath)\Windows.winmd'">true</_AppContainsManagedCodeForInjection>
342 <!-- In some scenarios (e.g. JavaScript UWP apps) the WindowsSDK_UnionMetadataPath may not be set. Check the target for completeness. -->
343 <_AppContainsManagedCodeForInjection Condition="'%(PackagingOutputs.TargetPath)' == '$(WinMetadataDir)\Windows.winmd'">true</_AppContainsManagedCodeForInjection>
344 </PropertyGroup>
345
346 <PropertyGroup>
347 <_NetCoreFrameworkInjectionNeeded Condition="'$(_PackagingOutputsIncludesFramework)' != 'true' and '$(_AppContainsManagedCodeForInjection)' == 'true'">true</_NetCoreFrameworkInjectionNeeded>
348 </PropertyGroup>
349 </Target>
350
351 <Target Name="InjectNetCoreFrameworkBlockIfLockFileExists"
352 AfterTargets="ComputeNetCoreFrameworkInjectionParameters"
353 Condition="'$(_NetCoreFrameworkInjectionNeeded)' == 'true' and '$(ResolveNuGetPackages)' == 'true' and exists('$(ProjectLockFile)')">
354 <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." />
355 </Target>
356
357 <Target Name="InjectNetCoreFramework"
358 AfterTargets="ComputeNetCoreFrameworkInjectionParameters"
359 Condition="'$(_NetCoreFrameworkInjectionNeeded)' == 'true' and ('$(ResolveNuGetPackages)' != 'true' or !Exists('$(ProjectLockFile)'))">
360 <GetReferenceAssemblyPaths TargetFrameworkMoniker="$(NuGetTargetFrameworkMonikerToInject)" Condition="'$(FrameworkInjectionLockFile)' == ''">
361 <Output TaskParameter="ReferenceAssemblyPaths" ItemName="_NuGetInjectionSourceDirectories" />
362 </GetReferenceAssemblyPaths>
363
364 <PropertyGroup>
365 <FrameworkInjectionLockFile Condition="'$(FrameworkInjectionLockFile)' == '' and $(DotNetNativeVersion.StartsWith('1.7'))">@(_NuGetInjectionSourceDirectories->'%(Identity)\RS2.project.lock.json')</FrameworkInjectionLockFile>
366 <FrameworkInjectionLockFile Condition="'$(FrameworkInjectionLockFile)' == '' and $(DotNetNativeVersion.StartsWith('2.'))">@(_NuGetInjectionSourceDirectories->'%(Identity)\RS3.project.lock.json')</FrameworkInjectionLockFile>
367 <FrameworkInjectionLockFile Condition="'$(FrameworkInjectionLockFile)' == ''">@(_NuGetInjectionSourceDirectories->'%(Identity)\project.lock.json')</FrameworkInjectionLockFile>
368
369 <!-- If the file doesn't exist try to fall back to 5.2.2 file -->
370 <NuGetTargetMonikerToInject Condition="!Exists('$(FrameworkInjectionLockFile)')">.NETCore,Version=v5.0</NuGetTargetMonikerToInject>
371 <FrameworkInjectionLockFile Condition="!Exists('$(FrameworkInjectionLockFile)')">@(_NuGetInjectionSourceDirectories->'%(Identity)\project.lock.json')</FrameworkInjectionLockFile>
372
373 <FrameworkInjectionPackagesDirectory Condition="'$(FrameworkInjectionPackagesDirectory)' == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\NuGet\Repository', 'UWPNugetPackages', null, RegistryView.Registry32, RegistryView.Default))</FrameworkInjectionPackagesDirectory>
374 </PropertyGroup>
375
376 <ResolveNuGetPackageAssets Condition="Exists('$(FrameworkInjectionLockFile)')"
377 NuGetPackagesDirectory="$(FrameworkInjectionPackagesDirectory)"
378 RuntimeIdentifier="$(NuGetRuntimeIdentifier)"
379 TargetMonikers="$(NuGetTargetMonikerToInject)"
380 ProjectLockFile="$(FrameworkInjectionLockFile)">
381
382 <Output TaskParameter="ResolvedCopyLocalItems" ItemName="_InjectNetCoreFrameworkPayload" />
383 </ResolveNuGetPackageAssets>
384
385 <PropertyGroup>
386 <_CoreRuntimePackageId Condition="'%(_InjectNetCoreFrameworkPayload.FileName)%(_InjectNetCoreFrameworkPayload.Extension)' == 'mscorlib.dll' OR '%(_InjectNetCoreFrameworkPayload.FileName)%(_InjectNetCoreFrameworkPayload.Extension)' == 'mscorlib.ni.dll'">%(_InjectNetCoreFrameworkPayload.NuGetPackageId)</_CoreRuntimePackageId>
387 </PropertyGroup>
388
389 <ItemGroup>
390 <PackagingOutputs Include="@(_InjectNetCoreFrameworkPayload)" Condition="'%(_InjectNetCoreFrameworkPayload.NuGetPackageId)' != '$(_CoreRuntimePackageId)' or '$(UseDotNetNativeToolchain)' == 'true'">
391 <TargetPath>%(Filename)%(Extension)</TargetPath>
392 <ProjectName>$(ProjectName)</ProjectName>
393 <OutputGroup>CopyLocalFilesOutputGroup</OutputGroup>
394 </PackagingOutputs>
395 </ItemGroup>
396 </Target>
397
398 <Import Project="$(MSBuildProjectDirectory)\$(MSBuildProjectName).nuget.targets" Condition="Exists('$(MSBuildProjectDirectory)\$(MSBuildProjectName).nuget.targets') AND '$(IncludeNuGetImports)' != 'false'" />
399 </Project>