views:

334

answers:

4

I am working on an ASP.Net MVC web app in VS 2010. I want to run the web app in my local IIS 7 under it's own web. I have my hosts file set up so that *.dev points back to my local ip so when I create an IIS web i can just give it a unique host name like myapp.dev and it runs.

This is my first web application project with VS and I am trying to figure out how to make VS publish the web app code to my local web when I hit build. I already have the publish part working but i want to automate it. Also I might add that I have a couple different layers (class libraries) that need to also build and publish all at once.

In summary what I want to happen is after making code changes I want to click rebuild solution or rebuild project and after successful build I want the files that changed to be published to the web root I have set up for this particular web app in my local IIS. Then I can just refresh the browser to test my changes.

Are there any tutorials on this type of set up someone can refer me to?

+1  A: 

Check these links:

Using Visual Studio 2008 with IIS 7

Creating and running VS 2010 Web Application Projects and Web Sites on IIS instead of the default Cassini web server

VS 2010 Web Deployment (by Scott Guthrie - the father of ASP)

Walkthrough: Creating a Local IIS Web Site in Visual Studio

Leniel Macaferi
Thanks for the resources but these only tell me what I already know. Whats missing is I am trying to figure out how make the publish action part of the build process so that I can just hit cntrl + f5 and after the build the files are published automatically. This would save me a couple manual steps each time I want to test code changes.
JBeckton
Check the new link I added.
Leniel Macaferi
+1  A: 

Although I'm using 2008 I found it much easier to use NAnt to build and publish. It allows you much greater flexibility and you can use it to publish to both your local and production site.

ealgestorm
A: 

This ended up being a lot simpler than I thought. With VS 2010 there is a new feature called "One Click Publish" and there is a toolbar for this as well. I had already created a publish profile for my local iis web so all I have to do is click publish! All of the projects in the solution are then built and published. As long as the projects are all set as dependent then they are built and published along with the web project.

Now all i need it a hot key for one click publish and I am all set.

I would imagine that if I had defined additional build tasks in the csproj file all that would get executed as well.

JBeckton
+1  A: 

Are you trying to use IIS instead of the ASP.NET development web server during development? If it is you can go to your web project's settings and then to the web tab to change the development web server to IIS and specify a url. This way you don't need to publish anything, the virtual directory points to your project's folder. So when you compile and run your web application, it will pick up any change. If this is not what you want, you can use msdeploy command line tool in the post-build step to package and deploy/update your web application to local IIS. This way each time you build, msdeploy will run and update IIS with the changes.

Mehmet Aras
I have considered this but I do not wish to run my app under a virtual directory http://localhost/myapp/, being new to ASP.Net I have struggled with paths to various assets when moving from dev to production. Running my dev site in the web root as I would in production just helps me deal with that.
JBeckton