Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

This posts covers how to best optimize the build performance with Visual Studio 2005 when using web projects.  If you are experiencing slow builds or want to learn how to speed them up please read on.

Quick Background on VS 2005 Web Site Project and VS 2005 Web Application Project options

VS 2005 supports two project-model options: VS 2005 Web Site Projects and VS 2005 Web Application Projects

VS 2005 Web Site Projects were built-in with the initial VS 2005 release, and provide a project-less based model for doing web development that uses that same dynamic compilation system that ASP.NET 2.0 uses at runtime.  VS 2005 Web Application Projects were released as a fully supported download earlier this spring, and provide a project model that uses a MSBuild based build system that compiles all code in a project into a single assembly (similar to VS 2003 -- but without many of the limitations that VS 2003 web projects had with regard to FrontPage Server Extensions, IIS dependencies, and other issues).  To learn more about VS 2005 Web Application Projects, please review the tutorials I've published on my http://webproject.scottgu.com web-site.  Note that VS 2005 Web Application Project support will be included in VS 2005 SP1 (so no additional download will be required going forward).

Both the VS 2005 Web Site Project option and the VS 2005 Web Application Project option will continue to be fully supported going forward with future Visual Studio releases.  What we've found is that some people love one option, while disliking the other, and vice-versa.  From a feature perspective there is no "one best option" to use - it really depends on your personal preferences and team dynamics as to which will work best for you.  For example: a lot of enterprise developers love the VS 2005 Web Application option because it provides a lot more build control and team integration support, while a lot of web developers love the VS 2005 Web Site model because of its "just hit save" dynamic model and flexibility.

Two articles you might find useful to decide which works best for you is this MSDN whitepaper that includes some comparisons between the two models, and Rick Strahl's Web Application Projects and Web Deployment Projects are Here article that provides a good discussion of the pros/cons of the different options.

To migrate from the VS 2005 Web Site Project model to the VS 2005 Web Application Project model, please follow this C# or VB tutorial that walks-through the steps for how to-do so.

So Which Project Option Builds Faster?

When doing full builds of projects, the VS 2005 Web Application Project option will compile projects much faster that the VS 2005 Web Site Project option.  By "full build" I mean cases where every class and page in a project is being compiled and re-built - either because you selected a "Rebuild" option within your "build" menu, or because you modified code within a dependent class library project or in the /app_code directory and then hit "build" or "ctrl-shift-b" to compile the solution. 

There are a few reasons why the VS 2005 Web Application Project ends up being significantly faster than Web Site Projects in these "full rebuild" scenarios.  The main reason is that (like VS 2003), the VS 2005 Web Application Project option only compiles your page's code-behind code and other classes within your project.  It does not analyze or compile the content/controls/in-line code within your .aspx pages -- which means it does not need to parse those files.  On the downside this means that during compilation it will not check for errors in those files (unlike the VS 2005 Web Site Project option which will identify any errors there).  On the positive side it makes compilations much faster.

So does this mean that you should always use the VS 2005 Web Application Project option to get the fastest build times with large projects?  No -- not necessarily.  One nice feature that you can enable with the VS 2005 Web Site Project option is support for doing "on demand compilation".  This avoids you having to always re-build an entire project when dependent changes are made -- instead you can just re-build those pages you are working on and do it on-demand.  This will lead to significant build performance improvements for your solution, and can give you a very nice workflow when working on very large projects.  I would definitely recommend using this option if you want to improve your build performance, while retaining the flexibility of the web-site model.

The below sections provide specific tutorials for both the VS 2005 Web Site Project Model and the VS 2005 Web Application Project Model on optimization techniques -- including the "on demand compilation" build option I described above.

Specific Tips/Tricks for Optimizing VS 2005 Web Site Project Build Times

When using the VS 2005 Web Site Project model, you can significantly improve build performance times by following these steps:

1) Verify that you are not suffering from an issue I call "Dueling Assembly References".  I describe how to both detect and fix this condition in this blog post.  If you are ever doing a build and see the compilation appear to pause in the "Validating Web Site" phase of compilation (meaning no output occurs in the output window for more than a few seconds), then it is likely that you are running into this problem.  Use the techniques outlined in this blog post to fix it.

2) Keep the number of files in your /app_code directory small.  If you end up having a lot of class files within this directory, I'd recommend you instead add a separate class library project to your VS solution and move these classes within that instead since class library projects compile faster than compiling classes in the /app_code directory.  This isn't usually an issue if you just have a small number of files in /app_code, but if you have lots of directories or dozens of files you will be able to get speed improvements by moving these files into a separate class library project and then reference that project from your web-site instead.  One other thing to be aware of is that whenever you switch from source to design-view within the VS HTML designer, the designer causes the /app_code directory to be compiled before the designer surface loads.  The reason for this is so that you can host controls defined within /app_code in the designer.  If you don't have an /app_code directory, or only have a few files defined within it, the page designer will be able to load much quicker (since it doesn't need to perform a big compilation first).

3) Enable the on-demand compilation option for your web-site projects.  To enable this, right-click on your web-site project and pull up the project properties page.  Click the "Build" tab on the left to pull up its build settings.  Within the "Build" tab settings page change the F5 Start Action from "Build Web Site" to either the "Build Page" or "No Build" option.  Then make sure to uncheck the "Build Web site as part of solution" checkbox:

When you click ok to accept these changes you will be running in an on-demand compilation mode.  What this means (when you select the "Build Page" option in the dialog above) is that when you edit a page and then hit F5 (run with debugging) or Ctrl-F5 (run without debugging) the solution will compile all of the class library projects like before, then compile the /app_code directory and Global.asax file, and then instead of re-verifying all pages within the web-site it will only verify the current page you are working on, and any user controls that the page references.  With large (and even medium) projects with lots of pages, this can obviously lead to major performance wins.  Note that ASP.NET will automatically re-compile any other page or control you access at runtime -- so you will always have an up-to-date and current running application (you don't need to worry about old code running).  You can optionally also use the "No Build" option to by-pass page-level validation in the IDE, which obviously speeds up the entire process much further (I'd recommend giving both options a try to see which you prefer). 

By deselecting the "Build Web site as part of solution" checkbox, you will find that the Ctrl-Shift-B keystroke (which builds the solution) will continue compiling all class library projects, but will not re-build all pages within your web-site project.  You will still get full intellisense support in your pages in this scenario - so you won't lose any design-time support.  You will also continue to get warning/error squiggles in code/class when they are open.  If you want a way to force a re-build to occur on pages not open, or across all pages within the web-site, you can use the "Build Page" or "Build Web Site" menu options within the "Build" menu of Visual Studio:

This gives you control as to which pages on your site you want to verify (and when) - and can significantly improve build performance.  One trick I recommend doing is adding a new shortcut keystroke to your environment to allow you to quickly short-cut the "Build Page" menu option to avoid you having to ever use a mouse/menu for this.  You can do this by selecting the Tools->Customize menu item, and then click the "Keyboards" button on the bottom-left of the customize dialog.  This will bring up a dialog box that allows you to select the VS Build.BuildPage command and associate it within any keystroke you want:

Once you do this, you can type "Ctrl-Shift-P" (or any other keystroke you set) on any page to cause VS to compile any modified class library project (effectively the same thing that Ctrl-Shift-B does), then verify all classes within the /app_code directory, and then re-build just the page or user control (and any referenced master pages or user controls it uses) that you are working on within the project.

Once the above steps are applied, you should find that your build performance and flexibility is much improved - and that you have complete control over builds happen.

Specific Tips/Tricks for Optimizing VS 2005 Web Application Project Build Times

If you are using the VS 2005 Web Application project option, here are a few optimizations you might want to consider:

1) If you have a very large project, or are working on an application with many other developers, you might want to consider splitting it up into multiple "sub-web" projects.  I wouldn't necessarily recommend this for performance reasons (unless you have thousands and thousands of pages it probably doesn't make a huge difference), but it can sometimes make it easier to help manage a large project.  Please read this past blog-post of mine on creating sub-web projects to learn how to use this.

2) Consider adding a VS 2005 Web Deployment project to your solution for deep verification.  I mentioned above that one downside of using the VS 2005 Web Application Project option was that it only compiled the code-behind source code of your pages, and didn't do a deeper verification of the actual .aspx markup (so it will miss cases where you have a mis-typed tag in your .aspx markup).  This provides the same level of verification support that VS 2003 provided (so you aren't loosing anything from that), but not as deep as the Web Site Project option.  One way you can still get this level of verification with VS 2005 Web Application Projects is to optionally add a VS 2005 Web Deployment Project into your solution (web deployment projects work with both web-site and web-application solutions).  You can configure this to run only when building "release" or "staging" builds of your solution (to avoid taking a build hit at development time), and use it to provide a deep verification of both your content and source code prior to shipping your app. 

Common Tips/Tricks for Optimizing any VS 2005 Build Time

Here are a few things I recommend checking anytime you have poor performance when building projects/solutions (note: this list will continue to grow as I hear new ones - so check back in the future):

1) Watch out for Virus Checkers, Spy-Bots, and Search/Indexing Tools

VS hits the file-system a lot, and obviously needs to reparse any file within a project that has changed the next time it compiles.  One issue I've seen reported several times are cases where virus scanners, spy-bot detecters, and/or desktop search indexing tools end up monitoring a directory containing a project a little too closely, and continually change the timestamps of these files (they don't alter the contents of the file - but they do change a last touched timestamp that VS also uses).  This then causes a pattern of: you make a change, rebuild, and then in the background the virus/search tool goes in and re-searches/re-checks the file and marks it as altered - which then causes VS to have to re-build it again.  Check for this if you are seeing build performance issues, and consider disabling the directories you are working on from being scanned by other programs.  I've also seen reports of certain Spybot utilities causing extreme slowness with VS debugging - so you might want to verify that you aren't having issues with those either.

2) Turn off AutoToolboxPopulate in the Windows Forms Designer Options

There is an option in VS 2005 that will cause VS to automatically populate the toolbox with any controls you compile as part of your solution.  This is a useful feature when developing controls since it updates them when you build, but I've seen a few reports from people who find that it can cause VS to end up taking a long time (almost like a hang) in some circumstances.  Note that this applies both to Windows Forms and Web Projects.  To disable this option, select the Tools->Options menu item, and then unselect the Windows Forms Designer/General/AutoToolboxPopulate checkbox option (for a thread on this see: http://forums.asp.net/1108115/ShowPost.aspx).

3) Examine which 3rd party packages are running in Visual Studio

There are a lot of great 3rd party VS packages that you can plug into Visual Studio.  These deliver big productivity wins, and offer tons of features.  Occasionally I've seen issues where performance or stability is being affected by them though.  This is often true in cases where an older version (or beta) of one of these packages is being used (always keep an eye out for when a manufacturer updates them with bug-fixes).  If you are seeing issues with performance or stability, you might want to look at trying a VS configuration where you uninstall any additional packages to see if this makes a difference.  If so, you can work with the 3rd party manufacturer to identify the issue. 

Visual Basic Build Performance HotFix

The Visual Basic team has released several hotfixes for compilation performance issues with large VB projects.  You can learn how to obtain these hotfixes immediately from this blog post.  The VB team also has a direct email address -- vbperf@microsoft.com -- that you can use to contact them directly if you are running into performance issues.

 

Hope this helps,

Scott

Published Friday, September 22, 2006 11:47 AM by ScottGu

Comments

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Friday, September 22, 2006 3:39 PM by Brendan Enrick
You have a lot of good stuff in here. I am going to try these out and see which ones work for me. Thanks! This has been a problem for a while now.

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Friday, September 22, 2006 3:41 PM by AndrewSeven

I tend to refer to the project-less Web Sites as Asp.Net Web Sites and call the Web Application Projects "Web Projects".

While I noticed that the web projects build faster, it was just a "bonus", the main thing that drove us to switch to a project from a website was the frustration of using the web site with VSS and the .refresh files.

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Friday, September 22, 2006 3:52 PM by Mike Bouck
Good info Scott -- thanks! Web Site Projects bit us hard because of the "automagic" reference heuristics. We were getting references to assemblies injected to Visual Studio-specific assemblies which were not present in our deployment environments. This coupled with the speed improvements drove us to run (not walk) to Web Application Projects when they were available. Please, please, please fix the automagic reference stuff!

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Friday, September 22, 2006 4:01 PM by Plip

Somegreat advice there scott, this will help immensely!

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Friday, September 22, 2006 4:14 PM by Joe
> ... VS 2005 Web Application Projects were released as a fully supported download earlier this spring ... I would have to disagree with the "fully supported" bit. On the download page Microsoft recommends using ASP.NET forums for support, and I've reported bugs there without getting any response :( Hope quality and support will improve when this is integrated into VS2005 SP1. And I hope VS2005 SP1 will be available soon (Q32006 is nearly over).

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Friday, September 22, 2006 4:19 PM by ScottGu

Hi Joe,

You can call Microsoft product support services for questions/issues with VS 2005 Web Application Projects - that is what we mean by "fully supported" (meaning you can get dedicated product support and request hotfixes if needed).

If you can send me email on the questions that didn't get answered on the forums I'd be happy to help with them.

Thanks,

Scott

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Friday, September 22, 2006 4:24 PM by Brendan Tompkins
Great Scott! Very helpful. Thanks.

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Friday, September 22, 2006 7:10 PM by Thogek

Thanks for the great info, Scott!

You pointed out:

"...one downside of using the VS 2005 Web Application Project option was that it only compiled the code-behind source code of your pages, and didn't do a deeper verification of the actual .aspx markup (so it will miss cases where you have a mis-typed tag in your .aspx markup)."

Any chance this downside will get "fixed" in VS 2005 SP1 (or at some other future point)?

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Friday, September 22, 2006 7:24 PM by ScottGu

Hi Thogek,

Actually -- you can handle the scenario of doing the deep verification in a VS 2005 Web Application of the .aspx pages today by adding a VS 2005 Web Deployment Project to your solution.  You can then build this to perform the deep checking of everything in the project.  

Hope this helps,

Scott

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Friday, September 22, 2006 7:33 PM by Thogek
Yeah, I noticed that option, and it's good to have available. But I'm wondering if the VS 2005 Web Application Project itself would eventually be able to handle it, so that we can get the more immediate feedback without having to create an additional project. :-)

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Friday, September 22, 2006 7:39 PM by ScottGu

Hi Thogek,

It is something we are looking at possibly adding in the future.  I agree it would be very handy to have. :-)

Thanks,

Scott

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Friday, September 22, 2006 8:55 PM by Steve James
Scott, yesterday at an MSDN event Anand Iyer referred to you as the GOD of ASP.NET. And well, he's right! Excellent post as always.

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Friday, September 22, 2006 11:44 PM by Vikram
This is some good article

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Saturday, September 23, 2006 5:53 AM by Majid Shahabfar
Scott, Thanks fro this helpful post. I've faced to a not very important problem: Switching between design view and code behind for a web form in WS 2005 taks a few seconds more rather than WS 2003 in my computer.

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Saturday, September 23, 2006 10:46 AM by ScottGu

Hi Majid,

Source->Designer view switching take can take longer with VS 2005 for two reasons:

1) VS is now preserving your html formatting (unlike VS 2003 which would move it around).  This logic adds some computational complexity when switching.  

2) VS now loads and uses user controls, master pages, and themes in WYSIWYG mode (VS 2003 instead just rendered grey boxes for user controls, and had no notion of master pages or themes).

You can help improve the performance of this second step above by having only a small number of files (or ideally no files) in your /app_code directory.  This will avoid the designer having to compile them when you do the view-switch, and will improve performance.  Instead, use a class library to store these classes and then reference it from the web-site.  

Hope this helps,

Scott

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Saturday, September 23, 2006 11:50 AM by Albert Pascual

This is just fantastic again. 

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Saturday, September 23, 2006 6:05 PM by Ponnu
Great Article, thanks Scott

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Sunday, September 24, 2006 5:07 PM by ScottGu

Hi Michael,

When building web site projects that require full re-building (for example: one of the dependencies has changed) VS ends up having to re-parse each .aspx file - which is one reason for the heavy disk IO.  That is why my recommendation above to use "on demand compilation" makes such a big difference.  This dramatically lowers the number of files you need to read - which significantly improves disk IO and ultimately performance.

Note that the WAP project doesn't need to read the .aspx file either, so that is another approach to take as well.

Hope this helps,

Scott

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Monday, September 25, 2006 9:12 AM by David Taylor
Thanks Scott - this is more detailed than what you have posted in the past and will be useful. One thing to remember is that it might be hard moving anything in App_Code that relies on an ASP.NET specific build provider. Looking at my web site project, which builds very slowly, I have not only lots of code in App_Code, but also 30 wsdl files in the App_WebReferences directory, which uses the build provider infrastructure, and obviously could easily be moved into a separate project - but it might not be easy to move everything using a build provider over to a standard class library project. Improving compilation speed within App_Code or App_WebReferences (etc) should definately be a focus for future service packs and Orcas.

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Monday, September 25, 2006 9:58 AM by ScottGu

Hi David,

If you have 30 WSDL files in your App_WebReferences directory, then I'd definitely recommend moving those to a separate class library project and reference it.  The benefit is that this project won't need to be recompiled unless one of the WSDL files changes (unless you are using shared typed - although that scenario is a little more rare).  This should significantly improve performance for your scenario.

Hope this helps,

Scott

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Tuesday, September 26, 2006 6:52 PM by moojjoo
I am really please to see this blog. I work in an enterprise enviroment and we are required to build out all application utlizing namespaces COMPANYNAME.APPNAME.LAYER Layer being WebUI, CORE, Facade, Data etc. etc. When I first used VS2005 I was lost as to where my DLL was being stored. Web Application Projects are the way to go if you are developing in an enterprise. thoughts

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Thursday, September 28, 2006 6:38 AM by Nick Gilbert
I was wondering if there was any way to speed up compling by using RAM disk (perhaps one that backs itself up to disk occasionally or is only used for temp files created during compilation). filemon from sysinternals.com tells you which files are accessed during compilation and I'm sure there must be a way to do a full compilation much quicker by avoiding use of the hard disk most of the time. If anybody looks into this and finds it works - let me know :)

# Utilizting Virtual Folders with Web Application Project

Friday, September 29, 2006 4:27 PM by Ryan Tuttle
We have a web site project that we are converting to a web application project. The web site project utilized virtual folders in IIS to share content such as themes and master pages between applications. In a web application project, these virtual folders are not recognized since they are not coupled with IIS. Therefore, the designer isn't able to recognize the masterpage or theme. However, if you set a start URL and debug the masterpage and theme works fine. Any thoughts on how we can get the VS designer to recognize the masterpage?

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Friday, September 29, 2006 5:57 PM by Arif Mosharraf
Hi Scott! I read your blog with interest. I have a question which is not related to this blog. Let me know if you have a separate blog for question like this. Question: I have a management console for online training registrations where you can approve and withdraw any member for selected training. If two managers are managing the same training at the same, there are chances of data invalidation. It means that if manager A has approved someone then interface on manager B's computer would still show that this member is not approved until and unless he refreshes the interface. Is there any way to invalidate the data and refresh the page if you have gridview with lots of data. Thanks in advance.

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Saturday, September 30, 2006 4:41 AM by ajit
am really please to see this blog. I work in an enterprise enviroment and we are required to build out all application utlizing namespaces COMPANYNAME.APPNAME.LAYER Layer being WebUI, CORE, Facade, Data etc. etc. When I first used VS2005 I was lost as to where my DLL was being stored. Web Application Projects are the way to go if you are developing in an enterprise. thoughts

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Saturday, September 30, 2006 1:50 PM by ScottGu

Hi Ryan,

You can set an application root path within a VS 2005 Web Application Project using the properties page.  IF you want to send me email, I can loop you in with a few folks to walkthrough it with you.

Thanks,

Scott

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Sunday, October 1, 2006 9:49 PM by ScottGu

Hi Arif,

There is no way to automatically update the second user's machine when the first user makes changes.  But if you use "optimistic concurrency" within your data tier you can check to see whether updates when the second user also tries to update the data, and warn the user appropriately.

Hope this helps,

Scott

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Monday, October 2, 2006 10:17 PM by ScottGu

Hi Kieran,

Can you send me an email describing this?  I'll then loop you in with a few people on my team who can help.

thanks,

Scott

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Wednesday, October 4, 2006 4:25 AM by Taco Oosterkamp
Hello Scott, I have this strange behaviour in Visual Studio, where I press F5, the compilation/build is finished, but then it 'hangs' while transfering to IE (both 6 and 7). As soon as I move the mouse, or press Alt+Tab, it will move along just fine. Any ideas? Kind regards, Taco Oosterkamp

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Thursday, October 5, 2006 10:39 AM by ScottGu

Hi Taco,

VS does a few things on the Windows message-pump idle loop, and so what you might be seeing is that it is waiting on some movement to kick some activity off.  Is everything fine once you move the mouse?

thanks,

Scott

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Friday, October 6, 2006 7:59 AM by Taco Oosterkamp
Hi Scott, Yes, once I move the mouse, or hit Alt+Tab, everything is fine. Still it is a bit annoying and it took me quite some time to figure out how to work around this. I used to press F5 and keep waiting until IE showed. That doesn't work anymore now. Taco

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Tuesday, October 17, 2006 5:37 AM by abhinav
Scott - Very helpful article - agreed. My first day of VS2005. Going by your previous posts as to the why of VS2005; i was expecting much better performances. Looks like bottlenecks have just been moved around not eliminated. Build is too slow - too o o s l o w. Disappointed

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Tuesday, October 17, 2006 10:25 AM by ScottGu

Hi Abhinav,

Have you applied the suggestions above and/or used the VS 2005 Web Application Project option?  You should find build performance very fast then.

Hope this helps,

Scott

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Wednesday, November 8, 2006 11:39 AM by Hua
Hi Scott, there are no "Build Page" and "Build Web site" menu item on my VS "Build" dropdown. Any special configuration should I do to let two options shown on the "build" menu dropdown. And the dropdown for "shortcuts for selected command" is disabled on my VS->Customiz->keyboard. Can you please tell me why? Many thanks,

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Wednesday, November 8, 2006 10:25 PM by ScottGu

Hi Hua,

Are you using the VS 2005 Web Application Project option?  That project just has "Build Project" and no "Build Page" or "Build Web Site" option.

Hope this helps,

Scott

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Thursday, November 9, 2006 1:35 PM by Hua
Hi Scott, I have VS 2005 Web Application Project installed. But the project I am working on uses web site project model. Thanks Hua

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Thursday, November 9, 2006 10:46 PM by pky

Well, I look first time for web application project feature in my VS 2005 & I was amazed in speed improvement in compilation of the web site.

However, I run to very weird problem, When I copied my code from old web site directory to new one & did the conversion, my app_code was rename to Old_App_Code as should be.

However, the properties for *.cs files in Old_App_Code were marked to be "content" instead of "compile".

So the compilation gave errors "type or namespace name 'XXXX' could not be found (are you missing a using directive or an assembly reference?)

When I marked the files to properies "compile" everything went smoothly.

Hopefully this helps somebody later on ;-),

Markku

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Saturday, November 11, 2006 1:11 PM by ScottGu

Hi Hua,

Try opening up one of the pages within the web-site and then check to see if the "Build" menu appears.

Thanks,

Scott

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Monday, November 20, 2006 5:11 PM by Coutinho

Hi,

I have also the same error:

System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

The website runs on the development server.

How to solve this?

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Tuesday, November 21, 2006 11:27 AM by ScottGu

Hi Coutinho,

That error typically means that you are using an assembly that does not work in partial trust on a hosted server that is configured to run in "medium trust" (which is what most hosting servers run under).

Thanks,

Scott

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Tuesday, November 28, 2006 12:04 PM by Dave Milner

You mentioned adding in a Web Deployment Project for deep verification to a solution with Web Application projects.

Do you have to manually add that in to the solution file?  I'm not seeing the VS option to add the WDP in my solution like I do with a Web Site Project solution.

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Wednesday, November 29, 2006 1:17 PM by ScottGu

Hi Dave,

You should be able to right-click on an existing project and add a web deployment project to both a VS 2005 Web Application and VS 2005 Web Site Project (note: you don't go through file->create new project for this).

Send me email if you are still having trouble and I can loop someone in from the team to help.

Thanks,

Scott

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Tuesday, December 12, 2006 11:54 AM by Heidi

I found the same problem as Hua with or without a page opened in a Website project:

>>>>>>>

Any special configuration should I do to let two options shown on the "build" menu dropdown. And the dropdown for "shortcuts for selected command" is disabled on my VS->Customiz->keyboard. Can you please tell me why?

>>>>>>>>

Unable to set the keyboard customization for build.buildPage as options are disabled.

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Friday, December 15, 2006 3:42 PM by Bill Needels

Thanks, Scott.  I was able to reduce build times on a simple web app from 2-3 minutes down to  5-10 seconds.

Regards,

Bill N.

# Watch out for Virus Checkers - in production environments too!

Saturday, December 16, 2006 10:42 AM by stefan wenig

virus scanners also have this tendency to touch your files on production machines, and asp.net has the same tendency there to recompile everything. the result is that, after the configured number of recompilations asp.net accepts before restarting the whole app, all user sessions will be gone.

we actually had that happen on a customers site. they installed virus scanners on their app servers without telling us, then called us about application istability problems. (that was back in the .net 1.x days, but i believe 2.0 works the same way)

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Tuesday, December 19, 2006 2:12 PM by ScottGu

Hi Thomas,

There are a couple of options you could use:

1) Use a WDP project to build everything into one assembly - you can then copy just this file (along with any .aspx files you modified) to your remote server for deployment.

2) Convert the Web Site to be a Web Application Project, which will keep all file timestamps in sync (and compile all code into a single assembly).  You can then use a standard file copy program to only copy those files that were modified to the target server.

Hope this helps,

Scott

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Tuesday, December 19, 2006 9:28 PM by ScottGu

Hi Cynthia,

Have you installed the Web Deployment Project download?  This is needed to add web deployment support - and is a separate download form web application projects.

Thanks,

Scott

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Tuesday, January 9, 2007 1:01 PM by Marshall

I am using Web Application Projects and Ektron CMS controls.  When I perform a Rebuild Project, 46 out of the 56 Ektron files are deleted from the bin folder.  This does not happen when I perform a Build Project.  How can I prevent the assemblies from being deleted?

Thanks,

Marshall

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Tuesday, January 9, 2007 8:02 PM by ScottGu

Hi Marshall,

When you do a re-build it deliberately cleans out your referenced projects and rebuilds everything.

If you just do a build it will only rebuild those project that have changed.  So if you want to avoid those assemblies being deleted just use build instead of rebuild.

Thanks,

Scott

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Tuesday, January 30, 2007 12:09 AM by ScottGu

Hi Hameed,

Can you send me an email with more details about your situation?  I can then have someone help investigate.

Thanks,

Scott

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Friday, February 9, 2007 3:43 PM by dan

converted to WAP (sp1) and compiles are fast, but page-loads are SLOW - much slower than without WAP.  I have about 60 pages, compile in 2 seconds, load a page in about 60 after a minor change to the .aspx file.

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Saturday, February 10, 2007 11:37 AM by ScottGu

Hi Dan,

Can you send me an email with more details about your page loading issues?  You shouldn't see running this slow.

Thanks,

Scott

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Monday, March 12, 2007 3:40 PM by Matt Brooks

Scott,

Reading the latest edition of MSDN Mag prompted me to visit a problem that I encountered some months ago. In short I do not get the 'Add Web Deployment Project' option for any Web Application Project. I never have done, neither before nor after installed VS2005 SP1. In fact, neither do any of my co-workers!

I'm wondering if this is a common problem or perhaps one that only affects certain versions of Visual Studio 2005 (e.g. Professional Edition - ENU).

When I asked about this some time ago no one had experienced the problem except me, so I didn't pursue it further. As it happens the Web Application Project model suits my preferences and the default compilation (single assembly, updatable) is how we choose to deploy all of our applications to our production servers.

However, now I would like to develop some reusable user controls for my team but also make use of the Web Application project compilation model. At the moment I have no support within the IDE for this.

Any help, references or referals would be greatly appreciated!

Regards,

Matt

PS: I'm posting this comment on a number of blogs.

# re: Tip/Trick: Optimizing ASP.NET 2.0 Web Project Build Performance with VS 2005

Monday, March 19, 2007 2:47 AM by ScottGu

Hi Matt,

Have you installed the separate web deployment project download?  This is needed after you install SP1 in order for the "Add Web Deployment Proejct" option to show up.

Hope this helps,

Scott