如何使用命令提示符MSBuild?

Nas*_*loo 21 c# msbuild publish visual-studio-2008 web

我有一个网站(不是MSBuild,它是一个Use Fixed naming and single page assemblies),我想从中发布它MSBuild.

我想将它发布在同一个目录中(每晚),我不想使用像TeamCity,TFS或第三方工具(如Nant)这样的Build Automation工具.

应该这样做Use Fixed naming and single page assemblies.

我怎样才能做到这一点?

更新:在发布窗口中,唯一应该检查的选项是MSBuild

小智 21

从您的评论中,您的Web项目是一个Web站点项目,而不是Web应用程序项目.

在这种情况下,"发布"目标不能作为选项,但"AspNetCompiler"是解决方案.

创建一个包含以下内容的xml文件,并从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>
Run Code Online (Sandbox Code Playgroud)

此处可以参考此任务,您可以配置所有取消/检查选项.

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

然后从MSBuild而不是解决方案文件中调用此文件.

MSBuild your.xml /p:Configuration=<Debug/Release>
Run Code Online (Sandbox Code Playgroud)

只要您的类库被您的网站项目引用,它们就会一起构建.


yav*_*vuz 6

MSBuild.exe **MYPROJ**.sln 
/p:outdir="Z:\output\\",OutputPath="Z:\output\\",webprojectoutputdir="Z:\output\\",configuration=RELEASE 
/t:Clean;Build 

/flp1:logfile=Z:\output\\\Log_msbuild.log;verbosity=detailed 
/flp2:logfile=Z:\output\\\Log_warnings.log;warningsonly;verbosity=detailed 
/flp3:logfile=Z:\output\\\Log_errors.log;errorsonly;verbosity=detailed 

/nologo 
/noconlog
Run Code Online (Sandbox Code Playgroud)

İt可以编译所有类型的项目(Web,Web服务,桌面,..),它可以创建日志文件(构建日志,错误和警告).