VS2010 Web Publish 命令行版文件系统部署
各位,
简而言之,我想复制这个对话框:
这是一个 Visual Studio 2010 ASP.Net MVC 项目。如果执行此命令,我将获得所需的所有文件,包括“C:\ToDeploy”目录中转换后的 web.configs。
我想在命令行上复制它,以便我可以将它用于 QA 环境构建。
我看过有关如何在远程部署的命令行上执行此操作的各种文章,但我只想为文件系统部署执行此操作。
我知道我可以使用 nAnt 任务或 rake 脚本来复制此功能,但我想使用此机制来完成此操作,因此我不会重复自己。
我对此进行了更多调查,并且找到了这些链接,但没有一个能够干净地解决它:
提前致谢!
Folks,
In a nutshell, I want to replicate this dialog:
It's a Visual Studio 2010 ASP.Net MVC project. If I execute this command, I get all the files I want, including the transformed web.configs in the "C:\ToDeploy" directory.
I want to replicate this on the command line so I can use it for a QA environment build.
I've seen various articles on how to do this on the command line for Remote Deploys, but I just want to do it for File System deploys.
I know I could replicate this functionality using nAnt tasks or rake scripts, but I want to do it using this mechanism so I'm not repeating myself.
I've investigated this some more, and I've found these links, but none of them solve it cleanly:
- VS 2008 version, but no Web.Config transforms
- Creates package, but doesn't deploy it..do I need to use MSDeploy on this package?
- Deploys package after creating it above...does the UI really do this 2 step tango?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
好吧,终于弄清楚了。
您需要的命令行是:
您可以通过在 /p: 部分添加
outdir=c:\wherever\
属性来更改项目输出的位置。这将在以下位置创建输出:
然后,您可以使用您想要的任何方法从上述目录复制这些文件。
我已经使用 Albacore 将这一切作为 ruby rake 任务进行工作。我正在努力完成这一切,这样我就可以真正将其作为对项目的贡献。但如果有人想要在此之前的代码,请告诉我。
我发现的另一个问题是它将标记化参数放入 Web.config 中。如果您不需要该功能,请确保添加:
Ok, finally figured this out.
The command line you need is:
You can change where the project outputs to by adding a property of
outdir=c:\wherever\
in the /p: section.This will create the output at:
You can then copy those files from the above directory using whatever method you'd like.
I've got this all working as a ruby rake task using Albacore. I am trying to get it all done so I can actually put it as a contribution to the project. But if anyone wants the code before that, let me know.
Another wrinkle I found was that it was putting in Tokenized Parameters into the Web.config. If you don't need that feature, make sure you add:
我想我应该发布我找到的另一个解决方案,我已经更新了这个解决方案以包含日志文件。
这类似于从命令行发布 Web 应用程序 ,但只是清理并添加了日志文件。另请查看原始来源 http://www.digitallycreated.net/Blog/59/locally-publishing-a-vs2010-asp.net-web-application-using-msbuild
创建一个 MSBuild_publish_site.bat(随意命名) )在 Web 应用程序项目的根目录中
通过在标记下添加以下 xml 来更新 Web 应用程序项目文件 MyWebBasedApp.csproj
比其他解决方案更适合我。
查看以下内容以获取更多信息:
1) http://www.digitallycreated.net/Blog/59/locally-publishing-a-vs2010-asp.net-web-application-using-msbuild
2) 从命令行发布 Web 应用程序
3) 通过命令行构建 Visual Studio 项目
I thought I'd post a another solution that I found, I've updated this solution to include a log file.
This is similar to Publish a Web Application from the Command Line, but just cleaned up and added log file. also check out original source http://www.digitallycreated.net/Blog/59/locally-publishing-a-vs2010-asp.net-web-application-using-msbuild
Create an MSBuild_publish_site.bat (name it whatever) in the root of your web application project
Update your Web Application project file MyWebBasedApp.csproj by adding the following xml under the
<Import Project=
tagthis works better for me than other solutions.
Check out the following for more info:
1) http://www.digitallycreated.net/Blog/59/locally-publishing-a-vs2010-asp.net-web-application-using-msbuild
2) Publish a Web Application from the Command Line
3) Build Visual Studio project through the command line
我的带有 Web.config 转换 的 CCNET 解决方案:
My solution for CCNET with the Web.config transformation:
在 VS2012 及更高版本上,您可以参考现有的 发布配置文件在使用 msbuild 12.0 的项目上,这相当于右键单击并发布...选择发布配置文件(本例中为“MyProfile”):
On VS2012 and above, you can refer to existing publish profiles on your project with msbuild 12.0, this would be equivalent to right-click and publish... selecting a publish profile ("MyProfile" on this example):
我有一个针对 Visual Studio 2012 的解决方案: https://stackoverflow.com/a/15387814/2164198
但是,它可以在没有安装 Visual Studio 的情况下运行! (请参阅更新)。
我还没有检查是否可以从 Visual Studio Express 2012 获取 Web 安装所需的所有内容。
I've got a solution for Visual Studio 2012: https://stackoverflow.com/a/15387814/2164198
However, it works with no Visual Studio installed at all! (see UPDATE).
I didn't checked yet whether one can get all needed stuff from Visual Studio Express 2012 for Web installation.
受 CubanX 启发的完整 msbuild 文件
这会将发布的网站放在 Web..\build\Release 文件夹中
A complete msbuild file with inspiration from CubanX
This places the published website in the Web..\build\Release folder