2 ***********************************************************************************************
\r
3 Microsoft.NET.Publish.targets
\r
5 WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
\r
6 created a backup copy. Incorrect changes to this file will make it
\r
7 impossible to load or build your projects from the command-line or the IDE.
\r
9 Copyright (c) .NET Foundation. All rights reserved.
\r
10 ***********************************************************************************************
\r
12 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
\r
15 ============================================================
\r
18 The main publish entry point.
\r
19 ============================================================
\r
22 <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
\r
24 <DefaultCopyToPublishDirectoryMetadata Condition="'$(DefaultCopyToPublishDirectoryMetadata)' == ''">true</DefaultCopyToPublishDirectoryMetadata>
\r
25 <_GetChildProjectCopyToPublishDirectoryItems Condition="'$(_GetChildProjectCopyToPublishDirectoryItems)' == ''">true</_GetChildProjectCopyToPublishDirectoryItems>
\r
27 <!-- publishing self-contained apps should publish the native host as $(AssemblyName).exe -->
\r
28 <DeployAppHost Condition=" '$(DeployAppHost)' == '' and '$(OutputType)' == 'Exe' and '$(RuntimeIdentifier)' != ''">true</DeployAppHost>
\r
31 <ItemDefinitionGroup>
\r
32 <ResolvedFileToPublish>
\r
33 <CopyToPublishDirectory>Always</CopyToPublishDirectory>
\r
34 </ResolvedFileToPublish>
\r
35 </ItemDefinitionGroup>
\r
37 <Target Name="Publish"
\r
38 DependsOnTargets="Build;
\r
40 ComputeAndCopyFilesToPublishDirectory;
\r
41 GeneratePublishDependencyFile;
\r
42 GeneratePublishRuntimeConfigurationFile" />
\r
45 ============================================================
\r
48 Prepare the prerequisites for publishing.
\r
49 ============================================================
\r
51 <Target Name="PrepareForPublish">
\r
54 <!-- Ensure any PublishDir has a trailing slash, so it can be concatenated -->
\r
55 <PublishDir Condition="!HasTrailingSlash('$(PublishDir)')">$(PublishDir)\</PublishDir>
\r
58 <MakeDir Directories="$(PublishDir)" />
\r
63 ============================================================
\r
64 ComputeAndCopyFilesToPublishDirectory
\r
66 Computes the list of all files to copy to the publish directory and then publishes them.
\r
67 ============================================================
\r
69 <Target Name="ComputeAndCopyFilesToPublishDirectory"
\r
70 DependsOnTargets="ComputeFilesToPublish;
\r
71 CopyFilesToPublishDirectory" />
\r
74 ============================================================
\r
75 CopyFilesToPublishDirectory
\r
77 Copy all build outputs, satellites and other necessary files to the publish directory.
\r
78 ============================================================
\r
80 <Target Name="CopyFilesToPublishDirectory"
\r
81 DependsOnTargets="_CopyResolvedFilesToPublishPreserveNewest;
\r
82 _CopyResolvedFilesToPublishAlways" />
\r
85 ============================================================
\r
86 _CopyResolvedFilesToPublishPreserveNewest
\r
88 Copy _ResolvedFileToPublishPreserveNewest items to the publish directory.
\r
89 ============================================================
\r
91 <Target Name="_CopyResolvedFilesToPublishPreserveNewest"
\r
92 DependsOnTargets="_ComputeResolvedFilesToPublishTypes"
\r
93 Inputs="@(_ResolvedFileToPublishPreserveNewest)"
\r
94 Outputs="@(_ResolvedFileToPublishPreserveNewest->'$(PublishDir)%(RelativePath)')">
\r
97 Not using SkipUnchangedFiles="true" because the application may want to change
\r
98 one of these files and not have an incremental build replace it.
\r
100 <Copy SourceFiles = "@(_ResolvedFileToPublishPreserveNewest)"
\r
101 DestinationFiles="@(_ResolvedFileToPublishPreserveNewest->'$(PublishDir)%(RelativePath)')"
\r
102 OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
\r
103 Retries="$(CopyRetryCount)"
\r
104 RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
\r
105 UseHardlinksIfPossible="$(CreateHardLinksForPublishFilesIfPossible)"
\r
106 UseSymboliclinksIfPossible="$(CreateSymbolicLinksForPublishFilesIfPossible)">
\r
108 <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
\r
115 ============================================================
\r
116 _CopyResolvedFilesToPublishAlways
\r
118 Copy _ResolvedFileToPublishAlways items to the publish directory.
\r
119 ============================================================
\r
121 <Target Name="_CopyResolvedFilesToPublishAlways"
\r
122 DependsOnTargets="_ComputeResolvedFilesToPublishTypes">
\r
125 Not using SkipUnchangedFiles="true" because the application may want to change
\r
126 one of these files and not have an incremental build replace it.
\r
128 <Copy SourceFiles = "@(_ResolvedFileToPublishAlways)"
\r
129 DestinationFiles="@(_ResolvedFileToPublishAlways->'$(PublishDir)%(RelativePath)')"
\r
130 OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
\r
131 Retries="$(CopyRetryCount)"
\r
132 RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
\r
133 UseHardlinksIfPossible="$(CreateHardLinksForPublishFilesIfPossible)"
\r
134 UseSymboliclinksIfPossible="$(CreateSymbolicLinksForPublishFilesIfPossible)">
\r
136 <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
\r
143 ============================================================
\r
144 _ComputeResolvedFilesToPublishTypes
\r
146 Splits ResolvedFileToPublish items into 'PreserveNewest' and 'Always' buckets.
\r
147 ============================================================
\r
149 <Target Name="_ComputeResolvedFilesToPublishTypes">
\r
151 <_ResolvedFileToPublishPreserveNewest Include="@(ResolvedFileToPublish)"
\r
152 Condition="'%(ResolvedFileToPublish.CopyToPublishDirectory)'=='PreserveNewest'" />
\r
154 <_ResolvedFileToPublishAlways Include="@(ResolvedFileToPublish)"
\r
155 Condition="'%(ResolvedFileToPublish.CopyToPublishDirectory)'=='Always'" />
\r
161 ============================================================
\r
162 ComputeFilesToPublish
\r
164 Gathers all the files that need to be copied to the publish directory.
\r
165 ============================================================
\r
167 <Target Name="ComputeFilesToPublish"
\r
168 DependsOnTargets="_ComputeNetPublishAssets;
\r
169 _ComputeCopyToPublishDirectoryItems">
\r
172 <CopyBuildOutputToPublishDirectory Condition="'$(CopyBuildOutputToPublishDirectory)'==''">true</CopyBuildOutputToPublishDirectory>
\r
173 <CopyOutputSymbolsToPublishDirectory Condition="'$(CopyOutputSymbolsToPublishDirectory)'==''">true</CopyOutputSymbolsToPublishDirectory>
\r
177 <!-- Copy the build product (.dll or .exe). -->
\r
178 <ResolvedFileToPublish Include="@(IntermediateAssembly)"
\r
179 Condition="'$(CopyBuildOutputToPublishDirectory)' == 'true'">
\r
180 <RelativePath>@(IntermediateAssembly->'%(Filename)%(Extension)')</RelativePath>
\r
181 </ResolvedFileToPublish>
\r
183 <!-- Copy the app.config (if any) -->
\r
184 <ResolvedFileToPublish Include="@(AppConfigWithTargetPath)"
\r
185 Condition="'$(CopyBuildOutputToPublishDirectory)' == 'true'">
\r
186 <RelativePath>@(AppConfigWithTargetPath->'%(TargetPath)')</RelativePath>
\r
187 </ResolvedFileToPublish>
\r
189 <!-- Copy the debug information file (.pdb), if any -->
\r
190 <ResolvedFileToPublish Include="@(_DebugSymbolsIntermediatePath)"
\r
191 Condition="'$(_DebugSymbolsProduced)'=='true' and '$(CopyOutputSymbolsToPublishDirectory)'=='true'">
\r
192 <RelativePath>@(_DebugSymbolsIntermediatePath->'%(Filename)%(Extension)')</RelativePath>
\r
193 </ResolvedFileToPublish>
\r
195 <!-- Copy satellite assemblies. -->
\r
196 <ResolvedFileToPublish Include="@(IntermediateSatelliteAssembliesWithTargetPath)">
\r
197 <RelativePath>%(IntermediateSatelliteAssembliesWithTargetPath.Culture)\%(Filename)%(Extension)</RelativePath>
\r
198 </ResolvedFileToPublish>
\r
200 <!-- Copy all the assemblies -->
\r
201 <ResolvedFileToPublish Include="@(ResolvedAssembliesToPublish)">
\r
202 <RelativePath>%(ResolvedAssembliesToPublish.DestinationSubPath)</RelativePath>
\r
203 </ResolvedFileToPublish>
\r
208 <Target Name="_ComputeNetPublishAssets"
\r
209 DependsOnTargets="RunResolvePublishAssemblies">
\r
210 <!-- TODO get the content files -->
\r
211 <!-- TODO perform any preprocess transforms on the files -->
\r
214 <ResolvedAssembliesToPublish Include="@(ReferenceCopyLocalPaths)" Exclude="@(ResolvedAssembliesToPublish)">
\r
215 <DestinationSubPath>%(ReferenceCopyLocalPaths.DestinationSubDirectory)%(Filename)%(Extension)</DestinationSubPath>
\r
216 </ResolvedAssembliesToPublish>
\r
221 ============================================================
\r
222 RunResolvePublishAssemblies
\r
224 Gets the assemblies to be copied to the publish directory
\r
225 ============================================================
\r
227 <UsingTask TaskName="ResolvePublishAssemblies" AssemblyFile="$(MicrosoftNETBuildTasksAssembly)" />
\r
228 <Target Name="RunResolvePublishAssemblies"
\r
229 DependsOnTargets="ComputePrivateAssetsPackageReferences;
\r
230 _DefaultMicrosoftNETPlatformLibrary">
\r
232 <FilterProjectFileList Include="$(FilterProjectFiles.Split('%3B'))"/>
\r
234 <ResolvePublishAssemblies ProjectPath="$(MSBuildProjectFullPath)"
\r
235 AssetsFilePath="$(ProjectAssetsFile)"
\r
236 TargetFramework="$(TargetFrameworkMoniker)"
\r
237 RuntimeIdentifier="$(RuntimeIdentifier)"
\r
238 PlatformLibraryName="$(MicrosoftNETPlatformLibrary)"
\r
239 PrivateAssetsPackageReferences="@(PrivateAssetsPackageReference)"
\r
240 FilterProjectFiles="@(FilterProjectFileList)"
\r
241 PreserveCacheLayout="$(PreserveCacheLayout)">
\r
243 <Output TaskParameter="AssembliesToPublish" ItemName="ResolvedAssembliesToPublish" />
\r
244 <Output TaskParameter="PackagesResolved" ItemName="PackagesThatWereResolved" />
\r
245 </ResolvePublishAssemblies>
\r
248 <ResolvedPackagesPublished Include="@(PackagesThatWereResolved)"
\r
249 Condition="$(DoNotTrackPackageAsResolved) !='true'"/>
\r
255 ============================================================
\r
256 _ComputeCopyToPublishDirectoryItems
\r
257 ============================================================
\r
259 <Target Name="_ComputeCopyToPublishDirectoryItems"
\r
260 DependsOnTargets="GetCopyToPublishDirectoryItems">
\r
263 <ResolvedFileToPublish Include="@(_SourceItemsToCopyToPublishDirectoryAlways)">
\r
264 <RelativePath>%(_SourceItemsToCopyToPublishDirectoryAlways.TargetPath)</RelativePath>
\r
265 <CopyToPublishDirectory>Always</CopyToPublishDirectory>
\r
266 </ResolvedFileToPublish>
\r
268 <ResolvedFileToPublish Include="@(_SourceItemsToCopyToPublishDirectory)">
\r
269 <RelativePath>%(_SourceItemsToCopyToPublishDirectory.TargetPath)</RelativePath>
\r
270 <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
\r
271 </ResolvedFileToPublish>
\r
277 ============================================================
\r
278 GetCopyToPublishDirectoryItems
\r
280 Get all project items that may need to be transferred to the publish directory.
\r
281 This includes baggage items from transitively referenced projects. It would appear
\r
282 that this target computes full transitive closure of content items for all referenced
\r
283 projects; however that is not the case. It only collects the content items from its
\r
284 immediate children and not children of children.
\r
286 See comment on GetCopyToOutputDirectoryItems, from which this logic was taken.
\r
287 ============================================================
\r
289 <Target Name="GetCopyToPublishDirectoryItems"
\r
290 Returns="@(AllPublishItemsFullPathWithTargetPath)"
\r
291 KeepDuplicateOutputs=" '$(MSBuildDisableGetCopyToPublishDirectoryItemsOptimization)' == '' "
\r
292 DependsOnTargets="AssignTargetPaths;
\r
293 DefaultCopyToPublishDirectoryMetadata;
\r
294 _SplitProjectReferencesByFileExistence;
\r
295 _GetProjectReferenceTargetFrameworkProperties">
\r
298 <!-- In the general case, clients need very little of the metadata which is generated by invoking this target on this project and its children. For those
\r
299 cases, we can immediately discard the unwanted metadata, reducing memory usage, particularly in very large and interconnected systems of projects.
\r
300 However, if some client does require the original functionality, it is sufficient to set MSBuildDisableGetCopyToPublishDirectoryItemsOptimization to
\r
301 a non-empty value and the original behavior will be restored. -->
\r
302 <PropertyGroup Condition=" '$(MSBuildDisableGetCopyToPublishDirectoryItemsOptimization)' == '' ">
\r
303 <_GCTPDIKeepDuplicates>false</_GCTPDIKeepDuplicates>
\r
304 <_GCTPDIKeepMetadata>CopyToPublishDirectory;TargetPath</_GCTPDIKeepMetadata>
\r
307 <!-- Get items from child projects first. -->
\r
308 <MSBuild Projects="@(_MSBuildProjectReferenceExistent)"
\r
309 Targets="GetCopyToPublishDirectoryItems"
\r
310 BuildInParallel="$(BuildInParallel)"
\r
311 Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration); %(_MSBuildProjectReferenceExistent.SetPlatform); %(_MSBuildProjectReferenceExistent.SetTargetFramework)"
\r
312 Condition="'@(_MSBuildProjectReferenceExistent)' != '' and '$(_GetChildProjectCopyToPublishDirectoryItems)' == 'true' and '%(_MSBuildProjectReferenceExistent.Private)' != 'false'"
\r
313 ContinueOnError="$(ContinueOnError)"
\r
314 RemoveProperties="%(_MSBuildProjectReferenceExistent.GlobalPropertiesToRemove)">
\r
316 <Output TaskParameter="TargetOutputs" ItemName="_AllChildProjectPublishItemsWithTargetPath"/>
\r
320 <!-- Target outputs must be full paths because they will be consumed by a different project. -->
\r
322 <_SourceItemsToCopyToPublishDirectoryAlways KeepDuplicates=" '$(_GCTPDIKeepDuplicates)' != 'false' "
\r
323 KeepMetadata="$(_GCTPDIKeepMetadata)"
\r
324 Include="@(_AllChildProjectPublishItemsWithTargetPath->'%(FullPath)')"
\r
325 Condition="'%(_AllChildProjectPublishItemsWithTargetPath.CopyToPublishDirectory)'=='Always'"/>
\r
327 <_SourceItemsToCopyToPublishDirectory KeepDuplicates=" '$(_GCTPDIKeepDuplicates)' != 'false' "
\r
328 KeepMetadata="$(_GCTPDIKeepMetadata)"
\r
329 Include="@(_AllChildProjectPublishItemsWithTargetPath->'%(FullPath)')"
\r
330 Condition="'%(_AllChildProjectPublishItemsWithTargetPath.CopyToPublishDirectory)'=='PreserveNewest'"/>
\r
333 <!-- Remove items which we will never again use - they just sit around taking up memory otherwise -->
\r
335 <_AllChildProjectPublishItemsWithTargetPath Remove="@(_AllChildProjectPublishItemsWithTargetPath)"/>
\r
338 <!-- Get items from this project last so that they will be copied last. -->
\r
340 <_SourceItemsToCopyToPublishDirectoryAlways KeepMetadata="$(_GCTPDIKeepMetadata)"
\r
341 Include="@(ContentWithTargetPath->'%(FullPath)')"
\r
342 Condition="'%(ContentWithTargetPath.CopyToPublishDirectory)'=='Always'"/>
\r
343 <_SourceItemsToCopyToPublishDirectory KeepMetadata="$(_GCTPDIKeepMetadata)"
\r
344 Include="@(ContentWithTargetPath->'%(FullPath)')"
\r
345 Condition="'%(ContentWithTargetPath.CopyToPublishDirectory)'=='PreserveNewest'"/>
\r
349 <_SourceItemsToCopyToPublishDirectoryAlways KeepMetadata="$(_GCTPDIKeepMetadata)"
\r
350 Include="@(EmbeddedResource->'%(FullPath)')"
\r
351 Condition="'%(EmbeddedResource.CopyToPublishDirectory)'=='Always'"/>
\r
352 <_SourceItemsToCopyToPublishDirectory KeepMetadata="$(_GCTPDIKeepMetadata)"
\r
353 Include="@(EmbeddedResource->'%(FullPath)')"
\r
354 Condition="'%(EmbeddedResource.CopyToPublishDirectory)'=='PreserveNewest'"/>
\r
358 <_CompileItemsToPublish Include="@(Compile->'%(FullPath)')"
\r
359 Condition="'%(Compile.CopyToPublishDirectory)'=='Always' or '%(Compile.CopyToPublishDirectory)'=='PreserveNewest'"/>
\r
362 <AssignTargetPath Files="@(_CompileItemsToPublish)" RootFolder="$(MSBuildProjectDirectory)">
\r
363 <Output TaskParameter="AssignedFiles" ItemName="_CompileItemsToPublishWithTargetPath" />
\r
364 </AssignTargetPath>
\r
367 <_SourceItemsToCopyToPublishDirectoryAlways KeepMetadata="$(_GCTPDIKeepMetadata)"
\r
368 Include="@(_CompileItemsToPublishWithTargetPath)"
\r
369 Condition="'%(_CompileItemsToPublishWithTargetPath.CopyToPublishDirectory)'=='Always'"/>
\r
370 <_SourceItemsToCopyToPublishDirectory KeepMetadata="$(_GCTPDIKeepMetadata)"
\r
371 Include="@(_CompileItemsToPublishWithTargetPath)"
\r
372 Condition="'%(_CompileItemsToPublishWithTargetPath.CopyToPublishDirectory)'=='PreserveNewest'"/>
\r
376 <_SourceItemsToCopyToPublishDirectoryAlways KeepMetadata="$(_GCTPDIKeepMetadata)"
\r
377 Include="@(_NoneWithTargetPath->'%(FullPath)')"
\r
378 Condition="'%(_NoneWithTargetPath.CopyToPublishDirectory)'=='Always'"/>
\r
379 <_SourceItemsToCopyToPublishDirectory KeepMetadata="$(_GCTPDIKeepMetadata)"
\r
380 Include="@(_NoneWithTargetPath->'%(FullPath)')"
\r
381 Condition="'%(_NoneWithTargetPath.CopyToPublishDirectory)'=='PreserveNewest'"/>
\r
385 <AllPublishItemsFullPathWithTargetPath Include="@(_SourceItemsToCopyToPublishDirectoryAlways->'%(FullPath)');@(_SourceItemsToCopyToPublishDirectory->'%(FullPath)')"/>
\r
391 ============================================================
\r
392 DefaultCopyToPublishDirectoryMetadata
\r
394 If CopyToPublishDirectory isn't set on these items, the value should be taken from CopyToOutputDirectory.
\r
395 This way, projects can just set "CopyToOutputDirectory = Always/PreserveNewest" and by default the item will be copied
\r
396 to both the build output and publish directories.
\r
397 ============================================================
\r
399 <Target Name="DefaultCopyToPublishDirectoryMetadata"
\r
400 DependsOnTargets="AssignTargetPaths"
\r
401 Condition=" '$(DefaultCopyToPublishDirectoryMetadata)' == 'true' ">
\r
404 <ContentWithTargetPath Condition="'%(ContentWithTargetPath.CopyToOutputDirectory)'=='Always' and '%(ContentWithTargetPath.CopyToPublishDirectory)' == ''">
\r
405 <CopyToPublishDirectory>Always</CopyToPublishDirectory>
\r
406 </ContentWithTargetPath>
\r
407 <ContentWithTargetPath Condition="'%(ContentWithTargetPath.CopyToOutputDirectory)'=='PreserveNewest' and '%(ContentWithTargetPath.CopyToPublishDirectory)' == ''">
\r
408 <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
\r
409 </ContentWithTargetPath>
\r
411 <EmbeddedResource Condition="'%(EmbeddedResource.CopyToOutputDirectory)'=='Always' and '%(EmbeddedResource.CopyToPublishDirectory)' == ''">
\r
412 <CopyToPublishDirectory>Always</CopyToPublishDirectory>
\r
413 </EmbeddedResource>
\r
414 <EmbeddedResource Condition="'%(EmbeddedResource.CopyToOutputDirectory)'=='PreserveNewest' and '%(EmbeddedResource.CopyToPublishDirectory)' == ''">
\r
415 <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
\r
416 </EmbeddedResource>
\r
418 <Compile Condition="'%(Compile.CopyToOutputDirectory)'=='Always' and '%(Compile.CopyToPublishDirectory)' == ''">
\r
419 <CopyToPublishDirectory>Always</CopyToPublishDirectory>
\r
421 <Compile Condition="'%(Compile.CopyToOutputDirectory)'=='PreserveNewest' and '%(Compile.CopyToPublishDirectory)' == ''">
\r
422 <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
\r
425 <_NoneWithTargetPath Condition="'%(_NoneWithTargetPath.CopyToOutputDirectory)'=='Always' and '%(_NoneWithTargetPath.CopyToPublishDirectory)' == ''">
\r
426 <CopyToPublishDirectory>Always</CopyToPublishDirectory>
\r
427 </_NoneWithTargetPath>
\r
428 <_NoneWithTargetPath Condition="'%(_NoneWithTargetPath.CopyToOutputDirectory)'=='PreserveNewest' and '%(_NoneWithTargetPath.CopyToPublishDirectory)' == ''">
\r
429 <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
\r
430 </_NoneWithTargetPath>
\r
437 ============================================================
\r
438 GeneratePublishDependencyFile
\r
440 Generates the $(project).deps.json file for a published app
\r
441 ============================================================
\r
443 <Target Name="GeneratePublishDependencyFile"
\r
444 DependsOnTargets="ComputePrivateAssetsPackageReferences;
\r
445 _DefaultMicrosoftNETPlatformLibrary"
\r
446 Condition="'$(GenerateDependencyFile)' == 'true'">
\r
449 <PublishDepsFilePath Condition=" '$(PublishDepsFilePath)' == '' ">$(PublishDir)$(ProjectDepsFileName)</PublishDepsFilePath>
\r
452 <GenerateDepsFile ProjectPath="$(MSBuildProjectFullPath)"
\r
453 AssetsFilePath="$(ProjectAssetsFile)"
\r
454 DepsFilePath="$(PublishDepsFilePath)"
\r
455 TargetFramework="$(TargetFrameworkMoniker)"
\r
456 AssemblyName="$(AssemblyName)"
\r
457 AssemblyExtension="$(TargetExt)"
\r
458 AssemblyVersion="$(Version)"
\r
459 AssemblySatelliteAssemblies="@(IntermediateSatelliteAssembliesWithTargetPath)"
\r
460 ReferencePaths="@(ReferencePath)"
\r
461 ReferenceSatellitePaths="@(ReferenceSatellitePaths)"
\r
462 RuntimeIdentifier="$(RuntimeIdentifier)"
\r
463 PlatformLibraryName="$(MicrosoftNETPlatformLibrary)"
\r
464 CompilerOptions="@(DependencyFileCompilerOptions)"
\r
465 PrivateAssetsPackageReferences="@(PrivateAssetsPackageReference)" />
\r
470 ============================================================
\r
471 ComputePrivateAssetsPackageReferences
\r
473 Builds up the @(PrivateAssetsPackageReference) item by looking for @(PackageReference) items with
\r
474 <PrivateAssets> metadata.
\r
475 ============================================================
\r
478 <ComputePrivateAssetsPackageReferences Condition="'$(ComputePrivateAssetsPackageReferences)' == ''">true</ComputePrivateAssetsPackageReferences>
\r
481 <Target Name="ComputePrivateAssetsPackageReferences"
\r
482 Condition="'$(ComputePrivateAssetsPackageReferences)' == 'true'">
\r
485 <PrivateAssetsPackageReference Include="@(PackageReference)"
\r
486 Condition="'%(PackageReference.PrivateAssets)' == 'All'" />
\r
493 ============================================================
\r
494 GeneratePublishRuntimeConfigurationFile
\r
496 Generates the $(project).runtimeconfig.json file for a published app
\r
497 ============================================================
\r
500 <Target Name="GeneratePublishRuntimeConfigurationFile"
\r
501 DependsOnTargets="_DefaultMicrosoftNETPlatformLibrary"
\r
502 Condition="'$(GenerateRuntimeConfigurationFiles)' == 'true'">
\r
505 <PublishRuntimeConfigFilePath Condition=" '$(PublishRuntimeConfigFilePath)' == '' ">$(PublishDir)$(ProjectRuntimeConfigFileName)</PublishRuntimeConfigFilePath>
\r
508 <GenerateRuntimeConfigurationFiles AssetsFilePath="$(ProjectAssetsFile)"
\r
509 TargetFrameworkMoniker="$(TargetFrameworkMoniker)"
\r
510 TargetFramework="$(TargetFramework)"
\r
511 RuntimeConfigPath="$(PublishRuntimeConfigFilePath)"
\r
512 RuntimeIdentifier="$(RuntimeIdentifier)"
\r
513 PlatformLibraryName="$(MicrosoftNETPlatformLibrary)"
\r
514 UserRuntimeConfig="$(UserRuntimeConfig)"
\r
515 HostConfigurationOptions="@(RuntimeHostConfigurationOption)" />
\r
520 ============================================================
\r
523 Deploys the host to run the stand alone app and ensures it matches the app name
\r
524 ============================================================
\r
527 <Target Name="DeployAppHost"
\r
528 DependsOnTargets="_ComputeNETCoreBuildOutputFiles"
\r
529 AfterTargets="ComputeFilesToPublish"
\r
530 BeforeTargets="CopyFilesToPublishDirectory"
\r
531 Condition="'$(DeployAppHost)' == 'true'">
\r
535 <ResolvedFileToRemove Include ="%(ResolvedFileToPublish.Identity)" Condition="'%(ResolvedFileToPublish.RelativePath)' == '$(_DotNetHostExecutableName)' Or '%(ResolvedFileToPublish.RelativePath)' == '$(_DotNetAppHostExecutableName)'"/>
\r
536 <ResolvedFileToPublish Remove ="%(ResolvedFileToRemove.Identity)"/>
\r
538 <ResolvedFileToPublish Include="%(NativeAppHostNETCore.Identity)">
\r
539 <RelativePath>$(AssemblyName)%(Extension)</RelativePath>
\r
540 </ResolvedFileToPublish>
\r