Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

Commit c239124

Browse files
committed
Update signing approach
Set up to use the latest version of MicroBuild signing: 1. Remove the use of RoslynTools.SignTool in build.cmd. This should no longer be necessary, as MicroBuild signing is integrated into MSBuild. 2. Include the Microsoft.VisualStudioEng.MicroBuild.Core package into all the projects that need signing. 3. Define `FilesToSign` items specifying the files that need to be signed by MicroBuild. Note that in local builds we should still get "public" signing courtesy of the settings in build/Signing/Signing.props. "Real" builds will first apply delay signing, and then MicroBuild will complete the signing. A future commit will remove the other parts of the current signing infrastructure that we no longer need.
1 parent f2e56c8 commit c239124

File tree

5 files changed

+29
-25
lines changed

5 files changed

+29
-25
lines changed

build.cmd

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ echo.
8585
call :PrintColor Green "Build completed successfully, for full log see %LogFile%"
8686

8787
if "%RunTests%" == "false" (
88-
goto :Signing
88+
exit /b 0
8989
)
9090

9191
echo.
@@ -97,30 +97,6 @@ if ERRORLEVEL 1 (
9797
exit /b 1
9898
)
9999

100-
:Signing
101-
if NOT "%OfficialBuild%" == "true" (
102-
exit /b 0
103-
)
104-
105-
echo.
106-
echo Signing binaries
107-
108-
REM Respect the %NUGET_PACKAGES% environment variable if set, as that's where nuget will restore to
109-
set NuGetHome=%NUGET_PACKAGES%
110-
if "%NuGetHome%" == "" (
111-
REM If it's not set, the nuget cache is in the user's home dir
112-
set NuGetHome=%UserProfile%\.nuget\packages
113-
)
114-
set SignTool="%NuGetHome%\roslyntools.signtool\1.1.0-beta3.21260.1\tools\SignTool.exe"
115-
116-
%SignTool% -config "%Root%build\Signing\SignToolConfig.json" -msbuildPath "%VS160COMNTOOLS%..\..\MSBuild\Current\Bin\msbuild.exe" "%Root%bin\%BuildConfiguration%"
117-
if ERRORLEVEL 1 (
118-
echo.
119-
call :PrintColor Red "Signing failed"
120-
exit /b 1
121-
)
122-
123-
call :PrintColor Green "Signing completed. See output Binaries in %Root%build\%BuildConfiguration%"
124100
exit /b 0
125101

126102
:Usage

src/ProjectFileTools.MSBuild/ProjectFileTools.MSBuild.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
<PropertyGroup>
44
<TargetFramework>net46</TargetFramework>
55
</PropertyGroup>
6+
<ItemGroup>
7+
<PackageReference Include="Microsoft.VisualStudioEng.MicroBuild.Core" Version="0.4.1" />
8+
</ItemGroup>
69
<ItemGroup>
710
<PackageReference Include="Microsoft.Build" Version="15.3.0-preview-000117-01" />
811
</ItemGroup>
@@ -11,6 +14,12 @@
1114
<PackageReference Include="Microsoft.VisualStudio.Validation" Version="15.0.26606-alpha" />
1215
<Reference Update="**\Microsoft.Language.Xml.dll" CopyLocal="true" />
1316
</ItemGroup>
17+
<ItemGroup>
18+
<FilesToSign Include="$(OutDir)\$(AssemblyName).dll">
19+
<Authenticode>MicrosoftSHA2</Authenticode>
20+
<StrongName>MsSharedLib72</StrongName>
21+
</FilesToSign>
22+
</ItemGroup>
1423

1524
<Target Name="BuiltProjectOutputGroup" />
1625
<Target Name="BuiltProjectOutputGroupDependencies" />

src/ProjectFileTools.NuGetSearch/ProjectFileTools.NuGetSearch.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
<Company>Microsoft</Company>
1111
<Copyright>Copyright © Microsoft Corporation</Copyright>
1212
</PropertyGroup>
13+
<ItemGroup>
14+
<PackageReference Include="Microsoft.VisualStudioEng.MicroBuild.Core" Version="0.4.1" />
15+
</ItemGroup>
1316
<ItemGroup Condition="'$(TargetFramework)' == 'net46'">
1417
<Reference Include="System.ComponentModel.Composition" />
1518
<Reference Include="System.Net.Http" />
@@ -19,6 +22,12 @@
1922
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
2023
<PackageReference Include="System.Net.Http" Version="4.3.4" />
2124
</ItemGroup>
25+
<ItemGroup>
26+
<FilesToSign Include="$(OutDir)\$(AssemblyName).dll">
27+
<Authenticode>MicrosoftSHA2</Authenticode>
28+
<StrongName>MsSharedLib72</StrongName>
29+
</FilesToSign>
30+
</ItemGroup>
2231
<Target Name="BuiltProjectOutputGroup" />
2332
<Target Name="BuiltProjectOutputGroupDependencies" />
2433
<Target Name="GetCopyToOutputDirectoryItems" />

src/ProjectFileTools/ProjectFileTools.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,15 @@
160160
<ManifestResourceName>VSPackage</ManifestResourceName>
161161
</EmbeddedResource>
162162
</ItemGroup>
163+
<ItemGroup>
164+
<FilesToSign Include="$(OutDir)\$(AssemblyName).dll">
165+
<Authenticode>MicrosoftSHA2</Authenticode>
166+
<StrongName>MsSharedLib72</StrongName>
167+
</FilesToSign>
168+
<FilesToSign Include="$(OutDir)\$(AssemblyName).vsix">
169+
<Authenticode>VsixSHA2</Authenticode>
170+
</FilesToSign>
171+
</ItemGroup>
163172
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
164173
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
165174
<Target Name="LinkVSSDKEmbeddableAssemblies" DependsOnTargets="ResolveReferences" AfterTargets="ResolveReferences">

src/ProjectFileTools/project.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"Microsoft.VisualStudio.Threading": "15.8.132",
3535
"Microsoft.VisualStudio.Utilities": "15.7.27703",
3636
"Microsoft.VisualStudio.Validation": "15.3.58",
37+
"Microsoft.VisualStudioEng.MicroBuild.Core": "0.4.1",
3738
"Microsoft.VSSDK.BuildTools": "15.7.109",
3839
"Microsoft.Win32.Primitives": "4.3.0",
3940
"Newtonsoft.Json": "11.0.2",

0 commit comments

Comments
 (0)