我们最近将我们的ASP.NET网站升级为Web应用程序,我们对部署它时突然出现的困难感到震惊.考虑到这必须是多么常见的任务,我想知道人们用什么插件/软件来部署快速发展的,远程存储的项目(即网站)?
必须有一个比在Visual Studio中“发布”更好的方法,然后必须手动FTP已更改的文件?尤其是因为当我们上传我们的.DLL时网站出现故障.
有这么多繁琐的文件异常,我必须尽可能地自动化这个过程,以防止意外上传.
使用我们的旧解决方案(在我们的WebSite上),我们使用了Dispatch for ASP,它完全震撼了整个过程,只需单击一下.不幸的是,它并不适合DLL(如前所述).
那么你的团队是如何做到的呢?
谢谢你的建议.
PS – 我已经读过Visual Studio 2010应该在VS2005 / 08中解决这些缺点,但在那之前……
@H_404_14@解决方法
我强烈建议使用持续集成.
我们结合使用TeamCity for CI,Rake和Albacore来实现构建的自动化.
TeamCity将检查源代码存储库中的代码,然后使用Rake构建应用程序,执行单元测试,甚至运行数据库脚本(如果您愿意).成功构建后,您可以将源代码打包为zip文件或将其复制到您选择的目标位置.
我们使用Git,尽管TeamCity适用于所有源代码控制系统.
使用TeamCity和Rake类似于使用CruiseControl和NANT,而不使用XML文件编辑.当然,如果您愿意,可以将TeamCity与NANT一起使用.
从执行构建的rakefile.rb中提取的一个简短示例.恕我直言,比XML文件更容易阅读和调试.
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是一套Rake任务,专门用于部署.NET应用程序.
@H_404_14@ @H_404_14@