-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.targets
50 lines (38 loc) · 2.72 KB
/
build.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
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
<!-- Windows specific commands -->
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
</PropertyGroup>
<PropertyGroup>
<BuildDependsOn>
$(BuildDependsOn);
BuildPackageCustom;
PublishPackage;
</BuildDependsOn>
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>
<NugetRepository Condition="$(NugetRepository) == ''">C:\nuget_repository</NugetRepository>
<BuildPackageCustom Condition="$(BuildPackageCustom) == ''">false</BuildPackageCustom>
<PublishPackage Condition="'$(PublishPackage)' == ''">false</PublishPackage>
<_NugetApiKey Condition="'$(NugetApiKey)' != ''"> -ApiKey "$(NugetApiKey)"</_NugetApiKey>
<PackageOutputDir>$([System.IO.Path]::GetDirectoryName('$(ProjectDir)$(IntermediateOutputPath)'))</PackageOutputDir>
<PackageSpec>$(ProjectPath.Replace('.csproj', '.nuspec'))</PackageSpec>
<PackageOutput>$(ProjectName.Replace('.csproj', '')).*.nupkg</PackageOutput>
<PackageSymbolsOutput>$(ProjectName.Replace('.csproj', '')).*.symbols.nupkg</PackageSymbolsOutput>
<BuildCommandSolution>$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform);VisualStudioVersion=$(VisualStudioVersion)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -MSBuildVersion 12 -Symbols -IncludeReferencedProjects</BuildCommandSolution>
<PublishCommand>$(NuGetCommand) push "$(PackageOutputDir)\$(PackageOutput)" $(_NugetApiKey) -source "$(NugetRepository)"</PublishCommand>
<PublishSymbolsCommand>$(NuGetCommand) push "$(PackageOutputDir)\$(PackageSymbolsOutput)" $(_NugetApiKey) -source "$(NugetRepository)"</PublishSymbolsCommand>
</PropertyGroup>
<Target Name="PublishPackage" Condition="'$(PublishPackage)' == 'true'">
<Exec Command="$(PublishCommand)" LogStandardErrorAsError="true" />
<Exec Command="$(PublishSymbolsCommand)" LogStandardErrorAsError="true" />
</Target>
<Target Name="BuildPackageCustom" Condition="$(BuildPackageCustom) == 'true'">
<Exec Command="$(BuildCommandSolution)" LogStandardErrorAsError="true" />
</Target>
</Project>