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).

 

49 Comments

  • 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?

  • Will the Publish Feature by available via an MSBuild target?

  • 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

  • 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

  • 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.



  • This is great news, after that tool has been released I can probably drop my other deployment tools :)

  • What is the best way to deploy a web.config when you have a different connection string for production than development?

  • "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!

  • 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?

  • Great feature.

    I've send some feedback on this.

  • 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

  • Here's hoping that F7 (to view code behind) works as expected again! :-)

  • Hi Duncan,



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



    Thanks,



    Scott

  • "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.

  • 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

  • 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?

  • 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

  • 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

  • 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

  • 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!

  • 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

  • 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

  • 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

  • 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

  • Hi Hua,



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



    Thanks,



    Scott

  • Hey Scott:

    Do you have a date/ETA for the updated Web Application Project?

    Thanks!

  • Awesome!!! You Rock!

  • 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.

  • 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

  • Are there plans to support Team Build?

  • 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

  • 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...

  • 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

  • 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







  • 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

  • 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.

  • 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

  • Site's down. Any other way to get the final release?

  • 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

  • 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?

  • 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

  • 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?

  • 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

  • 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?

  • Is there any way to invoke the publish process from the command line?

  • 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

  • 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.

  • 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.

  • 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

Comments have been disabled for this content.