如何使用的MSBuild带命令提示符? [英] How to use MSBuild with command Prompt?

查看:294
本文介绍了如何使用的MSBuild带命令提示符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站(不是 Web应用程序,它是一个网​​站 ),我想从 命令提示符下发布它

I have a website (not a web application, it is a website) and I want to Publish it from the command prompt.

我要发布在同一目录下(每天晚上),我不希望使用自动化构建工具,如TeamCity的,TFS,或第三方工具,如南特。

I want to publish it in the same directory (every night) and I don't want to use Build Automation tools like TeamCity, TFS, or 3rd party tools like Nant.

它不应该可以用做 的MSBuild

It should be done with MSBuild.

我怎样才能做到这一点?

How can I do this?

更新:在发布窗口应检查是使用固定命名和单页组件的唯一选择

Update : in publish window the only option that should be checked is Use Fixed naming and single page assemblies

推荐答案

从您的意见,您的Web项目是一个网站项目,而不是一个Web应用程序项目。

From your comment, your web project is a web site project and not a web application project.

在这种情况下,发布的目标不可能是选择,而是'AspNetCompiler'是解决方案。

In this case, 'Publish' target can not be the option but 'AspNetCompiler' is the solution.

创建一个XML文件。下面的内容,并从的MSBuild调用它

Create an xml file with below content and call it from MSBuild.

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <Target Name="PrecompileWeb">
        <AspNetCompiler
            VirtualPath="/MyWebSite"
            PhysicalPath="c:\inetpub\wwwroot\MyWebSite\"
            TargetPath="c:\precompiledweb\MyWebSite\"
            Force="true"
            Debug="true"
            FixedNames="True"
        />
    </Target>
</Project>



引用这个任务的这里,你可以配置你的所有联合国/检查选项。

Reference to this task is here and you can configure all your un/check options.

FixedName =真等于使用固定命名和单页...选项的检查。

FixedName="True" equals the checking of 'use fixed naming and single page...' option.

然后你的MSBuild调用这个文件,而不是解决方案文件。

Then you call this file from MSBuild instead of the solution file.

MSBuild your.xml /p:Configuration=<Debug/Release>



只要你的类库被你的网站项目中引用,他们会建立起来。

As long as your class libraries are referenced by your web site project, they'll be built together.

这篇关于如何使用的MSBuild带命令提示符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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