CruiseControl.net , SVN, web site and dependencies
I have an Asp.Net web site (there is no .csproj file).
This web site's source code is controlled by SVN.
I excluded the bin folder from the source control.
All the external assemblies are referenced from the DLL folder which is at the root of my SVN.
I try to deploy this website with cruisecontrol.net.
The problem :
Cruise control load all the files from subversion, it runs msbuild.exe against the .sln file. This results in an error : can't find the external assemblies (because the bin folder is excluded).
The solution I found so far :
Before my msbuild task , do a robocopy of the dll from my source control to the /bin folder.
Is there any other solution ? (I don't want to edit my configuration every time 开发者_JS百科I add an external assembly to my project).
EDIT :
I finally used the "refresh file" technique here is the program I used to create them
class Program
{
private const string PATH_BIN = @"F:\WebSite\bin\";
private const string PATH_REFERENCE = @"C:\DLL\";
static void Main(string[] args)
{
foreach (string aFile in Directory.GetFiles(PATH_BIN))
{
if(!aFile.EndsWith(".dll"))
continue;
string pathRefreshFile = aFile + ".refresh";
if(File.Exists(pathRefreshFile))
continue;
string referenceFilePath = PATH_REFERENCE+Path.GetFileName(aFile);
if (!File.Exists(referenceFilePath))
continue;
using (StreamWriter sw = new StreamWriter(pathRefreshFile))
{
sw.Write(referenceFilePath);
}
}
}
}
I'm assuming that you have .dll files that are third party, rather than ones created by class library projects that you could just include in your solution and add as a project reference. We have a similar scenario with items like the Microsoft Anti-Xss library and other common third party .dlls that we reference in almost all our web apps.
Instead of excluding the \bin directory, exclude *.dll. This way, when you add a reference to the .dll, Visual Studio will add the .dll to the \bin directory AND a .dll.refresh file to the \bin directory.
That.Refresh file tells Visual Studio where to grab the .dll file from. As long as the original .dll is in that location then you should be able to build on the build server OR on a brand new developer's PC.
For example, we have a \shared\commonDlls directory in source control, where the .dlls are checked into source control.
All of our other apps reference these when needed. As long as these are checked in, when the build server builds your project, it will know to go tot he \shared\commonDlls directory to copy that dll in.
This enables us to have one master source for the .dll files so that we don't have to copy it into a few dozen different web apps when it's time to upgrade. We put it into our shared\commonDlls directory (overwriting the original), check it in, and all of our web apps are now using the latest version.
edit - added - links to answers on related topics that have bearing on this answer:
SVN and binaries
How manage references in SVN/Visual Studio?
Best Practice: Collaborative Environment, Bin Directory, SVN
Edit - added - section from our ccnet.config file pointing to a .sln file
This is probably not needed, but since I mentioned ointing ot the .sln file in my comment below I thought I'd add it.
<msbuild>
<description>DonationRequests</description>
<workingDirectory>D:\dev\svn\trunk\Intranet\DonationRequests</workingDirectory>
<executable>C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</executable>
<projectFile>DonationRequests.sln</projectFile>
<buildArgs>/p:Configuration=Debug /v:diag</buildArgs>
<timeout>900</timeout>
<logger>C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
</msbuild>
精彩评论