|
| 1 | +<?xml version="1.0" encoding="utf-8" ?> |
| 2 | +<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> |
| 3 | + |
| 4 | + |
| 5 | +<Project InitialTargets="DotnetToolRestore" |
| 6 | + xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> |
| 7 | + <PropertyGroup> |
| 8 | + <WixRoot Condition=" '$(WixRoot)'=='' ">$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\))</WixRoot> |
| 9 | + <DotnetToolsFolder>$(WixRoot)packages\tools\</DotnetToolsFolder> |
| 10 | + <DotnetExe>$(ProgramW6432)\dotnet\dotnet.exe</DotnetExe> |
| 11 | + <DotnetExe Condition="!Exists('$(DotnetExe)')">$(MSBuildProgramFiles32)\dotnet\dotnet.exe</DotnetExe> |
| 12 | + </PropertyGroup> |
| 13 | + |
| 14 | + <PropertyGroup> |
| 15 | + <SignClientPath>$(DotnetToolsFolder)SignClient.exe</SignClientPath> |
| 16 | + </PropertyGroup> |
| 17 | + |
| 18 | + <!-- |
| 19 | + ================================================================================================ |
| 20 | + DotnetToolRestore |
| 21 | +
|
| 22 | + Restores the required packages to build using nuget.exe. |
| 23 | + ================================================================================================ |
| 24 | + --> |
| 25 | + <ItemGroup> |
| 26 | + <RestoreDotnetToolsPackage Include="SignClient" Condition="'$(PleaseSignOutput)'!=''"> |
| 27 | + <Version>1.1.7</Version> |
| 28 | + </RestoreDotnetToolsPackage> |
| 29 | + </ItemGroup> |
| 30 | + <Target Name="DotnetToolRestore" DependsOnTargets="_FindDotnetExe;_FindMissingDotnetToolPackages"> |
| 31 | + <Exec Command=""$(DotnetExe)" tool install %(Identity) --version %(Version) --tool-path "$(DotnetToolsFolder)\"" Condition="Exists('$(DotnetExe)') and '@(_MissingDotnetToolPackage)'!=''" WorkingDirectory="$(MSBuildThisFileDirectory)" /> |
| 32 | + </Target> |
| 33 | + |
| 34 | + <Target Name="_FindMissingDotnetToolPackages"> |
| 35 | + <CreateItem Include="@(RestoreDotnetToolsPackage)" Condition="!Exists('$(DotnetToolsFolder).store\%(Identity)\%(Version)\%(Identity)\%(Version)\%(Identity).%(Version).nupkg')" PreserveExistingMetadata="true"> |
| 36 | + <Output TaskParameter="Include" ItemName="_MissingDotnetToolPackage"/> |
| 37 | + </CreateItem> |
| 38 | + </Target> |
| 39 | + |
| 40 | + <!-- Find dotnet.exe in the PATH if it is not in the default location. --> |
| 41 | + <Target Name="_FindDotnetExe" Condition="!Exists('$(DotnetExe)')"> |
| 42 | + <CreateItem Include="$(PATH)"> |
| 43 | + <Output TaskParameter="Include" ItemName="_FindDotnetExePaths" /> |
| 44 | + </CreateItem> |
| 45 | + <CombinePath BasePath="%(_FindDotnetExePaths.Identity)" Paths="dotnet.exe"> |
| 46 | + <Output TaskParameter="CombinedPaths" ItemName="_FindDotnetExeCombinedPaths" /> |
| 47 | + </CombinePath> |
| 48 | + <CreateItem Include="@(_FindDotnetExeCombinedPaths->Reverse())"> |
| 49 | + <Output TaskParameter="Include" ItemName="_FindDotnetExeCombinedPathsReversed" /> |
| 50 | + </CreateItem> |
| 51 | + <CreateItem Include="@(_FindDotnetExeCombinedPathsReversed)"> |
| 52 | + <Output TaskParameter="Include" PropertyName="DotnetExe" Condition="Exists('%(_FindDotnetExeCombinedPathsReversed.Identity)')" /> |
| 53 | + </CreateItem> |
| 54 | + </Target> |
| 55 | + |
| 56 | + <!-- Sentinel value that indicates Dotnet.targets has been initialized. --> |
| 57 | + <PropertyGroup> |
| 58 | + <WixBuildDotnetToolPropertiesDefined>true</WixBuildDotnetToolPropertiesDefined> |
| 59 | + </PropertyGroup> |
| 60 | +</Project> |
0 commit comments