我无法构建具有强名称密钥签名的项目-标题中的消息总是出现。
是的,项目最初是从另一台机器复制过来的。然而,即使我通过“项目属性”中的“签名”选项卡添加了一个新密钥,仍然会显示此错误。
我曾尝试以管理员身份运行Visual Studio,并尝试手动将密钥添加到Windows证书存储区。
的帮助!
编辑:我没有得到这个错误与一个新项目,但我很想让这个现有的项目工作。即使我创建了一个新的证书,它也不能工作!
我无法构建具有强名称密钥签名的项目-标题中的消息总是出现。
是的,项目最初是从另一台机器复制过来的。然而,即使我通过“项目属性”中的“签名”选项卡添加了一个新密钥,仍然会显示此错误。
我曾尝试以管理员身份运行Visual Studio,并尝试手动将密钥添加到Windows证书存储区。
的帮助!
编辑:我没有得到这个错误与一个新项目,但我很想让这个现有的项目工作。即使我创建了一个新的证书,它也不能工作!
当前回答
Assuming this is a personal certificate created by windows on the system you copied your project from, you can use the certificate manager on the system where the project is now and import the certificate. Start the certificate manager (certmgr) and select the personal certificates then right click below the list of existing certificates and select import from the tasks. Use the browse to find the .pfx in the project (the .pfx from the previous system that you copied over with the project). It should be in the sub-directory with the same name as the project directory. I am familiar with C# and VS, so if that is not your environment maybe the .pfx will be elsewhere or maybe this suggestion does not apply. After the import you should get a status message. If you succeeded, the compile certificate error should be gone.
其他回答
我终于找到解决办法了。
编辑项目的.csproj文件。 删除以下代码行: < PropertyGroup > < ManifestCertificateThumbprint >...........</ ManifestCertificateThumbprint > < / PropertyGroup > < PropertyGroup > < ManifestKeyFile > xxxxxxxx.pfx < / ManifestKeyFile > < / PropertyGroup > < PropertyGroup > 真正< GenerateManifests > < / GenerateManifests > < / PropertyGroup > < PropertyGroup > 假< / SignManifests < SignManifests > > < / PropertyGroup >
Assuming this is a personal certificate created by windows on the system you copied your project from, you can use the certificate manager on the system where the project is now and import the certificate. Start the certificate manager (certmgr) and select the personal certificates then right click below the list of existing certificates and select import from the tasks. Use the browse to find the .pfx in the project (the .pfx from the previous system that you copied over with the project). It should be in the sub-directory with the same name as the project directory. I am familiar with C# and VS, so if that is not your environment maybe the .pfx will be elsewhere or maybe this suggestion does not apply. After the import you should get a status message. If you succeeded, the compile certificate error should be gone.
使用属性为具有强名称的程序集签名
打开AssemblyInfo.cs(在$(SolutionDir)\属性中)
AssemblyKeyFileAttribute或AssemblyKeyNameAttribute,指定文件或容器的名称,该文件或容器包含在使用强名称对程序集进行签名时使用的密钥对。
添加如下代码:
[assembly:AssemblyKeyFileAttribute("keyfile.snk")]
试试这个:
右键点击你的项目→转到属性→点击屏幕左侧的签名→取消选中签名,单击一次显示→保存和构建
转到visual studio中的项目“属性”。然后进入签名标签。
然后确保“签名单击一次”清单已关闭。
更新说明:
在解决方案资源管理器中:
右键单击您的项目 点击属性 通常在左边,选择“Signing”选项卡 检查“签名点击一次”清单 确保你保存了!