我不知道哪里出错了。当我构建它时,搜索DLL登录的默认路径。尽管我指定了路径。
我已经将我的.snk文件创建并存储在与DLL相同的位置。
//Assembly info file for errorcollection
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ErrorCollection")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ErrorCollection")]
[assembly: AssemblyCopyright("Copyright © 2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2c17131b-0ae3-4146-a797-308f5958e819")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: System.Reflection.AssemblyKeyFile(@"D:\Services\bin\ErrorCollection.snk")]
我收到以下错误:
“签署程序集时出现加密失败'D:\ Services \ ErrorCollection \ obj \ Debug \ ErrorCollection.dll' - '读取密钥文件时出错'D:\ Services \ bin \ ErrorCollection.snk' - 系统无法找到指定的文件.'ErrorCollection“
答案 0 :(得分:9)
检查本地计算机上Keys文件夹的访问权限,并授予VS用户权限。
C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys
答案 1 :(得分:5)
对我来说,这个问题在升级到Windows 10后发生了。 然后MachineKeys的位置位于不同的位置,即
C:\ ProgramData \微软\加密\ RSA
右键单击MachineKeys并确保已设置所有权限。
答案 2 :(得分:2)
路径必须相对于程序集。
请查看以下知识base。
因此尝试更改
@ “d:\服务\ BIN \ ErrorCollection.snk”
是类似的(这里我假设它是你的根d驱动器的四个级别)
@ “.. \ .. \ .. \ .. \服务\ BIN \ ErrorCollection.snk”
答案 3 :(得分:1)
右键单击您的项目 - >属性 - >选中“签署程序集”
答案 4 :(得分:1)
为我修复的是确保我以管理员身份运行Visual Studio。
答案 5 :(得分:0)
您也可以停用在visualstudio中的签名
答案 6 :(得分:0)
以“以管理员身份运行”打开Visual Studio,解决了我的问题。