I have CruiseControl.NET configured to monitor 10+ .NET projects. All of these projects (web apps, windows services, wcf services, etc...) use shared class library projects so in the ccnet.config I had to set the svn path for each project to the root of the svn repo. If I didn't do it this way then a change to a shared assembly wouldn't trigger projects that depend on it to rebuild.
The issue is that because I've set the svn path for each project to the root of the repo then that means that any change at all triggers a rebuild of every single project, which takes a really long time. How do you get around this issue with using shared assemblies in multiple projects without having every single project rebuild every time a little change is made??
Here's another way to see the issue:
CC Project #1 = svn://repo/WebApps/WebsiteA (references svn://repo/Shared/ClassLibraryA)
CC Project #2 = svn://repo/WebApps/WebsiteB (references svn://repo/Shared/ClassLibraryB)
For CC Project #1, you can't set the svn path to svn://repo/WebApps/WebSiteA, as if you did and ClassLibraryA changed then it wouldn't trigger a build. However if you set the path to svn://repo, then it'll pick up the changes to the ClassLibraryA, but then it'd also trigger CC Project #2.
Any suggestions would be greatly appreciated...
You may want to use the Project Trigger to start a build :
http://confluence.public.thoughtworks.org/display/CCNET/Project+Trigger
If your ClassLibraryA has a project on CruiseControl (whose svnpath is svn://repo/Shared/ClassLibraryA) then your WebsiteA would look like :
<project name="WebSiteA">
<triggers>
<projectTrigger project="ClassLibraryA">
<triggerStatus>Success</triggerStatus>
<innerTrigger name="ClassLibraryA" type="intervalTrigger" seconds="60" buildCondition="ForceBuild" />
</projectTrigger>
<intervalTrigger seconds="300"/>
</triggers>
<cb:svn-block svnpath="repo/WebApps/WebsiteA" />
<tasks>
<...>
</tasks>
<publishers>
<...>
</publishers>
</project>
The answer was to use the sourcecontrol multi block in CruiseControl.NET, which allows you to specify multiple svn paths for each project:
http://ccnet.sourceforge.net/CCNET/Multi%20Source%20Control%20Block.html
Related
I use VS 2012 and Teamcity with Visual Studio Runner type.
My solution has multiple web.config transformation for different environment.
I want to follow continuous delivery, build the solution with multiple packages and using artifacts deploy them to relevant environment when needed without building again.
I don't use MSBuild directly, I use VS package profiles (pubxml)
I would like to have something like this:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>Package</WebPublishMethod>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<DesktopBuildPackageLocation />
<PackageAsSingleFile>true</PackageAsSingleFile>
<DeployIisAppPath/>
<PublishDatabaseSettings/>
</PropertyGroup>
<ItemGroup>
<LastUsedBuildConfiguration Include="UAT" />
<LastUsedBuildConfiguration Include="APCI" />
</ItemGroup> </Project>
Then I expect the result be two folders in obj of artifact each with their own transformed web.config.
Any help?
The only way you can create multiple transformed configurations in a single build is by using the XDT engine directly during your build process. It's been available on NuGet for a while now, so it shouldn't be too much hassle.
Having said that, I've been using msdeploy / publish profiles for about two years now and I've since moved to the following:
Create an msdeploy package using a Package.pubxml and define all your transforms using MSDeploy parameters (which are both more an less powerful than XDT)
Create a PublishProfile.pubxml file (so you can have the Visual Studio experience) but declare all your parameter values in PublishProfile.parameters.xml
Perform any "all environments except debug" transforms in a Web.Release.config to avoid overcomplicating your deploy parameters
Deploy the package on your build server by calling the generated .deploy.cmd (or msdeploy.exe directly)
This setup lets you continue to use Visual Studio to publish if you like but you can also move all the way down to the msdeploy commandline, since the .parameters.xml file is defined using the msdeploy parameter schema.
Web deploy parameters have plenty of "floating" documentation but no real "reference" home. Here's some useful links:
Web Deploy Parameterization
Reference for the Web Application Package
How to: Use Web Deploy Parameters in a Web Deployment Package
I have a solution which builds a number of projects. Some of these projects produce DLLs for redistribution amongst other development teams (for integration). These same DLLs are utilized by our own application and they are primarily modified and updated for the maintenance of this application.
We have run into the problem that unwanted dependencies are sometimes added to the DLLs we provide to third parties. As such, we had created a new configuration within our visual studio solution which only builds the DLLs we provide to third parties. By building this configuration we are able to ensure that our gated-checkin will fail if any new dependencies are added for these projects.
<!-- Build only the Database Access provider DLLs, if a new, unwanted dependency is added, this MsBuild task will fail -->
<Message Text="Build Database Access Providers"/>
<MSBuild Condition="'$(Configuration)'=='Release'" Properties="Configuration=Database Providers Release; Platform=Mixed Platforms" Projects="#(MySolution)" Targets="Build" BuildInParallel="$(BuildInParallel)" />
<!-- ... -->
<!-- Build all the projects in the solution -->
<MSBuild Properties="Configuration=$(Configuration); Platform=Mixed Platforms" Projects="#(MySolution)" Targets="Build" BuildInParallel="$(BuildInParallel)" />
The “Database Providers Release” configuration builds each of the required projects in the project’s “Release” configuration.
Because the first call to MsBuild builds the individual projects in the Release configuration and the full build also builds the individual projects in the Release configuration, we thought that the “Build” target would detect that the build outputs are up to date and would skip rebuilding these projects a 2nd time when we execute the second call to MsBuild. However, the MsBuild script will always rebuild the projects in the second call to the MsBuild task. This is increasing our build time and impacts our build’s code metrics (for instance the number of build warnings increases because the same warnings are reported twice).
If I simply invoke the solution as a whole twice (using the identical build configuration at the solution level), MsBuild will correctly skip all the solution items (I.e. it performs incremental building of the projects). E.g:
<!-- Build all the projects in the solution -->
<MSBuild Properties="Configuration=$(Configuration); Platform=Mixed Platforms" Projects="#(MySolution)" Targets="Build" BuildInParallel="$(BuildInParallel)" />
<!— This 2nd build will skip every project as MsBuild detects the projects have been built. -->
<MSBuild Properties="Configuration=$(Configuration); Platform=Mixed Platforms" Projects="#(MySolution)" Targets="Build" BuildInParallel="$(BuildInParallel)" />
If I run the 2 different build configurations within of Visual Studio directly, it will correctly detect that the various projects have already been built and will skip rebuilding them a 2nd time (I.e. the setup for incremental building of the vcxprojs is correct.)
Is there a way to build 2 solution configurations with MsBuild (where each solution configuration is using the same project configurations) and have MsBuild skip projects which were already built in the first build when they are encountered in the 2nd build?
I'm wondering about this because i'd like to find a way to create a post-build event that is different whether I'm trying to compile and run in the emulator or wheter I'm compiling and publishing to the cloud.
I don't know if there is an easier way, but I thought that If I could find where the current setting (cloud or local) is saved I could branch my post-build event based on that
thx
It is in a variable TargetProfile so you should be able to do something similar to this (which is for after publish, but you get the idea):
<Target Name="AfterPublish">
<ItemGroup Condition="'$(TargetProfile)' == 'Cloud'">
<-- Do you thing here -->
</ItemGroup>
</Target>
We do automated builds using Nant and CruiseControl.net. I'm very green when it comes to the process. While looking into some things, I noticed that for most(all?) of the solutions involved in the automated build process, the bin folders are included in the project. Is this a requirement for automated builds? If the bin folder is excluded, will the folder and any files in it need to be copied to the deployment servers manually?
Thanks.
If you are referring to the /bin/debug/ folder under a project, you should not need those checked into your source control. If you have external libraries (log4net.dll for example) they should be checked into source control along with your code, but in a separate folder (named "ThirdParty" or "DLLs" for example.) When CruiseControl.net runs, it should compile any assemblies that have been modified, and copy output to the /bin/debug/ folder in the same way as VisualStudio copies those files on your box.
It is better to include bin folder in the automated build process, since it contains some external dlls like AjaxControlToolkit along with internal dlls.
We here excluded the Debug folder and user option files(*.suo) from the automated build.
I have set up an automated build server - so far so good. Now I want to sort out dependencies. We have several DLL files that are included in many (unrelated) projects, and I want to set up CruiseControl.NET to first build our DLL files and then "check them in" other projects in SVN, so when they get built, they will always use the last version of DLL files.
Is something like that even possible? Is there a better way to keep dependencies sorted over several projects on many computers?
The way I do this is to have a project in cruise control for the common dll, it uses a source control trigger and builds whenever changes are checked in.
On the dependant project, I have the source control trigger, but also a project trigger so any checkin on the common.dll causes the common.dll to be rebuilt, which in turn triggers a build of the dependant project.