Skip to content

Team city build

I’ve been using this build script using a Nant runner within TeamCity recently. I can add %system.config% parameters to part of the build process including steps. This enables me to create a configurations within VS, and add web.config transforms. Check this into a git repository of the same name, and then do a custom depolyment based on that.
Within Team City, I call this file in two seperate steps. The first is the Build, then second is the deployment. The deployment target is “ftp_%system.config%”. This enables me to add additional steps for Unit testing, integration testing, code checking etc.
<?xml version="1.0" encoding="utf-8"?>
<project default="Build" xmlns="http://nant.sf.net/release/0.90/nant.xsd">
  <target name="Build" description="Compiles/Builds the Solution">
    <echo message="Building..." />
    <msbuild project="Web\Web.csproj" failonerror="true" verbose="false">
      <arg value="/p:Configuration=${config};OutputPath=${config}" />
      <arg value="/p:UseWPP_CopyWebApplication=True" />
      <arg value="/p:PipelineDependsOnBuild=False" />
      <arg value="/p:WebProjectOutputDir=..\Output\${config}\" />
      <arg value="/t:Rebuild" />
      <arg value="/nologo" />
    </msbuild>
    <echo message="Building finished..." />
  </target>
  <target name="ftp_release">
    <echo message="Deploying website" level="Debug" />
    <ftpUpload host="waws-prod-am2-001.ftp.azurewebsites.windows.net" username="" password="" todir="site/wwwroot">
      <fileset basedir="Output\${config}\">
        <include name="**" />
      </fileset>
    </ftpUpload>
    <echo message="Website deployed!" level="Debug" />
  </target>
  <target name="ftp_master">
    <echo message="Deploying website" level="Debug" />
    <ftpUpload host="waws-prod-am2-001.ftp.azurewebsites.windows.net" username="" password="" todir="site/wwwroot">
      <fileset basedir="Output\${config}\”>
        <include name="**" />
      </fileset>
    </ftpUpload>
    <echo message="Website deployed!" level="Debug" />
  </target>
  
</project>

Using SQL server express in azure vm.

Setting up SQL server in an azure VM is easy. Connecting to it is not as obvious as it used to be.

The basic syntax is simple:

thedatabaseserver\mydatabase,port.

e.g. company-azure.cloudapp.net\SQLEXPRESS,1433

Getting the SQL  working within a vm needs a little work.

Within the SQL Configuration Manager (powershell -> “start SQLServerManager10″)

SQL Server Network COnfiguration -> Protocols for SQLEXPRESS -> Make sure that TCP/IP is enabled

Then double click on  TCP/IP, and switch to the IP Addresses tab
IP2
Active Yes
Enabled No
IPAddrss 10.xxx.xxx.xxx (not the public ip address)
TCP Dynamic Ports 0
TCP Port {blank}
IPAll
TCP Dynamic Ports {Blank}
TCP Port 1433

Thanks for all the people who did the hard work in the following posts for making this easy.

http://www.windowsazure.com/en-us/manage/windows/common-tasks/install-sql-server/#TCP

http://stackoverflow.com/questions/11278114/enable-remote-connections-for-sql-server-express-2012

http://msdn.microsoft.com/en-us/library/ms177440.aspx

http://rediantosatya.wordpress.com/2012/01/12/how-to-connect-to-a-non-standard-tcpip-port-from-sql-server-management-studio/

 

 

 

Windows 2012 – Azure

A couple of quick things to note here:

From the desktop, press Ctrl + Esc (or the windows key) to bring up the “metro” interface.

To get to IE, type a web address in explorer, or open the metro interface, and click on the IE icon.

If you want to download something, then you need to change the  ”IE Enhanced Security Configuration” settings on the dashboard.

To open the windows firewall, open server manager, then look at tools -> Windows Firewall with advanced security. Or in powershell type “start firewall”.

To get to environmental variable: Open Explorer -> Right click on “Computer”, and select properties -> Select Advanced system settings. Though to list them you can just open powershell, and type “gci env:”

To start iis manager. In powershell type “start inetmgr”.

 

 

 

Git branching

This article really explains some concepts around git branching…

http://nvie.com/posts/a-successful-git-branching-model/

Read it – you’ll end up understanding the concept of fast-forwarding…. “–no-ff”.  

 

 

Testing webpage on Android

I was asked how to test a web page on Android a little while ago. The user was trying to build a webpage on a windows machine, and view it from within the android emulator. 

He didn’t have IIS installed, so the easiest way was to install the free version of visual studio web edition.  Create a website, and then run it. 

The browser will open with an address in the format of:

http://localhost:12345

Note the port (12345). 

Goto the android emulator, and open the browser, then type in:

http://10.0.2.2:12345

All should work fine. The 10.0.2.2 is like going to the hosting localhost.

 

 

 

Umbraco

Having played with umbraco 5 for a bit, the decision has been made that we’ll use umbraco4.7 in this project, due to SQL 2008 minimum requirements. Its a shame as I was really hoping to use the MVC side, but never mind.

I found a nice article about setting up umbraco within visual studio this morning:

http://aaron-powell.com/how-i-developer-umbraco

Umbraco 5

Just started using this for an internal project.

Its mostly going well, but there are a few things that are harder than they should be. One was trying to get a link working….

@foreach(var child in @DynamicModel.Children)
{
var pdfURL = Umbraco.GetMediaUrl(child.pdf, “uploadedFile”);

<h1>linkText </h1>
<a href=”@pdfURL”>@child.linkText</a>
}

There are some really useful links in Warren Buckley’s git repo at:

https://gist.github.com/warrenbuckley (click on the “gist” to see the content).

Follow

Get every new post delivered to your Inbox.