English 中文(简体)
Visual Studio 2005 Project Build Order without using Project Dependencies
原标题:

The short version of my question is how do I change the build order of projects in my solution without being forced to set one project as a dependency of the other?

In my solution, I ve got 2 projects:

1.) An executable written in C
2.) A static library containing unit tests using the CUTest framework.

I ve got 4 build configurations:

1.) Debug - I want only the exe in debug mode. The static lib project is un-selected so it won t build.
2.) Release - I want only the exe in release mode. The static lib project is un-selected so it won t build.
3.) Debug with Unit Tests - Want the static lib built, then the exe since it depends on the lib in this case.
4.) Release with Unit Tests - Ditto #3, just in release.

Because the executable is dependent on other libs and dlls not in the solution, I ve got all those listed out as additional dependencies in the linker settings. In the unit test build configurations, I ve got the static lib also included in the executable s dependency list.

Now here s the rub. The only way I ve found so far to change the build order and make sure that the static lib is built before the exe is to right-click on the solution and select build order. In that dialog box, it says that I must use the dependencies tab to change the build order. This makes sense. However, if I mark the executable as depending on the static lib, it automatically adds the static library as a linker dependency of the executable. This is fine for the unit test build configs. In the non unit test build configs, however, it tries to link in the static lib which, if I ve done a clean before the build, has been deleted and can t be linked in because I don t build it in those configs (nor do I want it linked in in those cases).

That being said, is there a way to change the build order without marking dependencies? I d want to set the build order for the unit test configs to make sure the static lib was built first.

最佳回答

You can disable the automatic inclusion of library dependencies.

In your exe s property page:

Linker -> General -> Link Library Dependencies -> No

This allows you to specify project dependencies and thus build order without the static library being linked in.

问题回答

I would take a look at NAnt. It may be possible to build an ant script to solve your problem.

http://nant.sourceforge.net

Per configuration dependencies may be an answer. It will allow to specify that the lib is a dependency of the executable for only the configuration where this makes sense.





相关问题
Visual studio tag highlighting feature is missing!

I need a little assistance with regards to my visual studio IDE. There is this feature in aspx markup pages to highlight the matching tags when you click on them. <td ...

How to split a Crystal Reports subreport across a page break?

I m using Visual Studio 2005 and writing in VB.NET. I have a subreport in a Crystal Reports report consisting of a list of log entries. Sometimes the list of log entries is long enough that it would ...

Reset Function in Visual C#

Finally I made a game using Visual C# ... (With Help Of Stackoverflow members ,,, Thanx). I Have three more questions. 1- How can I add a reset function to the application form I mean I want it to ...

VS 2005 Setup - HKCU

I am trying to fix an existing application that uses a Visual Studio 2005 setup project. We are requiring it to work on limited user accounts for XP, our app is written in C# for .Net 2.0. It writes ...

SOAP and WSDL in webservice

I am a beginner to webservice concepts. Now I know how to deploy webservice in IIS. I checked the webservice URL There I can see SOAP protocol contents and WSDL (after url type ?WSDL). My questions ...

Unable to generate PDB files in Visual Studio 2005

For most assemblies, I m able to generate their respective .pdb files. However, I ve got one project that isn t generating their .pdb files. I ve made sure that it on debug mode and that the project ...

热门标签