Tuesday, April 24, 2007

Publish in VisStudio 2005

I'm a reluctant fan of the publish feature in VS 2005. It isn't easily tinkered with, at least not for me, and it forces a wholesale replacement of the website, including non-compiled pages (javascript, css, images, etc), which takes up too much time in my opinion, in addition to bringing over my development webconfig which is never the webconfig on a staging or production server.

So, a little trick I've come up with is to publish locally and then do a copy of only the bin directory and all ascx and aspx pages. For example, if I have a website under wwwroot (I know it's not necessary with VS2005, but i'm old-fashioned) called MySite, I will have a sister directory called MySite_Build. I publish to this directory and then copy to my remote servers.

When you publish, you have the option of local IIS and the file system. I would prefer local IIS because the path is simpler, but I find I get this error often:
"You must choose a publish location that is not a sub-folder of the source website." This error is confusing because the build directory is NOT a subdirectory and is in no way related to the source website. I haven't figured this out, when I get this error, I simply use the file system to identify the same directory and it works like magic. Go figure.

We'll be moving to the 3.0 framework pretty soon, but we'll still be working in vs2005 for awhile to come, so if anyone has any publishing tips, I can certainly use them!

1 comment:

Raymond said...

I had the same error. I was using localhost in my publish path and I had to change it to use the IP address of my local machine before it would work.