I would strongly recommend using Continuous Integration.
We use a combination of TeamCity for CI, Rake and Albacore for automating the build.
TeamCity will check the code out of your source code repository, then, using Rake, build the application, execute unit tests and even run your database scripts if you so desire. After a successful build you can package your source code in a zip file or copy it to a destination of your choice.
We use Git, although TeamCity works with all source control systems.
Using TeamCity and Rake would be similar to using CruiseControl and NANT, without the XML file editing. Of course, you can use TeamCity with NANT if you prefer.
A short sample pulled from a rakefile.rb which performs the build. IMHO, easier to read and debug than an XML file.
require 'albacore'
require 'rexml/document'
require 'find'
VERSION_NO = "1.0"
OUTPUT_PATH = "output"
WEBOUTPUT_PATH = "output/web"
ADMINOUTPUT_PATH = "output/admin"
CONFIG = "Release"
WEB_PATH = "app/Company.Website.Web"
ADMIN_PATH = "app/Company.Website.Admin"
PACKAGE_PATH = "build/package"
DB_SCRIPT_PATH = "Company.Website.DB"
SOLUTION = "Company.Website.sln"
ARTIFACTS_PATH = "d:/build/artifacts/"
DEPLOY_WEB_PATH = "d:/deploy/company/website/"
DEPLOY_ADMIN_PATH = "d:/deploy/company/admin/"
task :default => ['setuptest','assemblyinfo','config','msbuild','createdb','sqlcmd','deploy']
task :setuptest do |setup|
if ENV['BuildNumber'].nil? then ENV['BuildNumber'] = "000" end
VERSION_NO = VERSION_NO + '.' + ENV['BuildNumber']
puts 'Version Number : ' + VERSION_NO
ZIPFILE_WEB = 'Company.Website.Web.' + VERSION_NO
ZIPFILE_ADMIN = 'Company.Website.Admin.' + VERSION_NO
DB_SERVER = "WEB2"
DB_DATABASE = "Website"
CREATEDB_SCRIPT = "app/Company.Website.DB/00CreateDatabaseTEST.sql"
end
assemblyinfotask do |asm|
asm.version = VERSION_NO
asm.company_name = "Company Name"
asm.copyright = "Copyright 2010"
asm.output_file = "CommonAssemblyInfo.cs"
end
task :config do
FileUtils.cp 'NHibernate.test.config', 'NHibernate.config'
end
msbuildtask do |msb|
msb.properties = { :configuration => :Debug }
msb.targets [:Clean, :Build]
msb.solution = "Company.Website.sln"
end
sqlcmdtask :createdb do |sql|
puts "executing sql scripts..."
sql.log_level = :verbose
sql.path_to_command = "sqlcmd.exe"
sql.server = DB_SERVER
sql.database = "master"
sql.scripts << CREATEDB_SCRIPT
end
sqlcmdtask do |sql|
puts "executing sql scripts..."
sql.log_level = :verbose
sql.path_to_command = "sqlcmd.exe"
sql.server = DB_SERVER
sql.database = DB_DATABASE
sql.scripts << "app/Company.Website.DB/01CreateTables.sql"
sql.scripts << "app/Company.Website.DB/02InsertReferenceData.sql"
end
task :deployprep do
FileUtils.remove_dir 'app/Company.Website.Web/obj'
FileUtils.remove_dir 'app/Company.Website.Admin/obj'
end
ziptask :zipweb do |zip|
puts "creating zip package in " + ZIPFILE_WEB
zip.directories_to_zip = ["app/Company.Website.Web"]
zip.output_file = ZIPFILE_WEB + '.zip'
zip.output_path = File.dirname(__FILE__)
end
ziptask :zipadmin do |zip|
puts "creating zip package in " + ZIPFILE_ADMIN
zip.directories_to_zip = ["app/Company.Website.Admin"]
zip.output_file = ZIPFILE_ADMIN + '.zip'
zip.output_path = File.dirname(__FILE__)
end
Albacore is suite of Rake tasks specifically build for deploying .NET application.
The newly announced Azure VM role does allow you deploy a Windows VM configured anyway you like and you can RDP to this, so in that respect yes you could do this.
However, Azure vm's do have some difference to ordinary Hyper-V or VMWare VM's. You can't just spawn a new VM in Azure, RDP into it and configure it the way you want. Instead with Azure you create your VM on you own Hyper-V server and configure it how you want, then you configure a Golden Image that you upload to Azure and get's deployed to your VM. At any point Azure can shutdown your VM and create a new one from your golden image. So you need to be in a position where you can create this golden VM how you want locally first.
There is an added complication in that unlike with the Web and Worker role, the VM role is not manager by MS but by you and so you will need to apply any updates patches etc yourself. Again this means you need to not only update your running VM, but your golden image.
Finally you cannot really store any data on your VM, as MS does not guarantee the safety of this data, if your VM gets recreated from you master image, all you get back is what is on the image. Hence you need to store all you data in something like an azure database.
Best Answer
Azure Web Sites don't use the
ServiceDefinition.csdef
, nor do they allow for any type of elevated startup tasks. For that, you'll need to shift to Cloud Services and use a Web Role. And for that, you'll either need to create a Visual Studio project, or use PowerShell to create it independently, without worrying about Visual Studio (see this answer I posted with the relevant PowerShell cmdlets for setting up a project independent of Visual Studio).