New Publish Feature with VS 2005 Web Application Projects

 May 8th Update: The final release of the VS 2005 Web Application Project is now live.  You can learn more about it here.

We are finishing up the final week of work on the feature-complete build of the VS 2005 Web Application Project option.  This build has a ton of new features and functionality, and fixes all of the bugs reported with the last preview.  We are in the process of verifying the build with a number of private beta testers now, and will make it available for everyone to download early next week.

One cool new feature that I’ve been playing around with tonight, and that I think people will really like, is the new “Publish” feature that this new build of VS 2005 Web Application Projects will enable.  This provides a really easy way to deploy a VS 2005 Web Application Project, and is much improved from the support in VS 2003.   

To use it, all you now need to-do is choose the Build->Publish menu item to launch the publish dialog for the web project or solution you are working on:

 

 

You now have the option of doing incremental file deployments for your web application – where only new and changed files in the project are updated on a server (so if you make a modification to a page, only its .aspx and the .dll in the \bin directory are copied).  It allows you to optionally omit deploying app_data directory files (so you can deploy a SQL Express database once, and not overwrite it on updates unless you want to).  It supports FTP, HTTP, and File-System based deployments (so you can point directly at your remote FTP server if you want).  And it supports copying and deploying files in the background asynchronously for large web solutions (so you don’t have to block on waiting for all the files to be copied).  You can optionally choose to monitor the deployment progress via the output window in VS:

 

 

For even richer deployment customization, you can also obviously attach a VS Web Deployment Project and/or VS Web Setup Project (and even chain the three projects together, so that the output of one feeds the next one in the chain). 

 

But for the most common scenarios, though, everything is now built-in to the VS 2005 Web Application Project type and allows super fast deployments and updates. 

 

Hope this helps,

 

Scott

 

P.S. One of the other cool feature additions in the new VS 2005 Web Application drop is better support for building a single web-application composed of multiple web projects (where each web project makes up part of the single site or application).  I’ll blog about this feature shortly and some of the cool new things you can do with it that you can’t in VS 2003.

 

P.P.S. This new build also support auto-upgrading of VS 2003 web projects.  So if you have the VS 2005 Web Application Project installed, and doing an Open Project on a VS 2003 Web Application it can automatically convert it to a VS 2005 Web Application Project -- without you having to modify the project file at all (which is the current workaround with the February VS 2005 Web Application build).

 

Published Monday, March 27, 2006 1:10 AM by ScottGu
Filed under:

Comments

# re: New Publish Feature with VS 2005 Web Application Projects

Monday, March 27, 2006 4:24 AM by David
Is the new publishing stuff available as a msbuild task as well, so that we can easily do the deployment from our build script on Team Build?

# re: New Publish Feature with VS 2005 Web Application Projects

Monday, March 27, 2006 4:31 AM by Serfmum
Will the Publish Feature by available via an MSBuild target?

# re: New Publish Feature with VS 2005 Web Application Projects

Monday, March 27, 2006 4:38 AM by Manso
Very good. I've kept an eye on your blog following the conversations about file/directory exclusion. This is causing a lot of headache for us at the moment. We have certain files that should not be compiled into the project and when excluding them, VS renames them. Same thing with directories. Can webapp project type help us here?

Thanks,
Manso

# re: New Publish Feature with VS 2005 Web Application Projects

Monday, March 27, 2006 4:40 AM by scottgu
Hi Manso,

With the web application project model option the files to compile/include in the project are defined within a project file. So you don't need to rename anything to exclude it -- which should fix your issue.

Hope this helps,

Scott

# re: New Publish Feature with VS 2005 Web Application Projects

Monday, March 27, 2006 5:56 AM by Rick Strahl
I just ran into the auto-convert feature - and it worked great on a fairly large project. Came right in and worked as is (although I didn't see the .designer files auto created).

Unfortunately in this case I wanted a plain file based project (ie. let VS do the convert it usually does without WAP). It'd be nice if there was some sort of option in the upgrade Wizard that prompts for which way you want to import.

WAP is the natural choice, but in my case I needed to take VS2003 and move it into a file project that I can distribute out more easily.

WAP is working great otherwise though - it does address just about all of my concerns.

# re: New Publish Feature with VS 2005 Web Application Projects

Monday, March 27, 2006 6:33 AM by Andreas Kraus
This is great news, after that tool has been released I can probably drop my other deployment tools :)

# re: New Publish Feature with VS 2005 Web Application Projects

Monday, March 27, 2006 7:27 AM by Steve
What is the best way to deploy a web.config when you have a different connection string for production than development?

# re: New Publish Feature with VS 2005 Web Application Projects

Monday, March 27, 2006 7:57 AM by Kevin Buchan
"One of the other cool feature additions in the new VS 2005 Web Application drop is better support for building a single web-application composed of multiple web projects."

I really look forward to this. This is exactly what my department does for our Intranet.

Thanks!

# re: New Publish Feature with VS 2005 Web Application Projects

Monday, March 27, 2006 9:11 AM by Kyle
Excellent new!

In a previous post, you mentioned that the final build would require some changes/enhancements to the VS.NET 2005 that would be released as a service pack. Is that dependency still there?

# re: New Publish Feature with VS 2005 Web Application Projects

Monday, March 27, 2006 9:48 AM by Anatoly Lubarsky
Great feature.
I've send some feedback on this.

# re: New Publish Feature with VS 2005 Web Application Projects

Monday, March 27, 2006 10:53 AM by andys987
Scott,

This sounds great.
Will we have the ability to protect the config file in our target location? Like most users, I have connection strings, etc that are different in my development environment.

Thanks,
Andy

# re: New Publish Feature with VS 2005 Web Application Projects

Monday, March 27, 2006 10:59 AM by scottgu
Hi Rick,

If you have WAP intalled and want to-do a Web-Site Conversion of an existing project, then you can choose File->Open Web Site and point at the VS 2003 web project. This will convert the project as a VS 2005 Web Site Project (just like the shipping VS 2005 does).


About the .designer.cs file creation: the WAP auto-migration feature automatically converts a VS 2003 project to the VS 2005 web application project format. Our expectation is that people will then want to-do a clean compile to make sure everything is compiling ok, and then right-click on the project root and choose the "Upgrade Web Application" option to auto-generate the .designer.cs/.vb files and move the control field declarations into them. Doing this in a second step gives people more control, and ensures that you can get everything working fine in step1 before proceeding.

Hope this helps,

Scott

# re: New Publish Feature with VS 2005 Web Application Projects

Monday, March 27, 2006 11:49 AM by Duncan
Here's hoping that F7 (to view code behind) works as expected again! :-)

# re: New Publish Feature with VS 2005 Web Application Projects

Monday, March 27, 2006 12:09 PM by scottgu
Hi Duncan,

Yep -- both F7 and Shift-F7 are implemented with this build.

Thanks,

Scott

# re: New Publish Feature with VS 2005 Web Application Projects

Monday, March 27, 2006 12:31 PM by Jay Patel
"One of the other cool feature additions in the new VS 2005 Web Application drop is better support for building a single web-application composed of multiple web projects."

This is also a huge need for my current client. We have a 'base' application providing security, navigation, and core functionality for a product suite. Each product in the suite will be a separate web project.

# re: New Publish Feature with VS 2005 Web Application Projects

Monday, March 27, 2006 12:32 PM by Pieter Siegers
Hi Scott,

why does WAP appear under Create Project and not under Create Web Site in VS.NET 2005?

Since web projects are now nicely separated (unlike in VS.NET 2003), I expected it to appear under the latter just like the MS Atlas templates.

Cheers,
Pieter

# re: New Publish Feature with VS 2005 Web Application Projects

Monday, March 27, 2006 2:14 PM by Ryan
Does this integrate well with Visual Source Safe? We use 6.0 and 2005 where I work and we're very strict with our source control since we have to manually move files to a live environment. And we're looking for a GUI feature that can do this for us in VS. Can you use this tool to revert to a previous version then redeploy? Or how can we still us VSS to control our source code accurately while using this tool?

# re: New Publish Feature with VS 2005 Web Application Projects

Monday, March 27, 2006 2:51 PM by scottgu
Hi Pieter,

Web Application Projects use a project-file based approach which is one reason they go through the standard create/open project model.

Hope this helps,

Scott

# re: New Publish Feature with VS 2005 Web Application Projects

Monday, March 27, 2006 2:55 PM by scottgu
Hi Ryan,

VS 2005 Web Application Projects integrate well with VSS (and other source control solutions). So you would be able to revert to a previous file version using source control and then use the above deployment tool to publish.

Hope this helps,

Scott

# re: New Publish Feature with VS 2005 Web Application Projects

Monday, March 27, 2006 6:29 PM by scottgu
Hi Fabio,

The current public build of WAP doesn't support event-generation in the code-behind file. But if you send me email (scottgu@microsoft.com) I can get you access to a recent drop that does. We'll then post the public build on the web early next week.

Hope this helps,

Scott

# re: New Publish Feature with VS 2005 Web Application Projects

Monday, March 27, 2006 8:12 PM by Brad
Scott -
I've been one of the beta testers (thank you very much) and just want to say how happy I am with the WAP...so much so that I've now committed to all new development in VS2005 and actively upgrading VS2003 projects: and even with the current CTP I have already deployed WAPs to produciton. And more importantly, I'm now starting to move the rest of my web team to VS2005.

Thanks to you and all the team for this!

# re: New Publish Feature with VS 2005 Web Application Projects

Tuesday, March 28, 2006 8:29 AM by Andys987
Scott,
Sorry, I was not more clear with my earlier post. What I meant was...
I use different config files in different environments. Each of them uses different connection strings, paths, etc. I want to protect them from being overwritten with values from my development environment when I deploy the application. Otherwise, I need to go into the config file and make changes each time I deploy the entire application.

Thanks,
Andy

# re: New Publish Feature with VS 2005 Web Application Projects

Tuesday, March 28, 2006 12:59 PM by Hua
Hi Scott,
I just converted one ASP.Net 1.1 project into 2.0 using VS 2005 WAP and have one attempt to deploy it. It seems to me that we still need to deploy both aspx and aspx.cs files. Is it true. Do I miss anything?

Thanks
Hua

# re: New Publish Feature with VS 2005 Web Application Projects

Tuesday, March 28, 2006 1:10 PM by scottgu
Hi Hua,

You only need to deploy the .aspx files and the .dll files when using WAP (just like VS 2003). No source needs to be deployed.

Hope this helps,

Scott

# re: New Publish Feature with VS 2005 Web Application Projects

Tuesday, March 28, 2006 2:41 PM by Adham Shaaban
Scott,

Many thanks again to you and your team for bringing this important feature to VS2005. I simply couldn't have moved my WebDev team to asp.net 2.0 without it. I think you also mentioned before that it will be a standard part of future versions of VS and that's good to know.

thanks,
Adham

# re: New Publish Feature with VS 2005 Web Application Projects

Thursday, March 30, 2006 4:46 AM by scottgu
Hi Hua,

Can you send me an email (scottgu@microsoft), and I can help you with this.

Thanks,

Scott

# re: New Publish Feature with VS 2005 Web Application Projects

Wednesday, April 5, 2006 8:49 PM by Dan
Hey Scott:
Do you have a date/ETA for the updated Web Application Project?
Thanks!

# re: New Publish Feature with VS 2005 Web Application Projects

Wednesday, April 5, 2006 9:07 PM by Dan
Awesome!!! You Rock!

# re: New Publish Feature with VS 2005 Web Application Projects

Tuesday, April 11, 2006 11:13 AM by Raviv Pavel
When publishing "Only files needed to run this application" my *.config files are not being published although I really need them :)

Could could be useful to allow us to select extensions to include/exclude.

Many thanks,
Raviv.

# re: New Publish Feature with VS 2005 Web Application Projects

Wednesday, April 12, 2006 2:57 AM by scottgu
Hi Rajiv,

Previous builds of WAP didn't correctly set the "Build Action" meta-data on some files. If the build action isn't set to "content", then the publish wizard won't publish them.

To fix this, select the file in the solution explorer and within the property grid change the "Build Action" to content. It will then deploy.

Note that this is fixed in the RC build of WAP for all new files created, so you will probably only have this issue if you were using a previous WAP build.

Hope this helps,

Scott

# re: New Publish Feature with VS 2005 Web Application Projects

Monday, April 17, 2006 6:33 PM by Cris
Are there plans to support Team Build?

# re: New Publish Feature with VS 2005 Web Application Projects

Monday, April 17, 2006 7:37 PM by scottgu
Hi Cris,

Yep -- we will support team build. There is an issue with the current RC with team build not copying content files. We are working on this now. If you want to send me email (scottgu@microsoft.com) I can loop you into the discussions and notify you when we have a fix.

thanks,

Scott

# re: New Publish Feature with VS 2005 Web Application Projects

Wednesday, April 19, 2006 9:01 PM by IronYuppie
Hi Andys987--

If you tell your web.config file not to publish from your development environment, and keep a specific web.config file in your production directory, that would solve your problem.

The other option is to do machine (or domain) detection logic. An example of this is:

if (System.Environment.MachineName == "COMPUTER1")
{
(... select development connection string here ...)
}
else if (System.Environment.MachineName == "COMPUTER2")
{
(... select development connection string here ...)
}


and so on...

# re: New Publish Feature with VS 2005 Web Application Projects

Thursday, May 25, 2006 2:45 PM by Pradeep
I have the report folder which contains crystal reports, it did not publish the report folder; I have to do it manully. But it was cool. Thnaks - Pradeep

# re: New Publish Feature with VS 2005 Web Application Projects

Sunday, June 4, 2006 11:37 AM by raj
Web Application projects - publish command does not work properly.
after you deploy application using publish when you run it ask for cs file of master page
and even project dll is in bin folder



# re: New Publish Feature with VS 2005 Web Application Projects

Sunday, June 4, 2006 11:48 AM by ScottGu
Hi Raj,

What that means is that you haven't properly converted your VS 2005 Web Site Project to be a VS 2005 Web Application Project.

You need to right click on the project root and choose the "Convert to Web Application" option as detailed here: http://webproject.scottgu.com/CSharp/Migration2/Migration2.aspx

Then you don't need any .cs files at all during publish.

Hope this helps,

Scott

# re: New Publish Feature with VS 2005 Web Application Projects

Friday, June 9, 2006 3:34 PM by wyatt blake
Can you point me to any documentation on calling doing this type of publish from msbuild (I'm trying to add this to our team nightly build)?  Thanks.

# re: New Publish Feature with VS 2005 Web Application Projects

Saturday, June 10, 2006 1:08 AM by ScottGu
Hi Wyatt,

Here is a post that provides more information on command-line builds: http://weblogs.asp.net/scottgu/archive/2006/06/02/VS-2005-Web-Application-Projects_2C00_-MSBuild_2C00_-and-Continuous-Integrations.aspx

Hope this helps,

Scott

# re: New Publish Feature with VS 2005 Web Application Projects

Saturday, June 10, 2006 1:29 PM by Forsooth
Site's down. Any other way to get the final release?

# re: New Publish Feature with VS 2005 Web Application Projects

Saturday, June 10, 2006 1:44 PM by ScottGu
Hi Forsooth,

They are upgrading the power in the building where my server (which has some tutorials on it) is hosted today -- but it should be back online tomorrow.

Here is the pointer to the final release of the download though: http://msdn.microsoft.com/asp.net/reference/infrastructure/wap/default.aspx

Hope this helps,

Scott

# re: New Publish Feature with VS 2005 Web Application Projects

Tuesday, August 8, 2006 1:19 PM by x1
My webservice needs to have windows authentication disabled. To publish using http, it seems i need windows authentication enabled (or some form other then just anonymous). Any way i can publish to an existing site with only anonymous access?

# re: New Publish Feature with VS 2005 Web Application Projects

Wednesday, August 9, 2006 4:36 AM by ScottGu

Hi X1,

I believe you need to login to your site to publish -- otherwise anyone would be able to install any code on your server.

Hope this helps,

Scott

# re: New Publish Feature with VS 2005 Web Application Projects

Tuesday, August 29, 2006 12:11 PM by Doug
Is there any reason when I do a build/publish that the dialog says "publish web site" instead of "publish web" and some of the items are different. For example it has checked: "Allow this precompiled site to be updateable". I just want to publish one page and leave the rest of the site as is. Am I running a beta version? or standard?

# re: New Publish Feature with VS 2005 Web Application Projects

Wednesday, August 30, 2006 1:53 AM by ScottGu

Hi Doug,

I believe you are using the VS 2005 Web Site Project option -- which doesn't have the option to only update one file.

The above blog post was done using the VS 2005 Web Application Project option which you can learn more about here: http://webproject.scottgu.com.

Hope this helps,

Scott

# re: New Publish Feature with VS 2005 Web Application Projects

Saturday, September 2, 2006 11:11 PM by Chris
I've seen a few posts on this so far, but have not seen a good way of implementing this. Scott, are there any plans to include a msbuild task to deploy via http?

# re: New Publish Feature with VS 2005 Web Application Projects

Thursday, November 9, 2006 3:14 PM by Zack
Is there any way to invoke the publish process from the command line?

# re: New Publish Feature with VS 2005 Web Application Projects

Saturday, December 2, 2006 8:27 PM by ScottGu

Hi Sean,

Unfortunately I can't think of an obvious way to automatically vary it.  What you might want to consider doing is adding a simple script to the directoy that allows you to switch the connection-string on the fly.

Hope this helps,

Scott

# re: New Publish Feature with VS 2005 Web Application Projects

Friday, January 5, 2007 9:15 AM by Thomas Conté

I have been unable to publish my ASP.NET Web Site (not WAP) using the standard Publish feature. All I got is this message in the Output window:

------ Build started: Project: C:\...\dotpunk\, Configuration: Debug .NET ------

Index was outside the bounds of the array.

------ Skipped Publish: Project C:\...\dotpunk\, Configuration: Debug .NET ------

I finally managed to precompile my site manually using the command line:

%WINDIR%\Microsoft.NET\Framework\v2.0.

50727\aspnet_compiler.exe -p . -v / c:\temp\dotpunk.org -u

(just run it from your Web Site projet root folder)

Now you can manually copy the resulting hierarchy to your public site using FTP or whatever.

HTH,

Thomas.

# re: New Publish Feature with VS 2005 Web Application Projects

Saturday, January 13, 2007 7:31 PM by Craig Monro

Scott,

Thanks for the article.

Like many other that have posted it is apparent that we want to control how project settings are used.

In essense, since we have release and debug configs (or as most people would prefer: Development, Test and Live), each config require their own settings.

Unfortunately, the project settings neglect the fact that we need settings that change with the target, rather than being 'global' settings.

Most of the time, settings are there so that we can configure them from deployment to deployment...which would be ideally (for many people) managed from the project properties box.

This should be automatic, rather than needing to fiddle around with deployment projects/custom build steps, etc.

# re: New Publish Feature with VS 2005 Web Application Projects

Sunday, January 14, 2007 5:06 PM by ScottGu

Hi Craig,

I actually have a blog post coming soon (maybe this week assuming I can find the time for it) that talks about how you can use the VS project configuration model to automatically change web.config file settings based on whether you are in "development", "test" and "live" mode.  You can then use this with VS 2005 Web Application Project's Publish feature to directly publish to your target server.

I think this should provide what you are looking for.  Stay tuned to my blog for a post soon that walksthrough how to use it.

Thanks,

Scott