forked from dotnet/buildtools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publishexe.targets
46 lines (36 loc) · 2.12 KB
/
publishexe.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework'">
<!-- hardcoding win7-x64 for now, this should eventually be built as runtime agnostic,
packaged as a DLL and be consumed by a deployment step that resolves that package
and its dependencies for a specific runtime -->
<PlatformTarget>x64</PlatformTarget>
<BaseNuGetRuntimeIdentifier>win7</BaseNuGetRuntimeIdentifier>
</PropertyGroup>
<Target Name="PublishFilesToRuntime" AfterTargets="CopyFilesToOutputDirectory"
Condition="'$(OutputType)' == 'Exe' ">
<ItemGroup>
<PublishedRuntimeItems Include="@(ReferenceCopyLocalPaths)">
<DestinationRelativePath>%(FileName)%(Extension)</DestinationRelativePath>
</PublishedRuntimeItems>
<PublishedRuntimeItems Include="@(Content)">
<DestinationRelativePath>%(FileName)%(Extension)</DestinationRelativePath>
</PublishedRuntimeItems>
<PublishedRuntimeItems Include="@(None)">
<DestinationRelativePath>%(Filename)%(Extension)</DestinationRelativePath>
</PublishedRuntimeItems>
</ItemGroup>
<Copy SourceFiles="%(PublishedRuntimeItems.Identity)" DestinationFiles="$(Outdir)%(DestinationRelativePath)" SkipUnchangedFiles="true" />
<CallTarget Targets="FixUpCoreConsoleNames" Condition="Exists('$(Outdir)CoreConsole.exe')" />
<Message Text="Published $(AssemblyName) executable to $(Outdir) [@(PublishedRuntimeItems->Count()) items]" Importance="high" />
</Target>
<!-- If CoreConsole.exe is being used, rename it and the actual project's exe to their correct names -->
<Target Name="FixUpCoreConsoleNames">
<Move SourceFiles="$(Outdir)$(AssemblyName).exe" DestinationFiles="$(Outdir)$(AssemblyName).dll" />
<Move SourceFiles="$(Outdir)CoreConsole.exe" DestinationFiles="$(Outdir)$(AssemblyName).exe" />
<!-- update TargetPath with the renamed file -->
<PropertyGroup>
<TargetPath>$(Outdir)$(AssemblyName).dll</TargetPath>
</PropertyGroup>
</Target>
</Project>