Deploying a Web Application from the command line - asp.net

Im looking to deploy a web application on a build server.
It is a very small web app and so far i have written a nice little console app that checks out from SVN and then calls msbuild on the .sln file.
This of course is not the same as publishing a web app and so far have not found a programatic way of publishing.
So my question is this..
After msbuild has run can i simply delete all .cs and .vb files and then deploy?
or
Should i really try and find a way to publish programatically?

I would suggest using a nant build script where you can use the AspNetCompiler task to publish you web app.
AspNetCompiler
Or you can use the ASP.NET Compilation Tool from the command line.

Related

Adding grunt output directory to ASP.NET web service

I am creating a javascript webApp and i deploy it using GruntJS. this web app will be deployed in an ASP.NET MVC Web Service. I want to add the dist folder (and any files created by grunt inside the folder) programmatically inside the visual studio project, so when I build and deploy the web service I can navigate to this folder. Hope I was clear!
Yes you can. Grunt is completely independent of IDEs and texteditors and is a really helpful tool for all kinds of web development in any editor.
Grunt is described as “a node based javascript task runner with which you can automate tasks like minification, compilation, unit testing, linting and more”. You can use it for example when you do not like to be dependent on an asp.net web server doing minification and bundling for you, or you simply like to be able to use tools that are not (yet) supported by the asp.net/Visual Studio ecosystem.
Here is all you need: http://joeriks.com/2013/08/06/can-i-benefit-from-grunt-for-my-visual-studio-based-web-development/
Hope this helps!
Try to tweak WebDeploy settings in your MSBuild file (*.csproj?) so it would include files from the dist folder into your web application during publishing.
The following tutorial should be a good starting point how to do it:
http://www.asp.net/mvc/tutorials/deployment/visual-studio-web-deployment/deploying-extra-files
Also check ASP.NET Solution Template on Visual Studio Gallery

How to publish Asp.net Web Application from a Web Service or Windows Form App(Not from Vs editor)

I am working on a project and we need to deploy our web projects to server but these web projects are creating dynamically by end users. so we gather all files of web project in a file. finally we need to push these files to server with publish. but how can i do without VS editor's manual publish option. do u have any website or any source that example to my aim, or if you know sth about it can you help me?
You can use Visual Studio in command line mode to do the same but assuming that you probably do not have access to VS on, your next bet would be MSBuild.
See these links that tells how to use MSBuild to publish a web project:
http://blog.m.jedynak.pl/2008/03/publishing-web-application-with-msbuild.html
How do I publish a Asp.NET web application using MSBuild?

how to run asp.net dlls?

I've got 4 ASP.NET DLLs and the source.
When i compile it it says its not able to run it because it's a class library. I know, but how should I run those files. I haven't got any aspx files or anything, just the 4 DLL's.
What do these DLLs do that needs to be run? Do you just need to quickly debug/test some functionality in them or something? A quick way to do that would be to just write a simple little console app and reference the DLLs in it.
You don't run an ASP.NET application like you do a normal program. It has to be hosted on a web server (either IIS, or the built-in server in Visual Studio), and then accessed by a browser, through a URL.

ASP.NET Web Application Build Output - How do I include all deployment files?

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.
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:
Announcement on webdevtools MSDN blog for WDP 2008
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!
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.
You can Publish Web site..If you want to automate your deployment, you need to use some script.
Have you tried using the aspnet_compiler.exe in your .net framework directory? I'm pretty sure you can create a "deploy ready" version of a web application or web site.
The _CopyWebApplication target on MSBuild will do exactly what you need. The catch is that only the main assembly will be copied to the bin folder and that's why a copy task is needed to also copy any other file on the bin folder.
I was trying to post the sample script as part of this post but wasn't able to.
Please take a look at this article on my blog that describes how to create a MSBuild script similar to the one you need.
Have you tried right clicking the website in Solution Explorer and clicking 'Publish Website'?
Build --> Publish
A dialog box will appear that will guide you through the process.
For the automated building you describe in the update, I would recommend you look into MSBuild and CruiseControl.NET
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.

VS2008: Copy Web Site from command line

How do I execute the "Copy Web Site" command for an ASP.NET project in VS2008 from the command line? If I need to script this, let me have some pointers on where I can learn that.
Would this help you get started?
Walkthrough: Deploying an ASP.NET Web Application Using XCOPY

Resources