如何使用批处理文件从命令提示符重建应用程序(2012)? [英] How to Rebuild Application (2012) from Command Prompt using batch File ?

查看:81
本文介绍了如何使用批处理文件从命令提示符重建应用程序(2012)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试关注,但它没有重建项目。我想清理解决方案并使用批处理文件重建它。如果有任何想法请分享。



I'm trying following but it not rebuild the project. I want to clean solution and rebuild it using batch file. If any one have idea please share.

rd .\BuildResults /S /Q
md .\BuildResults

setlocal enableextensions
set name=%DATE:/=_%
mkdir C:\BuildProject\bash\%name%\DialerRegistration

REM set msBuildDir=%WINDIR%\Microsoft.NET\Framework\v3.5
set msBuildDir=%WINDIR%\Microsoft.NET\Framework\v4.0.30319
call %msBuildDir%\msbuild.exe  E:/DialerTFS/PredictiveDialer/DialerRegistration/DialerRegistration/DialerRegistration.csproj /p:Configuration=Debug /l:FileLogger,Microsoft.Build.Engine;logfile=C:\BuildProject\bash\%name%\DialerRegistration/Compile_Log.log

推荐答案

如果你想与之合作解决方案,使用解决方案文件。不要使用call来运行应用程序。



为了给你这个想法,我将向你展示我常用的.NET v.3.5批处理文件:



If you want to work with solution, work with a solution file. Don't use "call" to run the application.

To give you the idea, I'll show you my usual batch file for .NET v.3.5:

::modify this path to use appropriate version of MSBuild:

set tool=%windir%\Microsoft.NET\Framework\v3.5\MSBuild.exe
set solution=MySolution.sln

%tool% %solution% /p:Configuration=Debug
%tool% %solution% /p:Configuration=Release



此批次将使用具有两种不同配置的默认目标构建解决方案。您还可以使用不同的目标,例如清理。这足以查看MSBuild.EXE命令行文档:

http:/ /msdn.microsoft.com/en-us/library/ms164311.aspx [ ^ ]。



您需要添加命令参数/ target,例如/ target :清理,或在一次运行中使用更多目标:/ target:Clean; Build。



-SA


This batch will build the solution with the default target with two different configurations. You can also use different targets, such as "clean". It's enough to look at the MSBuild.EXE command line documentation:
http://msdn.microsoft.com/en-us/library/ms164311.aspx[^].

You would need to add the command parameter "/target", for example, "/target:Clean", or use more targets in one run: "/target:Clean;Build".

—SA


这篇关于如何使用批处理文件从命令提示符重建应用程序(2012)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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