<p>As part of improvements to our build process, we are currently debating whether we should have separate project/solution files on our CI production environment from our local development environments.</p>

<p>The reason this has come about is because of reference problems we experienced in our previous project.  On a frequent basis people would mistakenly add a reference to an assembly in the wrong location, which would mean it would work okay on their local environment, but might break on someone else's or on the build machine.</p>

<p>Also, the reference paths are in the csproj.user files which means these must be committed to source control, so everyone has to share these same settings.</p>

<p>So we are thinking about having separate projects and solutions on our CI server, so that when we do a build it uses these projects rather than local development ones.</p>

<p>It has obvious drawbacks such as an overhead to maintaining these separate files and the associated process that would need to be defined and followed, but it has benefits in that we would be in more control over <em>EXACTLY</em> what happens in the production environment.  </p>

<p>What I haven't been able to find is anything on this subject - can't believe we are the only people to think about this - so all thoughts are welcome.</p>

[{'answer_id': 14682, 'author': 'Vaibhav', 'author_id': 380, 'author_profile': 'https://Stackoverflow.com/users/380', 'pm_score': 0, 'selected': False, 'text': "<p>Usually, you would be creating Build projects/scripts in some form or another for your Production, and so putting together another Solution file doesn't come in the picture.</p>\n\n<p>It would be easier to train everyone to use project references, and create a directory under the project file structure for external assembly references. This way everyone follows the same environment.</p>\n"}, {'answer_id': 15096, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p>I would strongly recommend against this.</p>\n\n<ol>\n<li><p>Reference paths aren\'t only stored in the .user file. A hint path is stored in the project file itself. You should never have to check a .user file into source control.</p></li>\n<li><p>Let there be one set of (okay, possibly versioned) solution/project files which all developers use, and the Release configurations of which are what you\'re ultimately building in production. Having separate project files is going to cause confusion down the road, when some project setting is tweaked, not carried across, and slipped into production.</p></li>\n</ol>\n\n<p>You might also check this out:</p>\n\n<p><a href="http://www.objectsharp.com/cs/blogs/barry/archive/2004/10/29/988.aspx" rel="nofollow noreferrer">http://www.objectsharp.com/cs/blogs/barry/archive/2004/10/29/988.aspx</a>\n<a href="http://bytes.com/forum/thread268546.html" rel="nofollow noreferrer">http://bytes.com/forum/thread268546.html</a></p>\n'}, {'answer_id': 19492, 'author': 'Duncan', 'author_id': 1193, 'author_profile': 'https://Stackoverflow.com/users/1193', 'pm_score': 0, 'selected': False, 'text': '<p>We have changed our project structure (making use of SVN Externals) where each project is now completely self-contained.  That is, any references never go outwith the project directory (for example, if Project A references ASM X, then ASM X exists within a subfolder of ProjectA)</p>\n\n<p>I suspect that this should go some way towards helping solve some of our problems, but I can still see some advantages of having more control over the build projects.  </p>\n'}, {'answer_id': 19498, 'author': 'DavidWhitney', 'author_id': 1297, 'author_profile': 'https://Stackoverflow.com/users/1297', 'pm_score': 1, 'selected': False, 'text': "<p>In our largest project (a system comprising of many applications) we have the following structure</p>\n\n<blockquote>\n  <p>/3rdPartyAssemblies<br/> /App1<br/> /App2<br/> /App3<br/> /.....</p>\n</blockquote>\n\n<p>All external assemblies are added to 3rdPartyAssemblies/Vendor/Version/...</p>\n\n<p>We have a CoreBuild.sln file which acts as an MSBuild script for all of the assemblies that are shared to ensure building in dependancy order (ie, make sure App1.Interfaces is built before App2 as App2 has a reference to App1.Interfaces).</p>\n\n<p>All inter-application references target the /bin folder (we don't use bin/debug and bin/release, just bin, this way the references remain the same and we just change the release configuration depending on the build target).</p>\n\n<p>Cruise Control builds the core solution for any dependencies before building any other app, and because the 3rdPartAssemblies folder is present on the server we ensure developer machines and build server have the same development layout.</p>\n"}, {'answer_id': 19686, 'author': 'Duncan', 'author_id': 1193, 'author_profile': 'https://Stackoverflow.com/users/1193', 'pm_score': 0, 'selected': False, 'text': '<p>@David - believe it or not this is what we actually have just now, and yet it\'s still causing us problems!</p>\n\n<p>We\'re making some changes though, which are forced upon us due to moving to TeamCity and multiple build agents - so we can\'t have references to directories outwith the current project, as I\'ve mentioned in my previous answer.</p>\n\n<p>Look at the Externals section of this link to see what I mean - <a href="http://www.dummzeuch.de/delphi/subversion/english.html" rel="nofollow noreferrer">http://www.dummzeuch.de/delphi/subversion/english.html</a></p>\n'}, {'answer_id': 19693, 'author': 'Shaun Austin', 'author_id': 1120, 'author_profile': 'https://Stackoverflow.com/users/1120', 'pm_score': 1, 'selected': False, 'text': '<p>I know it\'s anachronistic. But the single best way I\'ve found to handle the references issue is to have a folder mapped to a drive letter such as R: and then all projects build into or copy output into that folder also. Then all references are R:\\SomeFile.dll etc. This gets you around the problem that sometimes references are added by absolute path and sometimes they are added relatively. (there\'s something to do with "HintPath" which I can\'t really remember)</p>\n\n<p>The nice thing then, is that you can still use the same solution files on your build server. Which to be honest is an absolute must as you lose the certainty that what is being built on the dev machine is the same as on the build server otherwise.</p>\n'}]
['https://Stackoverflow.com/questions/14674', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1193/']