-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathoutput.xml
More file actions
116 lines (93 loc) · 4.5 KB
/
output.xml
File metadata and controls
116 lines (93 loc) · 4.5 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="All">
<PropertyGroup>
<OutputPath>Output</OutputPath>
<PublishRoot>Published</PublishRoot>
<Version>1.1.0.1683</Version>
</PropertyGroup>
<ItemGroup>
<WixNamespace Include="wix">
<Prefix>wix</Prefix>
<Uri>http://wixtoolset.org/schemas/v4/wxs</Uri>
</WixNamespace>
</ItemGroup>
<ItemGroup>
<TargetPlatform Include="win-x86" />
<TargetPlatform Include="win-x64" />
<TargetPlatform Include="osx-x64" />
<TargetPlatform Include="linux-x64" />
<TargetPlatform Include="linux-arm" />
</ItemGroup>
<UsingTask TaskName="RegexReplace" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<File ParameterType="System.String" Required="true" />
<Pattern ParameterType="System.String" Required="true" />
<Value ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Code Type="Fragment" Language="cs">
<![CDATA[
string content = System.IO.File.ReadAllText(File);
string newContent = System.Text.RegularExpressions.Regex.Replace(content, Pattern, Value);
System.IO.File.WriteAllText(File, newContent);
]]>
</Code>
</Task>
</UsingTask>
<Target Name="PrepareForRelease">
<Message Importance="high" Text="=== STEP 1: Preparing Release $(Version) ===" />
<XmlPoke
XmlInputPath="ErpNet.FP.Setup\Product.wxs"
Query="/wix:Wix/wix:Package/@Version"
Namespaces="<Namespace Prefix='wix' Uri='http://wixtoolset.org/schemas/v4/wxs' />"
Value="$(Version)" />
<XmlPoke
Condition="Exists('Directory.Build.props')"
XmlInputPath="Directory.Build.props"
Query="/Project/PropertyGroup/Version"
Value="$(Version)" />
<GetFileHash Files="ErpNet.FP.Server\wwwroot\app.js">
<Output TaskParameter="Items" ItemName="AppJsInfo" />
</GetFileHash>
<GetFileHash Files="ErpNet.FP.Server\wwwroot\index.css">
<Output TaskParameter="Items" ItemName="IndexCssInfo" />
</GetFileHash>
<PropertyGroup>
<AppJsHash>%(AppJsInfo.FileHash)</AppJsHash>
<IndexCssHash>%(IndexCssInfo.FileHash)</IndexCssHash>
</PropertyGroup>
<Message Importance="high" Text="Hashes: app.js=$(AppJsHash) | index.css=$(IndexCssHash)" />
<RegexReplace
File="ErpNet.FP.Server\wwwroot\index.html"
Pattern="app\.js\?ver=([^"]+)"
Value="app.js?ver=$(AppJsHash)" />
<RegexReplace
File="ErpNet.FP.Server\wwwroot\index.html"
Pattern="index\.css\?ver=([^"]+)"
Value="index.css?ver=$(IndexCssHash)" />
</Target>
<Target Name="PublishToOutputPath" DependsOnTargets="PrepareForRelease">
<Message Importance="high" Text="=== STEP 2: Publishing & Zipping ===" />
<RemoveDir Directories="$(OutputPath);$(PublishRoot)" />
<MakeDir Directories="$(OutputPath);$(PublishRoot)" />
<MSBuild Projects="$(MSBuildProjectFile)" Targets="PublishSinglePlatform" Properties="PlatformName=%(TargetPlatform.Identity)" />
</Target>
<Target Name="PublishSinglePlatform">
<Message Text="Processing $(PlatformName)..." Importance="high" />
<Exec Command="dotnet publish ErpNet.FP.Server\ErpNet.FP.Server.csproj -c Release -r $(PlatformName) --self-contained true -p:PublishTrimmed=false -o $(PublishRoot)\$(PlatformName)" />
<ZipDirectory
SourceDirectory="$(PublishRoot)\$(PlatformName)"
DestinationFile="$(OutputPath)\$(PlatformName).zip"
Overwrite="true" />
</Target>
<Target Name="BuildWindowsSetup" DependsOnTargets="PublishToOutputPath">
<Message Importance="high" Text="=== STEP 3: Building Windows MSI ===" />
<MSBuild
Projects="ErpNet.FP.Setup\ErpNet.FP.Setup.wixproj"
Properties="Configuration=Release;Platform=x86" />
<Message Importance="high" Text="MSI file is ready in $(OutputPath)" />
</Target>
<Target Name="All" DependsOnTargets="PrepareForRelease;PublishToOutputPath;BuildWindowsSetup">
<Message Importance="high" Text="=== BUILD COMPLETE! Check $(OutputPath) folder. ===" />
</Target>
</Project>