-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRedist.CopyFile.targets
79 lines (67 loc) · 3.81 KB
/
Redist.CopyFile.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!--
Compute CopyFile.TargetDir.
%(TargetDir) = $(OutDir)[%(TargetFramework)\][%(RuntimeFolder)\][<project-folder>\]
where <project-folder> :: %(TargetDir).Replace($(OutDir), "")
Example:
$(RedistByFramework) = $(RedistByRuntime) = true
$(OutDir) = bin\Release\
%(TargetDir) = bin\Release\documents\
%(TargetFramework) = net6
%(RuntimePlatform) = win-x64
%(RedistFolder) = coursdechange
<project-folder> = documents
%(TargetDir) -> bin\Release\net6\win-x64\coursdechange\documents
Inputs:
$(RedistFolder) - [optional] - default redist folder
$(RedistByFramework) - [optional] - include the target framework in the output directory - ex: ...\net6\...
$(RedistByRuntime) - [optional] - include the runtime identifier in the output directory - ex: ...\win-x64\...
%(RedistFolder) - [optional] - append a specific redist folder to the output directory - ex: ...\coursdechange\...
%(RedistX86Framework) - [optional] - the target framework used for x86 or AnyCPU platforms - (CoreTargetFramework | FullTargetFramework)
%(RedistX64Framework) - [optional] - the target framework used for x64 platform - (CoreTargetFramework | FullTargetFramework)
Outputs:
%(RedistFolder) - ex: coursdechange
%(TargetDir) - ex: bin\Release\win-x64\coursdechange\documents
-->
<Project>
<Target Name="RedistCopyFileInit" DependsOnTargets="CopyFileCrossBuild" >
<Message Condition="'$(ZouDebug)' == 'true'" Importance="high" Text="### [$(MSBuildProjectFile)] RedistCopyFileInit" />
<ItemGroup>
<CopyFile>
<RedistFolder Condition="'%(CopyFile.RedistFolder)' == ''">$(RedistFolder)</RedistFolder>
</CopyFile>
</ItemGroup>
</Target>
<Target Name="RedistCopyFileTransformLayout" DependsOnTargets="RedistCopyFileInit" BeforeTargets="CopyFile;CopyFileClean">
<Message Condition="'$(ZouDebug)' == 'true'" Importance="high" Text="### [$(MSBuildProjectFile)] RedistCopyFileTransformLayout" />
<ItemGroup>
<!-- Process output directories -->
<CopyFile>
<_ProjectFolder Condition="$([System.String]::new('%(CopyFile.TargetDir)').StartsWith('$(OutDir)'))">$([System.String]::new('%(CopyFile.TargetDir)').Replace('$(OutDir)', ''))</_ProjectFolder>
</CopyFile>
<CopyFile>
<_OutputFolder Condition="! $(RedistByRuntime)">%(CopyFile.RedistFolder)</_OutputFolder>
<_OutputFolder Condition=" $(RedistByRuntime)">$([System.IO.Path]::Combine('%(CopyFile.RuntimeFolder)', '%(CopyFile.RedistFolder)'))</_OutputFolder>
</CopyFile>
<CopyFile>
<_OutputFolder Condition="$(RedistByFramework)">$([System.IO.Path]::Combine('%(CopyFile.TargetFramework)', '%(CopyFile._OutputFolder)'))</_OutputFolder>
</CopyFile>
<CopyFile>
<_OutputFolder>$([MSBuild]::EnsureTrailingSlash($([System.IO.Path]::Combine('%(CopyFile._OutputFolder)', '%(CopyFile._ProjectFolder)'))))</_OutputFolder>
</CopyFile>
<CopyFile>
<_OutDir Condition="! $(RedistByRuntime)">$(OutDir)</_OutDir>
<_OutDir Condition=" $(RedistByRuntime)">$([System.String]::new('$(OutDir)').Replace('$(Platform)\', ''))</_OutDir>
</CopyFile>
<CopyFile>
<TargetDir Condition="'%(CopyFile.TargetDir)' != ''">$([System.IO.Path]::GetFullPath('%(_OutDir)%(_OutputFolder)'))</TargetDir>
</CopyFile>
<CopyFile>
<BundleRelativeDstDir>$([MSBuild]::MakeRelative('$(BundleDir)', '%(TargetDir)'))</BundleRelativeDstDir>
</CopyFile>
<!-- Remove temporary metadata -->
<CopyFile RemoveMetadata="_ProjectFolder;_OutputFolder;_OutDir" />
</ItemGroup>
<!--<LogItems Condition="$(RedistDebug)" Items="@(CopyFile)" Title="RedistCopyFileTransformLayout.CopyFile" />
<Message Condition="$(RedistDebug)" Importance="high" Text=" " />-->
</Target>
</Project>