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?
A simple way: you switch to release mode, update your web. config for production, right click on your service project and from the menu select publish. Then you publish it to the local folder. This way it copies only the files needed.
Right-click on the project (not the solution) in Solution Explorer and select Publish. In the Publish tab, select Publish. Visual Studio writes the files that comprise your application to the local file system. The Publish tab now shows a single profile, FolderProfile.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With