Don’t you hate it when you complain about a program not being able to do something, then you realize the program could do exactly what you wanted but you were too dumb to know how to use it correctly? Well, for me, this is the case with Visual Studio.NET’s Copy Project utility. I’ve tried it before in the past, but never got it to work right so I just manually copied projects from my development machine to the live web server. Duh.
When configured correctly, the Copy Project utility copies whatever you want to the live web server, the most useful feature being the ability to copy over only the essential files required for running the app.
Instructions:
In the Visual Studio Solution Explorer, select the project that you would like to copy project, then browse to Project > Copy Project…
You should be prompted with a window that looks like this:
For the Destination project folder, it should be the full URL path to your site’s virtual directly. That may be http://localhost/someproject or a fully qualified domain name like http://my.domain.com/... It all depends if you’re copying to a virtual directory on your dev machine or a web site on a live web server. Obviously you should insert the path to the file-share on your machine that connects to the live web server. Apparently a mapped drive or UNC path will work.
Select Only files needed to run this application from the Copy section. This prevents .vb, .resx, and other non-essential files from being copied to the web server.
You may be prompted with a warning stating that the Virtual directory could not be created… just click OK. You will then be prompted with this:
Check Apply to all items and let VS.NET copy all the files to the live web server.
Make sure the web.config file is correctly configured for use on the web server. The Copy Project utility will not copy a user.config file over (assuming you excluded it from your VS.NET project), so use the user.config on your local machine and leave the web.config configured for the live server settings. The Copy Project seems to remember the last settings you used, so if you’re constantly working on the same program, you won’t have to keep reconfiguring the Copy Project tool.