-
Notifications
You must be signed in to change notification settings - Fork 458
/
Markpad.msbuild
96 lines (75 loc) · 5.07 KB
/
Markpad.msbuild
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
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition="$(Configuration)==''">Debug</Configuration>
<Root>$(MSBuildProjectDirectory)\</Root>
<Version Condition="$(BUILD_NUMBER)!=''">$(BUILD_NUMBER)</Version>
<Version Condition="$(Version)==''">0.0.0.0</Version>
<ClickOnceFolder>$(Root)artifacts\ClickOnce\</ClickOnceFolder>
<ProviderUrl Condition="$(ProviderUrl)=='' AND $(BlobTargetUrl) !=''">$(BlobTargetUrl)MarkPad.application</ProviderUrl>
</PropertyGroup>
<Target Name="Clean">
<ItemGroup>
<ProjectFiles Include="$(Root)**\*.*proj" />
<OldDirectories Include="@(ProjectFiles->'%(RootDir)%(Directory)bin')" />
<OldDirectories Include="@(ProjectFiles->'%(RootDir)%(Directory)obj')" />
</ItemGroup>
<Delete Files="@(OldArtifacts)" ContinueOnError="true" />
<RemoveDir Directories="..\artifacts" ContinueOnError="true" />
<RemoveDir Directories="@(OldDirectories)" ContinueOnError="true" />
</Target>
<Target Name="Build" DependsOnTargets="Clean">
<MSBuild Projects="$(Root)src\MarkPad.sln" Targets="Rebuild" Properties="Configuration=$(Configuration);Platform=x86" />
</Target>
<Target Name="Test" DependsOnTargets="Build">
<Exec Command="$(Root)tools\xunit\xunit.console.clr4.x86.exe $(Root)src\MarkPad.Tests\bin\$(Configuration)\MarkPad.Tests.dll" />
</Target>
<Target Name="Publish" DependsOnTargets="Test">
<PropertyGroup>
<ClickOnceFiles>$(ClickOnceFolder)$(Version)\</ClickOnceFiles>
<Mage>$(Root)tools\mage.exe</Mage>
<ProviderUrlArg Condition="$(ProviderUrl)!=''">-ProviderURL $(ProviderUrl)</ProviderUrlArg>
<ClickOnceName Condition="$(ClickOnceName)==''">MarkPad</ClickOnceName>
</PropertyGroup>
<ItemGroup>
<XmlFiles Include="$(Root)src\MarkPad\bin\$(Configuration)\*.xml" />
<ClickOnceFilesToDelete Include="$(ClickOnceFolder)\**\*.*" />
</ItemGroup>
<Delete Files="@(ClickOnceFilesToDelete)" />
<RemoveDir Directories="@(ClickOnceFolder)" />
<ItemGroup>
<SourceFiles Include="$(Root)src\MarkPad\bin\$(Configuration)\**\*.*" />
</ItemGroup>
<Copy SourceFiles="@(SourceFiles)" DestinationFolder="$(ClickOnceFiles)%(SourceFiles.RecursiveDir)"/>
<Exec Command="$(Mage) -New Application -ToFile $(ClickOnceFiles)MarkPad.exe.manifest -Processor x86 -name "$(ClickOnceName)" -Version $(VERSION) -FromDirectory $(ClickOnceFiles) -IconFile markpad.ico" />
<Exec Command="powershell.exe -ExecutionPolicy RemoteSigned -NoProfile $(Root)tools\UpdateManifest.ps1 -ManifestFile $(ClickOnceFiles)MarkPad.exe.manifest" />
<Exec Command="$(Mage) -New Deployment -ToFile $(ClickOnceFolder)MarkPad.application -name "$(ClickOnceName)" -Processor x86 -Install true -Version $(Version) -Publisher "Code52" -AppManifest $(ClickOnceFiles)MarkPad.exe.manifest $(ProviderUrlArg)" />
<Exec Command="powershell.exe -ExecutionPolicy RemoteSigned -NoProfile $(Root)tools\UpdateApplicationManifest.ps1 -ManifestFile $(ClickOnceFolder)MarkPad.application" />
<ItemGroup>
<DeploymentFiles Include="$(ClickOnceFiles)**\*.*" Exclude="$(ClickOnceFiles)MarkPad.exe.manifest" />
</ItemGroup>
<Move SourceFiles="@(DeploymentFiles)" DestinationFiles="@(DeploymentFiles->'%(RootDir)%(Directory)%(FileName)%(Extension).deploy')" />
</Target>
<Target Name="PublishInstallToAzure" DependsOnTargets="Publish">
<!--To build and publish to azure: msbuild MarkPad.msbuild /p:BlobTargetUrl=https://myaccount.blob.core.windows.net/mycontainer/ /p:BlobTargetKey=key /target:PublishInstallToAzure-->
<!--$(BlobTargetUrl) = https://myaccount.blob.core.windows.net/mycontainer/ -->
<!--Upload everything except the application manifest as it should be done last (once everything else is uploaded)-->
<Move SourceFiles="$(ClickOnceFolder)MarkPad.application" DestinationFolder="$(ClickOnceFolder)ClickOnceApplicationFile\" />
<Exec Command="$(Root)tools\AzCopy.exe $(ClickOnceFolder) $(BlobTargetUrl) /destkey:$(BlobTargetKey) /S /V /Y" />
<Exec Command="$(Root)tools\AzCopy.exe $(ClickOnceFolder)ClickOnceApplicationFile\ $(BlobTargetUrl) /destkey:$(BlobTargetKey) /S /V /Y" />
</Target>
<Target Name="Chocolatey" DependsOnTargets="Build">
<PropertyGroup>
<AssemblyConfig Condition=" '$(AssemblyConfig)' != '' ">-$(AssemblyConfig)</AssemblyConfig>
<BuildNumber Condition=" '$(BuildNumber)' == '0' "></BuildNumber>
<BuildNumber Condition=" '$(AssemblyConfig)' == '' And $(BuildNumber) != '' ">.$(BuildNumber)</BuildNumber>
<NuGet>..\src\.nuget\NuGet.exe</NuGet>
<OutputDirectory>-OutputDirectory "..\artifacts"</OutputDirectory>
<VersionArg>-Version $(CurrentVersion)$(AssemblyConfig)$(BuildNumber)</VersionArg>
<ConfigArg>-Prop Configuration=$(Configuration)</ConfigArg>
</PropertyGroup>
<ItemGroup>
<NuSpec Include="$(Root)artifacts\*.nuspec" />
</ItemGroup>
<Exec Command='$(NuGet) pack "%(NuSpec.Identity)" $(OutputDirectory) $(VersionArg) $(ConfigArg)' />
</Target>
</Project>