我试图使用c# 4.0编译我的excel插件,并在Visual Studio中构建我的项目时开始遇到这个问题。重要的是要告诉你,我以前从来没有遇到过这个问题。什么会导致这种情况发生?
当前回答
I recently hit this problem. In my case, I have NuGet packages on different assemblies. What I had was different versions of the same NuGet packages associated with my own assemblies. My solution was to use the NuGet package manager upon the Solution, as opposed to the individual projects. This enables a "consolidation" option, where you can upgrade your NuGet packages across as many projects as you want - so they all reference the same version of the assembly. When I did the consolidations, the build failure disappeared.
其他回答
卸载和重新加载项目的问题解决了它为我。
帮助我的是,我进入包管理器解决方案,查看导致问题的安装包。我看到有几个项目引用了相同的包,但是版本不同。我根据自己的需要把它们排列起来,这很有效。
您需要使用密钥对程序集进行签名。进入选项卡签名下的项目属性:
这是在更改引用的.dll的版本时引起的。您需要删除目标构建文件夹中的所有项或.dll。
当我遇到这个问题时,我通过关闭“启用ClickOnce安全设置”来解决它。
菜单:项目|“项目名称”属性…|安全选项卡|“启用ClickOnce安全设置”复选框。
推荐文章
- dynamic (c# 4)和var之间的区别是什么?
- Visual Studio: ContextSwitchDeadlock
- Visual Studio:如何打破处理异常?
- VS 2017 Git本地提交数据库。每次提交时锁定错误
- 返回文件在ASP。Net Core Web API
- 自定义HttpClient请求头
- 无法启动IIS Express Web服务器,注册URL失败,访问被拒绝
- 如果我使用OWIN Startup.cs类并将所有配置移动到那里,我是否需要一个Global.asax.cs文件?
- VS2013外部构建错误"error MSB4019: The imported project <path> was not found"
- 从另一个列表id中排序一个列表
- 等待一个无效的异步方法
- 无法加载文件或程序集…参数不正确
- c#中枚举中的方法
- 如何从字符串中删除新的行字符?
- 如何设置一个默认值与Html.TextBoxFor?