Deployment according to environment and user privileges through TFS CI - version-control

I have trying to implement CI for my desktop .NET application. But I am stuck at how to implement some stuff.
According to the requirements, I need to implement a filter while releasing the build according to user privileges and also filter the funtionalities that need not be installed on production.
I used to do this manually using a manifest.xml but now it seems a bit tidious to implement the same through TFS without using the Manifest.
My manifest looks like this:
<?xml version="1.0" encoding="Windows-1252"?>
<Manifest UpdaterVersion="3.33.7.717">
<f t="DLL" v="0.86.5.0" p="Module1.dll" />
<f t="DLL" v="1.26.2.123" d="true" x="true" p="File\Module2.dll" />
In this example "d" is for dll not be installed on production and "x" is for power user only.
Can anyone help me find a solution for this?

Related

IBM Notes: Eclipse Plugin deployment to framework directory

I am not totally sure, if this question is in the right forum here, but as it is about a development environment and deploying developments I think it is save to ask.
I have a plugin for the IBM Notes client that I need to install silently in the background.
I used "CustomizeAddon.exe" to create a package and created an install.addon.xml with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<ibm-portal-composite>
<domain-object name="com.ibm.rcp.installmanifest">
<object-data>
<install>
<installfeature id="Jabber4Notes" required="true">
<requirements>
<feature id="com.endava.jabber4notes.feature"
version="2.11.8.298" match="compatible"
shared="true" mergeaction="add"
url="jar:${installer.root}/updateSite.zip!/" />
<feature id="com.endava.jabber4notes.IMPFragmentFeature"
version="2.11.8.298" match="compatible"
shared="true" mergeaction="add"
url="jar:${installer.root}/updateSite.zip!/" />
</requirements>
</installfeature>
</install>
</object-data>
</domain-object>
</ibm-portal-composite>
But although I use the parameter shared="true" the plugin always installs to the workspace directory instead of the feature- directory.
How can I change this behaviour?
Make sure to have write permissions on the shared site.
If that's not the problem try to use colocation affinity to specify that the deployment site should be the same of another plugin; com.ibm.rcp.site.anchor.shared.feature is always installed on the shared site so you could add this:
colocation-affinity="com.ibm.rcp.site.anchor.shared.feature"
Here you can find more information regarding this topic: LINK

Create build configuration from existing template in TeamCity using REST API

I'm trying to create build configuration for a project in TeamCity 8.0 using REST API. However instead of creating a new configuration I want to copy from an existing build configuration template. Basically, I'm looking to implement before option present in TeamCity web interface:
TeamCity REST API documentation is not extensive and it does not provide any details about how to create build configuration using existing template via REST API. Any input on how this can be done using REST API ?
I believe TC 8.x and TC 9.x REST APIs are pretty similar. This example was written for TC 9.x.
I don't know if you have sorted this out, but (for the record) you have to do what the "Create a new build configuration with all settings" says. Basically, you have to create an XML with a format like this:
<buildType id="YourBuildID" name="YourBuildName" projectId="TheProjectIDThatOwnsThis" >
<project id="TheProjectIDThatOwnsThis" name="TheProjectName" parentProjectId="TheProjectParent" href="TheProjectHREFValue" webUrl="TheWebURLOfTheProejct"
/>
<template id="TemplateID" name="TemplateName" templateFlag="true" projectName="ProjectThatHasTheTemplate" projectId="ProjectThatHasTheTemplate" href="TemplateHRef" />
<vcs-root-entries>
<!--vcs-root-entry elements are not necessary-->
</vcs-root-entries>
<settings>
</settings>
<parameters>
</parameters>
<steps>
</steps>
<features>
</features>
<triggers>
</triggers>
<snapshot-dependencies/>
<artifact-dependencies/>
<agent-requirements/>
<builds href="BuildConfigurationHREF" />
</buildType>
And do a POST to this URL: http://TCServerName:Port/httpAuth/app/rest/buildTypes
That is the XML expected by TeamCity, so it's up to you in which programming language you will create it. I have done this with C#/LINQ to XML and worked just fine.
Hope this helps.

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

Azure Cloud Deploy Keeps Recycling

I get the following error:
Recycling (Waiting for role to start... Sites are being deployed.
[2012-12-17T05:30:10Z])
Running One or more role instance is unhealthy. 1 Instance: 1
Unhealthy
i was actually trying to convert my web application to a cloud applicaton.
here is what i did:
i added a cloud project to my solutions,
i added a webrole which linked to my web app
i created an sql azure database and copied my whole structure and also the data to the db
i inserted the connection string in my webconfig and tried to run it on emulation, this worked fine
then tried to deploy it by creating a cloud service, running the builder to create the packages and uploading the packages in "staging" mode. this is where i got the errors.
i tried to create an empty cloud app and add a default webrole and load this to the cloud, this worked fine. so i figured, maybe i have something wrong in my settings of my webrole.
I checked the difference between both and i noticed that in both solutions diagnostics was enabled but the storage account was empty in my own solution, so i inserted "UseDevelopmentStorage=true" here. this didn't change anything tho. I also saw a difference in the "packages.config"
default role had:
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="1.7.0.0" targetFramework="net40" />
<package id="System.Web.Providers" version="1.1" targetFramework="net40" />
<package id="System.Web.Providers.Core" version="1.0" targetFramework="net40" />
<package id="WindowsAzure.Storage" version="1.7.0.0" targetFramework="net40" />
mine had:
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="1.7.0.0" targetFramework="net35" />
<package id="WindowsAzure.Storage" version="1.7.0.0" targetFramework="net35" />
i tried changing in this and uploading, didn't do anything
I am not using a worker role, i have only 1 running instance (same as default)
my application uses some authentication in global.asax where it tries to read from User.Identity.Name and compare with a user in the database (this user is inserted in the sql azure db). At first I thought this would maybe be the cause of the problem, but even if i comment out this code the application will not run on the cloud.
VM size is small, trust level = Full trust
I also saw some differences in the settings where i had remote access parameters. I tried removing all these just to exclude issues
i read something about settings references to "copy local is true", but im not sure if this will do any difference.
Any ideas because I don't really know what to do anymore
EDIT:
I modified all the references to "copy local is true" and i disabled to diagnostics just to be sure there's nothing wrong with it.
but now i get the error:
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Funny thing is, in my webconfig this is already set... And I can only find 1 webconfig.
I'm not quite sure what I'm doing wrong
"Keep recycling" almost always means that there are some exception occurred when your application was started. You might not be able to see any errors or exceptions in through the Diagnostics Montor since your exception might be occurred before you configured and started the diagnostics.
I recommend you enable the IntelliTrace option when deployment. It's very easy to do if you are using Visual Studio. Then you can retrieve the IntelliTrace result through Visual Studio and figure out what exception occurred. I strongly considered there are some references missed on azure that you need to set Copy Local = true. But you need IntelliTrace to find them.
The problem was that I had some referenced projects that had an app.config file with a string to a local database

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