简体   繁体   中英

Visual Studio 2008 Building Solution Issues

We have a VB.NET Windows Forms Solution developed using the 3.5 framework.

The solution has more than 30 projects (dlls) that are referenced from one to another. We even have some projects separated into N layers too (one for the data Access, other for the business logic, and so on).

Since a time ago the solution does not work properly. When we start Visual Studio (2008), it shows hundreds of errors. The vast majority are:

"Type 'XXXX' is not defined.

And after doing some "clean" + several "build" we are able to get the binaries.

Anyone has any idea about what is the problem and how to solve it??

You have a problem with the dependencies, maybe incorrect order or circular reference. For example this can be one of the scenarios you are suffering:

  • Project A depends on Project B
  • Project B depends on Project C
  • Project C depends no nothing.

You build all projects in this order A,B,C. First time you build A,B fails but C works. Second time A fails but B,C works. Third attempt A,B,C works.

In theory Visual Studio should work out the correct order... but if you have unused dependencies or circular references it fails.

You have to review and clean your dependencies . You can use nDepend ( http://ndepend.com ) or similar tool (Resharper, Architecture Explorer in VS2010 Ultimate, etc.) to make a dependency map and then use it to clean your dependencies. You can find a lot of good tools in this SO question .

Once you review and clean your dependencies it would build at the first attempt.

All you need is to correct your project build order.

First work out what projects depend on what others. The ones that do not depend on anything should go to the top of list and ones that depend on others should go below in order.

Then right-click your solution and select Project Build Order... from the popup menu.

在此处输入图片说明

The following dialog box will appear. Set the project build order in correct sequence. Use the Dependencies tab to specify the dependencies correctly. 在此处输入图片说明

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