简体   繁体   中英

VS 2015 CS0234 False Error

Other Resources Checked/ Ideas tried

Setup

  • Visual Studio 2015 update 3
  • .net 4.5

I currently have a solution with 2 projects. 1 project has a direct reference to the other project, they are both .net 4.5. For simplicity, I will call the project that is being referenced 'A', and the project that is referencing A - 'B'.

While developing in BI have full IntelliSense on classes within A. As soon as I build the solution, project A builds successfully, but project B has several errors as such:

The type or namespace name 'x' does not exist in the namespace 'projectName' (are you missing an assembly reference?)

When I double click the error to navigate to the file I see the error on the 'using' statement for about 1 second, then it disappears along with the error from the error list. I can continue clicking through the entire error list until the error list is empty, but as soon as I rebuild the errors reappear.

Any help would be greatly appreciated.

验证项目B是否正在引用使用高于4.5版本的Framework的其他dll文件,我也遇到了此问题,这是由于必须在引用使用该包的原始项目的每个项目中添加一些Nuget包。

Try taking a look at your Project Dependencies. To do this: Right Click on your Solution and select Properties Then on the left side of the screen select 'Project Dependencies' Make sure that Project 'B' depends on Project 'A'.

This will assure that the projects are being built in the correct order. It should already be set this way, but sometimes Visual Studio doesn't set the dependencies up correctly.

Also, make sure that you don't have any references to Project 'A' in Project 'B'. That would create a circular dependency and give you no end of grief.

do you have a file reference or a project reference. If its a file reference (ie you pointed at the output dll of project A) then you need to ensure that the project dependencies say that B depends on A so that they get built in the correct order

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM