|
7 | 7 | <SignToolPath Condition="!Exists($(SignToolPath))">$(MSBuildProgramFiles32)\Windows Kits\10\bin\x64\signtool.exe</SignToolPath> |
8 | 8 | <SignToolPath Condition="!Exists($(SignToolPath))">$(MSBuildProgramFiles32)\Windows Kits\10\bin\10.0.22000.0\x64\signtool.exe</SignToolPath> |
9 | 9 | <SignToolPath Condition="!Exists($(SignToolPath))">$(MSBuildProgramFiles32)\Windows Kits\10\bin\10.0.19041.0\x64\signtool.exe</SignToolPath> |
10 | | - <SignToolPath Condition="!Exists($(SignToolPath))">$(WindowsSDK80Path)bin\x64\signtool.exe</SignToolPath> |
| 10 | + <SignToolPath Condition="!Exists($(SignToolPath))">$(WindowsSDK80Path)bin\x64\signtool.exe</SignToolPath> |
11 | 11 | <SignToolPath Condition="!Exists($(SignToolPath))">signtool.exe</SignToolPath> <!-- fallback to use PATH environment --> |
12 | 12 |
|
13 | 13 | <CodeSignCertificateStore Condition="'$(CodeSignCertificateStore)'==''">LocalMachine</CodeSignCertificateStore> |
14 | | - <CodeSignCertificateName Condition="'$(THUMBPRINT)'==''"></CodeSignCertificateName> |
15 | | - <SignOutput Condition="'$(THUMBPRINT)'!=''">true</SignOutput> |
16 | | - <SignAssemblyCommand Condition="'$(SignOutput)' == 'true'">"$(SignToolPath)" sign /fd SHA256 /sha1 $(THUMBPRINT) /sm /tr $(CertificateTimeStampService) /td SHA256</SignAssemblyCommand> |
| 14 | + <SignAssemblyCommand>"$(SignToolPath)" sign /fd SHA256 /sha1 $(THUMBPRINT_SHA1) /sm /tr $(CertificateTimeStampService) /td SHA256</SignAssemblyCommand> |
17 | 15 | <NuGetExePath>$(MSBuildThisFileDirectory)..\.tools\NuGet.exe</NuGetExePath> |
18 | | - <SignNugetCommand>--certificate-fingerprint $(THUMBPRINT) --certificate-store-name My --certificate-store-location $(CodeSignCertificateStore) --timestamper $(CertificateTimeStampService) --overwrite</SignNugetCommand> |
| 16 | + <SignNugetCommand>--certificate-fingerprint $(THUMBPRINT_SHA256) --certificate-store-name My --certificate-store-location $(CodeSignCertificateStore) --timestamper $(CertificateTimeStampService) --overwrite</SignNugetCommand> |
19 | 17 | </PropertyGroup> |
20 | 18 |
|
21 | | - <Target Name="SignAssembly" Condition="'$(SignOutput)' == 'true'" BeforeTargets="CopyFilesToOutputDirectory" DependsOnTargets="ComputeIntermediateSatelliteAssemblies"> |
| 19 | + <Target Name="SignAssembly" Condition="'$(THUMBPRINT_SHA1)' != ''" BeforeTargets="CopyFilesToOutputDirectory" DependsOnTargets="ComputeIntermediateSatelliteAssemblies"> |
22 | 20 | <ItemGroup> |
23 | 21 | <FilesToSign Include="@(IntermediateAssembly)" /> |
24 | 22 | <FilesToSign Include="@(IntermediateRefAssembly)" /> |
|
32 | 30 | WorkingDirectory="$(ProjectDir)" EchoOff="true" /> |
33 | 31 | </Target> |
34 | 32 |
|
35 | | - <Target Name="SignNuGet" Condition="'$(SignOutput)' == 'true' AND '$(IsPackable)'=='true'" AfterTargets="Pack"> |
| 33 | + <Target Name="SignNuGet" Condition="'$(THUMBPRINT_SHA256)' != '' AND '$(IsPackable)'=='true'" AfterTargets="Pack"> |
36 | 34 | <PropertyGroup> |
37 | 35 | <NugetPackageFileName>$(PackageOutputPath)\$(PackageId).$(PackageVersion).nupkg</NugetPackageFileName> |
38 | 36 | <SNugetPackageFileName>$(PackageOutputPath)\$(PackageId).$(PackageVersion).snupkg</SNugetPackageFileName> |
39 | 37 | </PropertyGroup> |
40 | | - <Exec Command="dotnet nuget sign "$(NugetPackageFileName)" $(SignNugetCommand)" /> |
41 | | - <Exec Command="dotnet nuget sign "$(SNugetPackageFileName)" $(SignNugetCommand)" /> |
| 38 | + <Exec Command="$(DOTNET_HOST_PATH) nuget sign "$(NugetPackageFileName)" $(SignNugetCommand)" /> |
| 39 | + <Exec Command="$(DOTNET_HOST_PATH) nuget sign "$(SNugetPackageFileName)" $(SignNugetCommand)" /> |
42 | 40 | </Target> |
43 | | - |
44 | | - <Target Name="DownloadNuGetExe"> |
45 | | - <DownloadNuGet OutputFilename="$(NuGetExePath)" Condition="!Exists('$(NuGetExePath)')" /> |
46 | | - </Target> |
47 | | - |
48 | | - <UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll"> |
49 | | - <ParameterGroup> |
50 | | - <OutputFilename ParameterType="System.String" Required="true" /> |
51 | | - </ParameterGroup> |
52 | | - <Task> |
53 | | - <Reference Include="System.Core" /> |
54 | | - <Reference Include="System.Xml" /> |
55 | | - <Reference Include="WindowsBase" /> |
56 | | - <Using Namespace="System" /> |
57 | | - <Using Namespace="System.IO" /> |
58 | | - <Using Namespace="System.IO.Packaging" /> |
59 | | - <Using Namespace="System.Linq" /> |
60 | | - <Using Namespace="System.Net" /> |
61 | | - <Using Namespace="System.Xml" /> |
62 | | - <Using Namespace="Microsoft.Build.Framework" /> |
63 | | - <Using Namespace="Microsoft.Build.Utilities" /> |
64 | | - <Code Type="Fragment" Language="cs"> |
65 | | - <![CDATA[ |
66 | | - string zipTempPath = null; |
67 | | - try { |
68 | | - OutputFilename = Path.GetFullPath(OutputFilename); |
69 | | - if (File.Exists(OutputFilename)) { |
70 | | - Log.LogMessage("NuGet command line utility already present at " + OutputFilename); |
71 | | - return true; |
72 | | - } |
73 | | - var info = new FileInfo(OutputFilename); |
74 | | - if(!info.Directory.Exists) |
75 | | - info.Directory.Create(); |
76 | | - WebClient webClient = new WebClient(); |
77 | | - Log.LogMessage("Downloading NuGet.CommandLine"); |
78 | | - webClient.DownloadFile("https://dist.nuget.org/win-x86-commandline/v5.7.0/nuget.exe", OutputFilename); |
79 | | - return true; |
80 | | - } |
81 | | - catch (Exception ex) { |
82 | | - Log.LogErrorFromException(ex); |
83 | | - return false; |
84 | | - } |
85 | | - ]]> |
86 | | - </Code> |
87 | | - </Task> |
88 | | - </UsingTask> |
89 | | - |
90 | 41 |
|
91 | 42 | </Project> |
0 commit comments