1

I've been digging around trying to get some solid information about how to go about doing this. Most of the info I've found talks about Web Deploy from Visual Studio 20xx, but I'm not sure if this is the preferred method. I want to be able to "install" an MVC website/web application to staging, then after testing/defecting fixing cycle, do another build and install it on a Production environment. How is everyone going about doing this? It seems rather strange that the documentation is so loose and limited. Isn't this what all ASP.NET dev companies do? Can someone explain to me the best approach for rolling out and updating web apps to Win2008 IIS 7.5? Basically I'm looking for a nicely packaged installer.

2
  • You can also build your projects manually using MSBUILD from a command line, that is what we do on our build server using a slightly modified version of "Package-Web": sedodream.com/2011/12/24/PackageOncePublishAnywhere.aspx that lets you install a nuget package enabling you to publish a once built project to different environments. (But you can also get around the nuget install, it just sets up some additional msbuild-files to hook into the building process, seems like magic at first but is customizable to your very needs ;) Commented Apr 28, 2014 at 8:22
  • Well I think I've got the server setup correctly to host web deploy, but when I try to deploy from VS2013, I get an error "Could not load file or assembly 'Microsoft.Web.Deployment, Version=9.0.0, Culture=neutral, PublicKeyToken=xxxx' or one of its dependencies. The system cannot find the file specified". Does this error mean that the local machine that I'm trying to publish from is missing the dll, or the remote server? I have full vs2013 premium, why would this dll be missing? Commented Apr 28, 2014 at 18:53

3 Answers 3

2

There are multiple ways to publish a web site. The solution depends on many factors, such as whether you are publishing internally, or externally. If you are creating an install for third parties to install on their own servers, etc..

If you have direct file system (ie network share) access to your web servers, and you aren't concerned with a formal build process with separate build servers, etc.. then using the built-in Web Publishing functionality of Visual Studio is the simplest method. You just publish directly to the filesystem of your website's virtual directory. This works very well and supports most scenarios out of the box.

If, however, you are a larger organization and want more controls. Then you can install WebDeploy on the server and publish from Visual Studio using the WebDeploy agent, although WebDeploy is tricky to setup and not well documented. WebDeploy can also be used outside of Visual Studio and has a very rich feature set.

Some people use version control to deploy to their sites. They do a build, then check it into version control, then "get latest" into the servers virtual directory. This gives them the ability to easily roll back to previous versions or point in time.

Others use build and deploy tools like MSBuild, OctopusDeploy, Chuck Norris, etc...

Yet others use Continuous Integration tools, which may use some of the tools I've already mentioned. CI servers like TeamCity, CruiseControl.net, etc...

There is a wealth of information out there, and tons of ways to do this... since so much of it is personal choice and depends on your situation, we can't really definitively say "do this" or "do that".

Sign up to request clarification or add additional context in comments.

4 Comments

I've got the server setup with web deploy and the agent and everything is running, but I cannot deploy from VS2013 because it's giving me a missing dll error (see my comment above). I have VS2013 Premium so I'm not sure why a dll is missing.
@u84six - Apparently you used the Web Platform Installer to install WebDeploy on IIS. This is apparently the cause of this error. You need to download an install WebDeploy manually on IIS. iis.net/downloads/microsoft/web-deploy Download the appropriate version x86 or x64, not WebPI
Actually, I had to install Web Deploy on the client machine (the one running VS2013) so that it would load the missing dependency. This is rather strange, because I use the same web deploy process from home using the same VS2013 version and I didn't have to install web deploy dependency. That's the only thing that has me baffled.
To add to that, yea I also noticed that good online documentation is hard to find for web deploy; for me personally this book helped tremendously: Inside the Microsoft Build Engine: Using MSBuild and Team Foundation Build by Sayed Ibrahim Hashimi (no that is not me ;), but IIRC he is one of the guys working on the MSBUILD-project at Microsoft)
1

Ok, I got web deploy working between remote host (Windows Server 2008 R2) and client running VS2013. I found a great site that has a walkthrough.

Installing and using Web Deploy on server 2012

This applies to Windows server 2012 but also worked for Win 2008.

After I walked through everything, deployment failed with an error: "Could not load file or assembly 'Microsoft.Web.Deployment, Version=9.0.0.0..."

To resolve that issue, I downloaded and installed the latest Web Deploy package on the machine running VS 2013. At the time, the latest version was 3.5:

Web Deploy 3.5

This comes with the dependency dll that's needed for the client. What's strange, is that I didn't have to do this part on my home machine running the same version of VS 2013, so I don't know why this was necessary in this particular case.

After all of this was completed, I was able to deploy my web app remotely as admin. I wouldn't advise setting up web deploy for admin on the host because of security issues, but the walkthrough that I linked above shows how to create a user account for remote connection.

Edit: I also found a great troubleshooting guide that helped me fix a problem: Web Deploy Troubleshooting

Comments

0

We use the built in Visual Studio web publishing for this and combine it with web.config transformations to deploy the appropriate configuration (settings, connection strings etc.) for each environment.

Once set-up it really is as simple as selecting the publishing profile you want and pressing 'Publish'.

4 Comments

So you run VS from your build server and roll out to staging and also Production?
Obviously the staging and production servers need to be setup correctly to support web publishing. So for the server, do you manually create the website and enable it for web deploy?
We publish directly from Visual Studio. No build server involved.
Do you run a db schema as well? It would be great that if the the db hasn't been created yet, you can somehow run a sql script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.