开发者

Building a ASP.NET solution from command-line?

How can I build an ASP.NET web application from the command li开发者_如何转开发ne?


Try this in a .bat file, replace v4.0.30319 with the appropriate version:

CD C:\Windows\Microsoft.NET\Framework\v4.0.30319 
msbuild "C:\inetpub\wwwroot\MyWebSite.sln"


Take a look at the devenv.exe /Build switch, you give it a solution file to build, e.g.

devenv.exe "C:\Documents and Settings\someuser\MySolution.sln" /build DEBUG

If you have more complex build requirements then look into MSBuild.


This is a round about way to do it, but you can use the MSBuild task as part of an msbuild project:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<ItemGroup>
  <Solutions Include="*.sln" />
</ItemGroup>

<Target Name="Build"   >
  <MSBuild BuildInParallel="true" Projects="@(Solutions)" RebaseOutputs="true"  />
</Target>

built with msbuildprojectname.proj from the command line.

This may seem like overkill, but you can then add extra stuff into the project (like restarting websites, zipping files, Virtual machine control even!, code coverage) that can help you setup and test the project.


As dumb as I might look, I have used "aspnet_compiler.exe" for compiling/deploying projects


http://social.msdn.microsoft.com/Forums/en-US/msbuild/thread/2ca80dfd-b7d7-4e09-98ff-891b1570f4db


To build a solution directly,

msbuild mysolution.sln

You'll find MSBuild in the Microsoft.NET folder in your Windows directory.

You may also want to pre-compile your Web site. Instructions for that are on MSDN here. If you use the Web Deployment project node (detailed at the bottom) then the deployment will happen automatically when you run msbuild on the solution file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜