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.
I have unchecked "Delay sign only" and "Sign the assembly" on the Visual Studio project properties box, and rebuilt. The assembly is still marked for delay sign (as shown by sn.exe -v
).
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.
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.
How can I do this?
In this case, the problem is a project "common properties" reference.
Inside of the project .csproj file is this innocuous little line:
<Import Project="..\build\CommonProperties.targets" />
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.
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>
Met the same problem. Even after I disabled "Delay Sign only" and "Sign the assembly", I still got the error
error MSB3325: Cannot import the following key file: . The key file may be password protected".
And the .csproj is correct:
<PropertyGroup>
<SignAssembly>false</SignAssembly>
<DelaySign>false</DelaySign>
</PropertyGroup>
However, there's one more tricky line below:
<SignAssembly Condition="Exists('..\xxx.pfx')">true</SignAssembly>
Only after I removed the line in .csproj, or removed the file on the disk, then the VS is OK to go.
Seems like a bug of VS. The version I am using:
Microsoft Visual Studio 2010
Version 10.0.40219.1 SP1Rel
Microsoft .NET Framework
Version 4.5.50709 SP1Rel