在WebPart中引用了一个类库,运行时提示“Error occurred in deployment step 'Add Solution': 此解决方案包含面向全局程序集缓存的一个或多个程序集。您应该为将保存在全局程序集缓存中的任何程序集使用强名称。”
我这里引用的是Interop.Scripting.dll程序集,它不是强名称的,则需要进行以下操作:
1.打开SDK 命令提示窗口;
2.创建一个新的随机密钥对:
sn -k Interop.Scripting.snk
3.反编译目标程序集
ildasm Interop.Scripting.dll /out=Interop.Scripting.il
3.重新编译,附带强命名参数
ilasm Interop.Scripting.il /dll /resource=Interop.Scripting.res /key=Interop.Scripting.snk /optimize
4.验证签名信息
sn -v Interop.Scripting.dll
OK,将生成的dll文件重新引入到项目中然后编译
我这里引用的是Interop.Scripting.dll程序集,它不是强名称的,则需要进行以下操作:
1.打开SDK 命令提示窗口;
2.创建一个新的随机密钥对:
sn -k Interop.Scripting.snk
3.反编译目标程序集
ildasm Interop.Scripting.dll /out=Interop.Scripting.il
3.重新编译,附带强命名参数
ilasm Interop.Scripting.il /dll /resource=Interop.Scripting.res /key=Interop.Scripting.snk /optimize
4.验证签名信息
sn -v Interop.Scripting.dll
OK,将生成的dll文件重新引入到项目中然后编译