简体   繁体   中英

The type or namespace name 'BussinessLib' could not be found (are you missing a using directive or an assembly reference?)

I have a web ASP.NET project with the bellow structure:

在此处输入图片说明

I copied this solution to my test computer and now I get

The type or namespace name 'BussinessLib' could not be found 

HousingSurvey is the startup project .

Each project get built successfuly but when I try to build the solution I get The type or namespace name 'BussinessLib' could not be found

As you see BussinessLib is a reference for Housingsurvey. The using BussinessLib statement is set correctly in the HousingSurvey .

So I rebuild BussinessLib and add the reference to Housingsurvey. Housing Survey as a project builds successfully. but again when I build the solution I get The type or namespace name 'BussinessLib' could not be found

To make things stranger when I check C:\\CSharpTest\\HousingSurvey\\HousingSurvey\\BussinessLib\\bin\\Debug

BussinessLib.dll is deleted somehow(After I build the solution). I double checked BussinessLib.dll and saw it does get created there whenever I build the BussinessLib project.

I found the most promising answer here: The type or namespace name could not be found

But above answer did not help me since all of 3 projects in my solution are targeted to the .NET Framework 4.5

Any feedback is greatly appreciated.


Update: please note that this whole solution builds "Successfully" in my UAT computer. Then I copy paste it to the test computer and it fails on build. For some weird reason, whenever I build the whole solution, Business.dll gets deleted from the bin folder! and that's why code that references it can not find it.

From the HousingSurvey Project, delete the reference to BusinessLib and re-add it again. It is probably an issue with a file path for the original reference.

Also when you add the reference to the project again, be sure to set the 'Copy Local' property to True

  1. In Solution Explorer, click the Show All Files button to display the References node.
  2. Open the References node for the project.
  3. Right-click a reference in the References list, and click Properties. The properties associated with that reference appear in a list in the Properties window.
  4. Select Copy Local from the left-hand column, and then click the arrow in the right-hand column to change the value to True or False.

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