Cruise Control and Powershell - powershell

this is my first time i am using Cruise Control, so maybe i did not understand it properly. I want to start a large PowerShell script, that builds some VM Images. And it would be really cool, if i could have a look at it via cruise control.
I allready googled the stuff and i found stuff like this: http://qaquestions.wordpress.com/2011/03/18/cruisecontrol-net-powershell-tasks/
but now:
Where exactly do i put these xml statements? I thought, i had to create a new project tag in CC config.xml and specify the script and location. But when i start the queue it says, that powershell is a unknown plugin, but i have CC 2.5+ and PS should be supported since 1.5.
I am just not quite sure, what to do :/

This is the absolute minimum project definition necessary to run a powershell task in Cruise Control .NET. I would assume it is probably fairly similiar in Cruise Control.
<project name="Run some powershell scripts">
<tasks>
<powershell>
<scriptsDirectory>path to scripts folder</scriptsDirectory>
<script>script to run</script>
</powershell>
</tasks>
</project>
Place this project definition in your config file (ccnet.config for Cruise Control .NET)

There are some more articles in blog you mentioned http://qaquestions.wordpress.com/category/ci/cruise-control-net-ci/ For overall reference use documentation http://cruisecontrol.sourceforge.net/main/configxml.html

Related

Can MSBuild binaries be used on their own?

I've been using NAnt for sometime and although it works pretty well most of the time, some functionality is so limited you find yourself doing a page worth of work instead of couple of lines.
My biggest problem is returning results from exec task.. you HAVE to output to file then read the file then in my case substring what you read.
Multiply that by 8 different queries and you have lots of unnecessary work.
Anyway I would like to switch MSBuild which has much better support in this case.
But the problem is that I am using CI + Nant to deploy on staging and sometimes production and Nant is just a directory with files that you copy.
But As far as I know MSBuild must be installed and registered.
Is there such a thing as a standalone MSBuild download?
Thanks
I don't have time today to write up a rough history for MSBuild (I already covered ASP.NET on IIS and C# compilers), but I would tell you that MSBuild is not only standalone today, but open source at GitHub,
https://github.com/microsoft/msbuild
You can download the installers from Microsoft Downloads, or you can compile your own.
Reference: Rough History of MSBuild

Use TeamCity 9 REST API to turn on Versioned Settings

I like to turn on Versioned Settings for my TeamCity projects, so that it commits its configuration in XML to the source control. However now I am seeking to do some automation around project creation leveraging the REST API. However, I can't figure out a way to turn on Versioned Settings via this API. Does anyone know how to do this? Is it supported?
This is not a direct and full answer yet, because it does not use the REST API, but this is an (admittedly hacky) way to accomplished the same thing in an automated way—and perhaps it will lead to a way to do it more properly through the API. Turns out that the file which stores this configuration is config\projects\<project-id>\pluginData\plugin-settings.xml under the TeamCity Data Directory. The documentation, under the section on Direct Modifications of Configuration Files says,
The files under the config directory can be edited manually (unless explicitly noted). The changes will be taken into account without the server restart. TeamCity monitors these files for changes and rereads them automatically when modifications or new files are detected. Bear in mind that it is easy to break the physical or logical structure of these files, so edit them with extreme caution. Always back up your data before making any changes.
Please note that the format of the files can change with newer TeamCity versions, so the files updating procedure might need adjustments after an upgrade.
I found that if I write this XML to said configuration file
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<versionedSettings rootId="Bitbucket" enabled="true" showChanges="true" buildSettings="PREFER_VCS" />
</settings>
then it not only registered the setting, but actually went ahead and did the initial commit of the settings. That's a win, though I still wish I could do it through a more stable API. Note: this XML will be different depending on the precise setup of your version settings—this represents my preferred configuration.
If anyone knows how to take this to the next level by doing it through the API I would still appreciate it.
If it is an option to upgrade to TeamCity 10 (which it is for me), it appears that TeamCity 10 supports this though the REST API! I will confirm that it solved what I needed after doing the upgrade.

How can I deploy an upgrade of my product which contains a file with version lower than the already deployed file?

I have a msi component which deploys a file MyFile.dll. I have a test machine in which my product already deployed MyFile.dll, which has version 09.99.99.99.
Now I'm writing a major upgrade which will deploy a new version of MyFile.dll with version 05.23.76.123. After execution on the test machine, MyFilee.dll is removed... I need to change or repair to correctly deploy it.
How can I force the deployment of MyFile.dll regardless of its injected version number?
PS: This is happening on our test machines only. The product we delivered to our users has files with version numbers consistent with release history.
There are several ways in Windows Installer to do this but they all have their complications. IMO I would just rebuild the same source code as the old DLL but with a newer higher version and keep it simple.
This is perfectly possible. As said here, you may specify the REINSTALLMODE property and set it to "amus" or "dmus" depending on whether you want to always overwrite files or simply overwrite files with different version:
<Wix ...>
<Product ...>
<Property Id="REINSTALLMODE" Value="amus" />
Note that you'll get this warning when compiling your installer though:
warning LGHT1076: ICE40: REINSTALLMODE is defined in the Property table. This may cause difficulties.
Downgrading a file isn't really straightforward and has issues. As pointed out earlier, you can change the component GUIDs and get this to work. However, it really depends on where your RemoveExistingProducts is sequenced. If its sequenced at a point where the older product is removed and the newer product is installed, then it might work.
There is not really a straight forward and documented way. All the available options are just hacks.
Is this just for your test environment?
If yes, then you could use REINSTALLMODE="amus" in the property table and achieve what you are looking to.
However, this is just for your testing and is not advised to be suggested to your end users.
Regards,
Kiran Hegde

Deploy website to drop folder on TFS build server

I am using TFS 2012 on a build server to do continuous integration, and also builds for other environments. I am deploying a .net 4.0 webforms solution containing two websites and a console app to a build server and in the drop folder I get a _PublishedWebsites folder containing the deployment package for the custom configuration I have specified (ie not Debug or Release). I get the correct .Web_Package for each website.
I am using the MSBuildArgumments setting in the build process as follows:
/p:DeployOnBuild=true /p:PublishProfile=Development/p:VisualStudioVersion=10.0
Everything works well, but the team lead wants the actual deployment in the drop-folder and not the deployment package.
I have looked at the MS Documentation but it does not appear to help in my case.
I have tried creating a script, but I dont want to go into a huge series of powershell scripts, and I struggle with powershell anyway. I just cant get it to do what I want.
My question is: can this be done, and what is the best way of doing it? If it does mean creating a script then so be it ( perhaps one line for each object) - I am really having a hard time working out which direction I should be going in.
I thought something a script containing one line for each deployment -3 lines like this:
_PublishedWebsites/<project name>.Web_Package/<project name>.deploy.cmd /T: /M:<site> /U:<user> /P:<password>
But where to put the script and how to call?
I ended up using the solution as described in this blog post:
http://blog.degree.no/2012/03/automatic-config-transformations/
To get what I needed, I needed to change the project files of the projects to be deployed - adding this extra node at the top of each.csproj file
<Target Name="TransformConfigFiles" AfterTargets="AfterBuild" Condition="'$(TransformConfigFiles)'=='true'">
<ItemGroup>
<DeleteAfterBuild Include="$(WebProjectOutputDir)\Web.*.config" />
</ItemGroup>
<TransformXml Source="Web.config" Transform="$(ProjectConfigTransformFileName)" Destination="$(WebProjectOutputDir)\Web.config" />
<Delete Files="#(DeleteAfterBuild)" />
</Target>
and adding this switch to the MSBuildArguments in the build definition:
/p:TransformConfigFiles=true
When I run my builds using the DeployOnBuild switch, my builds output two folders, one with the Package, and one with just all the website files (both under PublishedWebsites). Is that not what you want?
I have:
BuildDrop_PublishedWebsites\Website
BuildDrop_PublishedWebsites\Website_Package

Is there a system that I can use to update my projects on my VPS?

Hey guys, So I recently got a VPS, just so I can start gaining experience. But I'm looking for a service/program where I can code on my PC, then when I'm done, I run a script or do a command or something to have it updated to my VPS.
I thought I was looking for Git, but apparently git does not do what I'm looking for.
Any suggestions?
Windows or Linux?
On Windows, there's a host of tools.
First of all you code. Visual Studio is the most common. You get a sln-file and a batch of *.*proj-files.
When talking about deploying to remote servers, often a continuous integration server is used. We are using TeamCity (http://www.jetbrains.com/teamcity/). Download it locally, install and create a new project, selecting the "SLN-runner". Point it to the sln file of yours.
When you want the deployment part working, create a small build file such as "MyProj.build", that contains something along the lines of
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="BuildProject"
InitialTargets="CheckRequiredProperties"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
ToolsVersion="4.0">
<Target Name="BuildProject">
<Message Text="Starting $(Configuration) build. Web site publish location $(OutputWebSite)" />
<MSBuild Projects="$(SolutionPath)"
Targets="Build"
Properties="BuildOutputPath=$(BuildOutputPath);
BuildOutputPathBin=$(BuildOutputPathBin);
Configuration=$(Configuration);
BuildConstants=$(BuildConstants);
MSBuildTargets=$(MSBuildTargets);
TargetFrameworkVersion=$(TargetFrameworkVersion);
TargetFrameworkProfile=$(TargetFrameworkProfile)">
...
Where SolutionPath points to your sln-file.
You will then update the TeamCity config to point to MyProj.build instead, using the MsBuild runner.
Then you need a way of having TeamCity upload everything to your server. Powershell is a nice scripting environment that can run .Net code, but you'd be invoking it through MsBuild...
Something like this
http://community.bartdesmet.net/blogs/bart/archive/2008/02/16/invoking-powershell-scripts-from-msbuild.aspx
And then you can script with MsDeploy accross to your server:
http://blogs.iis.net/jamescoo/archive/2008/08/21/using-msdeploy-in-powershell.aspx
"rsync" or "scp" tools may be useful