ASP.NET Web Application Build Output - How do I in

2019-02-26 02:45发布

When I build my ASP.NET web application I get a .dll file with the code for the website in it (which is great) but the website also needs all the .aspx files and friends, and these need to be placed in the correct directory structure. How can I get this all in one directory as the result of each build? Trying to pick the right files out of the source directory is a pain.

The end result should be xcopy deployable.

Update: I don't want to have to manually use the Publish command which I'm aware of. I want the full set of files required by the application to be the build output - this means I also get the full set of files in one place from running MSBuild.

9条回答
贪生不怕死
2楼-- · 2019-02-26 03:02

It depends on how complicated solution you need, you could just use a script and jenkins for example. You can use MSBUild with Jenkins for just deploying to an IIS. And if you got Jenkins other tools is pretty easy to connect into it later on. But if you just want to build, use a script that jenins execute every build that uses MSDeploy and it will work great.

This is how i do it, just to give you a feeling:

Sonarqube uses Gallio, Gendarme, FXcop, Stylecop, NDepths and PartCover to get your metrics and all this is pretty straight forward since SonarQube do this automatically without much configuration.

Here is Jenkins witch builds and get Sonar metrics and a another job for deploying automatically to IIS. I use a simple script one line that calls my MSBuild and wich URL, pass and user.

And Sonarqube, all metrics for my project. This is a simple MVC4 app, but it works great!:

If you want more information can i provide you with a good guide.

This whole setup uses MSBuild, too build and deploy the apps.

查看更多
Anthone
3楼-- · 2019-02-26 03:03

One solution appears to be Web Deployment Projects (WDPs), an add-on for Visual Studio (and msbuild) available that builds a web project to a directory and can optionally merge assemblies and alter the web.config file. The output of building a WDP is all the files necessary to deploy the site in one directory.

More information about Web Deployment Projects:

  1. Announcement on webdevtools MSDN blog for WDP 2008
  2. ScottGu introduction to WDP 2005

The only disadvantage to this solution is the requirement on an add-on which must be available on the build machine. Still, it's good enough for now!

查看更多
迷人小祖宗
4楼-- · 2019-02-26 03:10

ASP.NET doesn't have real xcopy deployment for new sites. It depends on having a virtual directory/Application in IIS. However, once that virtual directory is created you can use xcopy for updates.

查看更多
登录 后发表回答