the*_*yer 7 c# clr delay-sign visual-studio-2012 enyim.caching
我在Visual Studio中打开了一个项目(恰好是Enyim.Caching).这个集会希望延迟签署.实际上,它需要如此强烈地进行延迟签名,我无法强制Visual Studio在没有延迟签名的情况下编译它.
我取消选中Visual Studio项目属性框中的"仅延迟符号"和"签署程序集",然后重新构建.程序集仍标记为延迟符号(如图所示sn.exe -v).
我已卸载项目并验证签名是否设置为false.重新加载项目时,将选中"签名"和"延迟签名"复选框.
我已经验证AssemblyInfo(或其他地方)中没有可能导致此问题的属性.
我在互联网上搜索了一个解决方案,但没找到.
我怎样才能做到这一点?
在这种情况下,问题是项目"常见属性"引用.
在项目里面.csproj文件是这个无害的小行:
<Import Project ="..\build\CommonProperties.targets"/>
不幸的是,file(CommonProperties.targets)指示VS重写属性,但它没有在用户界面中提供任何明确的指示.
解决方案是进入CommonProperties.targets文件并删除以下行:
<!-- delay sign the assembly if the PrivateKeyPath property is not specified -->
<PropertyGroup Condition=" '$(PrivateKeyPath)' == '' And '$(PrivateKeyName)' == ''">
<AssemblyOriginatorKeyFile>..\public_key.snk</AssemblyOriginatorKeyFile>
<DelaySign>true</DelaySign>
</PropertyGroup>
<!-- sign the assembly using the specified key file containing both the private and public keys -->
<PropertyGroup Condition=" '$(PrivateKeyPath)' != '' ">
<AssemblyOriginatorKeyFile>$(PrivateKeyPath)</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
</PropertyGroup>
<!-- sign the assembly using the specified key container containing both the private and public keys -->
<PropertyGroup Condition=" '$(PrivateKeyName)' != '' ">
<AssemblyOriginatorKeyFile></AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)
用以下内容替换这些行:
<PropertyGroup>
<DelaySign>false</DelaySign>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)