从命令行bat文件发布ASP.NET网站,最终的.bat文件 [英] Publish ASP.NET web site from command-line bat file, the ultimate .bat file

查看:355
本文介绍了从命令行bat文件发布ASP.NET网站,最终的.bat文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里有很多关于如何从命令行发布ASP.NET网站的问题(包括我自己的 here ),但没有一个让我得到我想要的解决方案:




  • 我指定的单个输出文件夹

  • 应用的Web.config转换



    • 我越来越接近有用的东西,但仍然有几个问题。

      这是我到目前为止: / p>

        SET TEMP_PATH = c:\_MyProject\ 
      SET DEST_PATH =%TEMP_PATH%_Output\
      SET CSPROJ_PATH = .\MyProject\MyProject.csproj
      SET CONFIGURATION = Release
      SET LOG_FILE = MyProjectDeploy.log

      C:\Windows\Microsoft.NET\ Framework\v4.0.30319\MSBuild.exe ^
      %CSPROJ_PATH%^
      / p:配置=%CONFIGURATION%; Depl oyOnBuild = True; PackageAsSingleFile = False; AutoParameterizationWebConfigConnectionStrings = False ^
      / property:OutDir =%TEMP_PATH%^
      / property:WebProjectOutputDir =%DEST_PATH%^
      /l:FileLogger,Microsoft.Build .Engine; logfile =%LOG_FILE%

      但我的脚本仍然存在以下问题:




      • 具有应用转换的一个Web.config的版本在文件夹结构内部是深入的: C:\_MyProject\_PublishedWebsites\MyProject_Package \Archive\Content\C_C\<复制我的文件夹结构的长路径> \obj\Release\Package\PackageTemp\ 项目路径的问题是包含在这里,所以它从开发者到开发人员不同。

      • 位于%DEST_PATH%中的版本是我需要的没有Web.config转换


      解决方案

      似乎终极解决方案存在:



      http://stackoverflow.com/a/3452664/118810



      它也适用于解决方案。


      There are a number of questions here on SO about how to publish ASP.NET web site from command-line (including my own here), but none of them get me to the solution I want:

      • Single output folder as I specified
      • Applied Web.config transformations

      I'm getting close to something that works for me, but there are still a couple of issues.
      Here is what I have so far:

      SET TEMP_PATH=c:\_MyProject\
      SET DEST_PATH=%TEMP_PATH%_Output\
      SET CSPROJ_PATH=.\MyProject\MyProject.csproj
      SET CONFIGURATION=Release
      SET LOG_FILE=MyProjectDeploy.log
      
      C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe ^
      %CSPROJ_PATH% ^
      /p:Configuration=%CONFIGURATION%;DeployOnBuild=True;PackageAsSingleFile=False;AutoParameterizationWebConfigConnectionStrings=False ^
      /property:OutDir=%TEMP_PATH% ^
      /property:WebProjectOutputDir=%DEST_PATH% ^
      /l:FileLogger,Microsoft.Build.Engine;logfile=%LOG_FILE%
      

      But my script still has these problems:

      • The version with one Web.config with applied transformation is deep inside folder structure: C:\_MyProject\_PublishedWebsites\MyProject_Package\Archive\Content\C_C\<Long path that replicate my folder structure>\obj\Release\Package\PackageTemp\ The problem that path to the probject is included here, so it cat vary from developer to developer.
      • The version which is located in %DEST_PATH% is what I need but without Web.config transformations

      解决方案

      It seems that ultimate solution exists:

      http://stackoverflow.com/a/3452664/118810

      It works for solutions too.

      这篇关于从命令行bat文件发布ASP.NET网站,最终的.bat文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆