由于缺少缺少的程序集引用,Visual Studio拒绝生成项目 [英] Visual Studio refuses to build project due to missing assembly reference that isn't missing

查看:407
本文介绍了由于缺少缺少的程序集引用,Visual Studio拒绝生成项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建c#Windows服务,并向我的项目添加了几个程序集引用(对我自己的其他项目)。

I'm building a c# windows service and has added a couple of assembly references (to other projects of my own) to my project.

构建时出现以下错误:


错误25类型或名称空间名称 TestClass找不到(您是否缺少using指令或程序集引用?

"Error 25 The type or namespace name 'TestClass' could not be found (are you missing a using directive or an assembly reference?"

足够有趣的是, csproj文件中的引用路径是正确的,并且最重要的是,Intellisense会从Visual Studio缺少所引用项目的类和名称空间中提取内容,甚至转到定义功能也能正常工作此外,我在与新Windows服务完全相同的文件夹中还有其他项目,他们很好地拾取了程序集引用。所有引用的项目都包含在解决方案中。

Interestingly enough, the reference path in the csproj-file is correct, and on top of that, classes and namespaces from the referenced project, that according to Visual Studio is missing, is being picked up by Intellisense and even the "go to definition" function works fine. Furthermore, I have other projects in the exact same folder as my new windows service and they picked up the assembly references just fine. All the referenced projects are included in the solution.

我使用Visual Studio 2013 Update3。确实没有可以显示的代码可以为您提供更多信息,但是如果您想查看一些屏幕截图或其他内容,请告诉我。

I use Visual Studio 2013 Update 3. There is really no code that I could show that would give you more information, but let me know if you want to see some screenshots or something.

到目前为止的尝试:

  • Tried restarting VS and reloading all projects
  • Tried adding the paths to the properties reference paths page.
  • Tried all steps in this guide: https://msdn.microsoft.com/en-us/library/ayds71se.aspx

更新
当我选择缺失之一时引用列表中的引用,并转到属性,没有定义路径。但是,正确的路径是在csproj文件中。令人困惑。

Update When I select one of the "missing" references in the reference list, and go to properties, there is no path defined. Yet, the relative path is in the csproj-file as is correct. Confusing.

更新2
删除所有引用,重新加载项目,然后为我进行清理。显然,该问题是由于未在构建堆栈中更新所有dll造成的。

Update 2 Removing all the references, reloading the projects and then doing a clean fixed it for me. Apparently, the problem was caused by all dlls not being updated in the build stack.

推荐答案

1。删除所有引用

2.Build->清洁解决方案

2.Build --> Clean solution

3。使用此项目,因为有时Visual Studio无法干净地清理所有内容。

3.Clean your project using this project as sometimes visual studio fails to clean everything neatly.

这篇关于由于缺少缺少的程序集引用,Visual Studio拒绝生成项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆