build: dotnet: strong name assembly and add publisher policy

This commit is contained in:
Bill Zissimopoulos 2017-04-10 22:51:15 -07:00
parent 259f2bf1c1
commit d9fcc8ca1c
4 changed files with 36 additions and 1 deletions

View File

@ -37,6 +37,12 @@
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>winfsp.net.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
@ -54,6 +60,9 @@
<Link>Service.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="winfsp.net.snk" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
@ -77,4 +86,19 @@
<FileWrites Include="$(IntermediateOutputPath)AssemblyInfo.cs" />
</ItemGroup>
</Target>
<PropertyGroup>
<PostBuildEvent>set MyAssemblyPolicyVersion=$(MyAssemblyPolicyVersion)
set MyAssemblyVersion=$(MyAssemblyVersion)
setlocal EnableDelayedExpansion
if exist $(OutDir)winfsp.net.policy.xml del $(OutDir)winfsp.net.policy.xml
for /f "delims=" %25%25l in ($(ProjectDir)winfsp.net.policy.xml) do (
set line=%25%25l
echo !line! &gt;&gt;$(OutDir)winfsp.net.policy.xml
)
call "$(DevEnvDir)..\Tools\VsDevCmd.bat"
al /link:$(OutDir)winfsp.net.policy.xml /out:$(OutDir)policy.$(MyAssemblyPolicyVersion).$(TargetName).dll /keyfile:$(ProjectDir)$(ProjectName).snk
</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,10 @@
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="winfsp-msil" publicKeyToken="b099876d8fa9b1f3" culture="neutral" />
<bindingRedirect oldVersion="!MyAssemblyPolicyVersion!.0.0-!MyAssemblyVersion!" newVersion="!MyAssemblyVersion!" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Binary file not shown.

View File

@ -24,7 +24,8 @@
<MyVersionWithCommas>$(MyVersion.Replace('.',',')),0</MyVersionWithCommas>
<MyFullVersion>$(MyCanonicalVersion).$(MyBuildNumber).$(MyGitRevision)</MyFullVersion>
<MyAssemblyVersion>$(MyCanonicalVersion.Substring(0,$(MyVersion.IndexOf('.')))).0.0.0</MyAssemblyVersion>
<MyAssemblyPolicyVersion>$(MyVersion.Substring(0,$(MyVersion.IndexOf('.')))).0</MyAssemblyPolicyVersion>
<MyAssemblyVersion>$(MyVersion).0</MyAssemblyVersion>
</PropertyGroup>
<ItemDefinitionGroup>