I have inherited a solution consisting of several projects, a mix of VB.NET and C#. It builds fine using the IDE "Build Solution" button. It does not build from the command line using "msbuild foo.sln"; the error message indicates that project A (which references project B) can't find project B. Indeed, upon examining the contents of the "bin" folder after using "msbuild" and comparing it against the contents after using the IDE, I can find a whole lot of DLLs missing, including B.dll.
In short: the project A does have a reference to project B, but B.DLL is only copied to A's bin directory when using the IDE, but not when using msbuild. If I run msbuild after an IDE build it works, since the referenced DLLs are copied.
I had naively believed that "msbuild foo.sln" is the same as an IDE build of foo.sln. That doesn't seem to be the case. There are at least three other similar questions here on Stack Overflow but I can't reference them because "new users can only post one hyperlink" (!!). Sorry. Here are the question titles so you can search yourself:
- different results using msbuild project.sln build vs vs2008 IDE build
- MSBuild builds projects with project references correctly but not from solution
- Here, an answer by John Saunders suggests to use "devenv", which does work for me.
- MSBuild doesn’t pick up references of the referenced project
Now here are my questions:
- Where can I find documented precisely what Visual Studio does when you "Build Solution"?
- What are the best practices for configuring Visual Studio and a Continuous Integration server (e.g. Hudson) so that the developer workstation builds are the same as the CI builds?
- Should we set up the CI server to use devenv as suggested by John Saunders, above?
- Or should we write an MSBuild script for Visual Studio to use as suggested by http://brennan.offwhite.net/blog/2007/05/31/running-msbuild-from-visual-studio/?
- Something else ...?
I'm coming from the unix world, so feel free to send me newbie pointers.