从程序集中删除签名 [英] Remove signing from an assembly

查看:240
本文介绍了从程序集中删除签名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Visual Studio中打开了一个项目(碰巧是Enyim.Caching)。该程序集希望进行延迟签名。实际上,它非常渴望被延迟签名,以至于我无法强迫Visual Studio在没有延迟签名的情况下进行编译。

I have a project open in Visual Studio (it happens to be Enyim.Caching). This assembly wants to be delay-signed. In fact, it desires so strongly to be delay-signed, that I am unable to force Visual studio to compile it without delay signing.


  1. 我在Visual Studio项目属性框中未选中仅延迟签名和签名程序集,然后重新构建。程序集仍标记为延迟符号(如 sn.exe -v 所示)。

我已经卸载了该项目,并验证了签名设置为false。重新加载项目时,将选中符号和延迟符号的复选框。

I have unloaded the project and verified that the signing is set to false. When reloading the project, the check boxes for "Sign" and "Delay Sign" are checked.

我已经验证了AssemblyInfo中没有属性(

I have verified that no attributes are present in the AssemblyInfo (or elsewhere) that would cause this.

我已经在互联网上搜索了解决方案,但没有找到解决方法。

I have searched the Internet for a solution, but have found none.

我该怎么做?

推荐答案

在这种情况下,问题出在项目的公共属性参考上。

在项目.csproj文件的内部,这行无害: p>

Inside of the project .csproj file is this innocuous little line:


<导入项目= .. \build\CommonProperties.targets />

<Import Project="..\build\CommonProperties.targets" />

不幸的是,文件( CommonProperties.targets )指示VS重新编写属性,但它不提供任何内容

Unfortunately, the file (CommonProperties.targets) instructs VS to re-write the properties, but it does not provide any clear indication in the user interface that this is taking place.

解决方案是进入 CommonProperties.targets 文件和d删除以下几行:

The solution is to go into the CommonProperties.targets file and delete the following lines:

<!-- 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>

用以下内容替换这些行:

Replace those lines with the following:

  <PropertyGroup>
    <DelaySign>false</DelaySign>
    <SignAssembly>false</SignAssembly>
  </PropertyGroup>

这篇关于从程序集中删除签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆