locked
Tips to get the fast build in VS2005 web projects RRS feed

  • Question

  • User-244641896 posted
    When I first converted one of my projects from VS2003 it was taking 4.5 minutes to start (on hitting F5) under VS2005, this is a project with ~ 50 .aspx pages and ~40 .ascx pages all with code behind.  The machine was a clean OS install + VS2005.

    In an attempt to get it to start quicker, I have broken the original solution up, did have about 15 projects, including c# libs, 2 web sites + web deployment  projects (ascx libraries) and the main website.  My solution now just contains the main web project + 1 c# lib.  I have set the start mode to 'Build None' and have batch compile enabled, even so it still takes 45 seconds to start even if you rebuild and then hit F5 with no changes.

    Are there any hints or tricks to make this any faster? Also is this sort of build time I should be expecting?

    Thanks

    Stephen
    Friday, November 25, 2005 11:44 AM

All replies

  • User-1634877164 posted
    Hi Stephen,

    The problem you are describing sounds like an issue with your references to external file-path assemblies.  Can you check your \bin directory to see how many .refresh files you have, and where they are pointing to? 

    The .refresh files contain a pointer path to an assembly to dynamically refresh in the project anytime it changes.  As part of this refresh process, it will also update and bring over other assemblies used by that target assembly if it has dependencies on it.  For example, if you have a .refresh file pointing to AssembyA.dll which has a dependency on AssemblyB.dll, both will get copied over into your \bin dircectoy whenever one changes.

    What can happen (and sounds like it is happening with you) is that you might have two or more .refresh files pointing to different assemblies -- and that some of those assemblies are built and have dependencies on different versions of files.

    For example: You have two .refresh files -- one pointing to assemblya.dll and one pointing to assemblyc.dll.  Both have a dependency on assemblyb.dll, but the assemblyb.dll in their local directories are different versions.  As such, you can end up "refreshing" and copying it over, and doing a clean build, everytime you do a build or hit F5.  This will slow your build time down incredibly. 

    If you are seeing scenarios where when you hit F5 once, run the app, and then hit F5 again without doing anything, then you are likely running into this problem.

    There are a couple of ways to fix it:

    1) Make sure any shared assemblies that you have references to are in sync and don't have version mis-matches.  This is the ideal approach and would be what I'd recommend unless there is some technical reason why they can't be versioned in sync.

    2) Delete the .refresh files in your \bin directory.  The .refresh files are only needed if you want to dynamically update the assemblies on changes.  If you want to manually update an assembly, you can just delete its .refresh file (but keep the .dll). 

    Let me know if you don't know how to fix #1, and we can help walk you through it more.  As a temporary workaround, you could also do #2 which would allow you to have fast build times while we help you get your reference dependencies setup with approach #1.

    Hope this helps,

    Scott
    Friday, November 25, 2005 12:34 PM
  • User-244641896 posted
    Just a quick reply, as I'm just leaving work, deleting the .refresh has made a world of difference, it starts after a clean build in a matter of seconds now.

    I'll reply with some more detail of how our projects are set up so I can take you up on your offer of some advice on getting them all to build in sync when I get home.

    Cheers,

    Stephen.
    Friday, November 25, 2005 1:43 PM
  • User-244641896 posted

    Just as a follow up I have reorganised my project to remove a circular reference that was causing a dll to be rebuilt after it was already used.

    To make sure it all works from now on, I've knocked up a quick batch script to build everything in the correct order.  When I get time I'll see if I can do it with an msbuild file instead of a batch calling msbuild. It would be nice if you could have a VS solution that was a list of solutions so i could build the lot from one IDE.

    Anyway, thanks very much for your help, it has made VS so much more useable!!

    Stephen 

    Friday, November 25, 2005 9:45 PM