mirror of https://github.com/winsw/winsw
Strong name signing of merged assemblies.
The initial implementation was generating unsigned assemblies. ServiceWrapper/winsw.csproj has been reworked to sign merged all assemblies automatically. The current implementation requires winsw_key.snk instead of the encrypted key with a password. Signed-off-by: Oleg Nenashev <o.v.nenashev@gmail.com>pull/74/head
parent
fb8dd8a15f
commit
53ba5810a6
|
@ -7,3 +7,4 @@ obj
|
||||||
*.user
|
*.user
|
||||||
/src/packages/NUnit.2.6.4
|
/src/packages/NUnit.2.6.4
|
||||||
/src/packages/ILMerge.MSBuild.Tasks.1.0.0.3
|
/src/packages/ILMerge.MSBuild.Tasks.1.0.0.3
|
||||||
|
/winsw_key.snk
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
|
<package id="ILMerge" version="2.14.1208" targetFramework="net20" />
|
||||||
<package id="log4net" version="2.0.3" targetFramework="net20" />
|
<package id="log4net" version="2.0.3" targetFramework="net20" />
|
||||||
|
<package id="MSBuildTasks" version="1.4.0.88" targetFramework="net20" />
|
||||||
</packages>
|
</packages>
|
|
@ -16,7 +16,7 @@
|
||||||
</StartupObject>
|
</StartupObject>
|
||||||
<SignManifests>false</SignManifests>
|
<SignManifests>false</SignManifests>
|
||||||
<SignAssembly>true</SignAssembly>
|
<SignAssembly>true</SignAssembly>
|
||||||
<AssemblyOriginatorKeyFile>..\..\..\winsw_cert.pfx</AssemblyOriginatorKeyFile>
|
<AssemblyOriginatorKeyFile>$(SolutionDir)..\winsw_key.snk</AssemblyOriginatorKeyFile>
|
||||||
<FileUpgradeFlags>
|
<FileUpgradeFlags>
|
||||||
</FileUpgradeFlags>
|
</FileUpgradeFlags>
|
||||||
<UpgradeBackupLocation>
|
<UpgradeBackupLocation>
|
||||||
|
@ -91,7 +91,10 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\..\..\winsw_cert.pfx" />
|
<None Include="..\..\..\winsw_cert.pfx" />
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</None>
|
||||||
|
<None Include="$(AssemblyOriginatorKeyFile)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||||
|
@ -124,10 +127,6 @@
|
||||||
<Target Name="AfterBuild">
|
<Target Name="AfterBuild">
|
||||||
</Target>
|
</Target>
|
||||||
-->
|
-->
|
||||||
<PropertyGroup>
|
|
||||||
<PostBuildEvent>
|
|
||||||
</PostBuildEvent>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
@ -135,8 +134,8 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
|
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
|
||||||
</Target>
|
</Target>
|
||||||
<!-- Merge plugins into winsw.exe -->
|
<!-- Merge plugins and other DLLs into winsw.exe -->
|
||||||
<UsingTask TaskName="ILMerge.MSBuild.Tasks.ILMerge" AssemblyFile="$(SolutionDir)\packages\ILMerge.MSBuild.Tasks.1.0.0.3\tools\ILMerge.MSBuild.Tasks.dll" />
|
<UsingTask TaskName="MSBuild.Community.Tasks.ILMerge" AssemblyFile="$(SolutionDir)\packages\MSBuildTasks.1.4.0.88\tools\MSBuild.Community.Tasks.dll" />
|
||||||
<Target Name="AfterBuild">
|
<Target Name="AfterBuild">
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<MergeAsm Include="$(OutputPath)$(TargetFileName)" />
|
<MergeAsm Include="$(OutputPath)$(TargetFileName)" />
|
||||||
|
@ -146,8 +145,35 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<MergedAssembly>$(ProjectDir)$(OutDir)winsw.exe</MergedAssembly>
|
<MergedAssembly>$(ProjectDir)$(OutDir)winsw.exe</MergedAssembly>
|
||||||
|
<CertificatePfxFile>$(AssemblyOriginatorKeyFile)</CertificatePfxFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<!-- Locate SN.EXE in Windows SDK, use the first found one-->
|
||||||
|
<PropertyGroup>
|
||||||
|
<SnPathTmpFile>$(OutputPath)sn-path.txt</SnPathTmpFile>
|
||||||
|
</PropertyGroup>
|
||||||
|
<GetFrameworkSdkPath>
|
||||||
|
<Output TaskParameter="Path" PropertyName="WindowsSdkPath" />
|
||||||
|
</GetFrameworkSdkPath>
|
||||||
|
<Message Text="Using SDK from $(WindowsSdkPath)" Importance="high" />
|
||||||
|
<Exec Command="WHERE /r "$(WindowsSdkPath.TrimEnd('\\'))" sn > $(SnPathTmpFile)" />
|
||||||
|
<ReadLinesFromFile File="$(SnPathTmpFile)">
|
||||||
|
<Output TaskParameter="Lines" PropertyName="SNPath" />
|
||||||
|
</ReadLinesFromFile>
|
||||||
|
<Delete Files="$(SnPathTmpFile)" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<SNPath>$([System.Text.RegularExpressions.Regex]::Replace('$(SNPath)', ';.*', ''))</SNPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Error Condition="!Exists('$(SNPath)')" Text="Cannot find SN.EXE utility in $(WindowsSdkPath)" />
|
||||||
|
<Message Text="Using SN.EXE utility from $(SNPath)" Importance="high" />
|
||||||
|
<!-- Merge and re-sign assemblies -->
|
||||||
|
<PropertyGroup>
|
||||||
|
<ILMergePath>$(SolutionDir)packages\ilmerge.2.14.1208\tools</ILMergePath>
|
||||||
|
<CertificateTmpPubFile>$(OutputPath)winsw_cert.pub</CertificateTmpPubFile>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Message Text="Extracting public key from $(AssemblyOriginatorKeyFile)" />
|
||||||
|
<Exec Command=""$(SNPath)" -p "$(AssemblyOriginatorKeyFile)" "$(CertificateTmpPubFile)"" />
|
||||||
<Message Text="ILMerge @(MergeAsm) -> $(MergedAssembly)" Importance="high" />
|
<Message Text="ILMerge @(MergeAsm) -> $(MergedAssembly)" Importance="high" />
|
||||||
<ILMerge InputAssemblies="@(MergeAsm)" OutputFile="$(MergedAssembly)" TargetKind="SameAsPrimaryAssembly" />
|
<ILMerge ToolPath="$(ILMergePath)" InputAssemblies="@(MergeAsm)" OutputFile="$(MergedAssembly)" TargetKind="SameAsPrimaryAssembly" KeyFile="$(CertificateTmpPubFile)" DelaySign="true" />
|
||||||
|
<Exec Command=""$(SNPath)" -R "$(MergedAssembly)" "$(AssemblyOriginatorKeyFile)"" />
|
||||||
</Target>
|
</Target>
|
||||||
</Project>
|
</Project>
|
|
@ -22,6 +22,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{5297623A-1
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinSWCore", "Core\WinSWCore\WinSWCore.csproj", "{9D0C63E2-B6FF-4A85-BD36-B3E5D7F27D06}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinSWCore", "Core\WinSWCore\WinSWCore.csproj", "{9D0C63E2-B6FF-4A85-BD36-B3E5D7F27D06}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".build", ".build", "{D8806424-4640-440C-952D-37790B603C27}"
|
||||||
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
Build.proj = Build.proj
|
||||||
|
.build\MSBuild.Community.Tasks.dll = .build\MSBuild.Community.Tasks.dll
|
||||||
|
.build\MSBuild.Community.Tasks.targets = .build\MSBuild.Community.Tasks.targets
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
|
Loading…
Reference in New Issue