我试图使用c# 4.0编译我的excel插件,并在Visual Studio中构建我的项目时开始遇到这个问题。重要的是要告诉你,我以前从来没有遇到过这个问题。什么会导致这种情况发生?
当前回答
我有这个解决方案与6个项目。 我的一个项目是将命名程序集引用为文件引用。其他人都指向了项目参考。
在这种情况下,我通常会得到不同的错误。
我的解决方案是在引用命名程序集的任何地方删除它,然后再将它添加回来。 一旦我完成了这个项目,这个问题就消失了。 在此之前,我尝试清理解决方案,并确保没有任何项目被签名。
希望它能帮助到某人…
其他回答
这里有一个不同的方法来解决这个问题:
右键单击项目并选择“卸载项目”选项。您将注意到您的项目变得不可用。 右键单击不可用项目并选择“Edit”选项。 向下滚动到包含所有资源标记的“< ItemGroup >”标记。 现在转到已经显示在错误列表中的引用,您将注意到它使用了单个标记(即< reference Include="assemble_name_here, Version=0.0.0.0, Culture=neutral" / >)。 更改为如下所示:
.
<Reference Include="assemble_name_here, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL" >
< Private > True < / Private >
< HintPath > path_here\assemble_name_here.dll < / HintPath >
< / Reference >
保存您的更改,再次右键单击不可用的项目,然后单击“重新加载项目”选项,然后构建。
当我在更新WindowsAPICodePack后遇到这种情况时,我只是重新构建了解决方案。
构建——>重建方案
我就有这个问题。这是因为我有许多项目指向相同的组装,但从不同的版本。我解决它选择相同版本的所有项目在我的解决方案。
为任何人添加我的解决方案,这可能会有所帮助。
I had a ClickOnce solution throwing this error. The app referenced a common "Libs" folder and contained a project reference to a Foo.dll. While none of the projects in the solution referenced the static copy of the Foo.dll in the "Libs" folder, some of the references in that folder did (ie: my solution had refs to Libs\Bar.dll which referenced Foo.dll.) Since the CO app pulled all the dependencies from Libs as well as their dependencies, both copies were going into the project. This was generating the error above.
我通过将我的Libs\Foo.dll静态版本移动到一个子文件夹Libs\Fix\Foo.dll来解决这个问题。此更改使ClickOnce应用程序只使用DLL的项目版本,并且错误消失了。
我得到类似的编译器错误。一旦我将dll文件的依赖项目添加到解决方案中,问题就解决了。
推荐文章
- 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?