共用方式為


Devenv /Setup Performance

When starting out with the Visual Studio SDK, one of the things you may notice from the start is the time that it takes to build many of the samples. It's not the actual C# or C++ compilation that takes so long, but rather a post-build step that is run: "devenv /rootsuffix Exp /setup". (The /rootsuffix Exp part simply says use the Experimental hive when running /setup.)

But why does the /setup take so long?

Setup essentially "resets" the IDE, taking into account any new packages that have been registered. Most of the steps in this process are on the order of fractions of a second. In Visual Studio 2005, a change was made in the way that project templates work which caused the /setup to increase dramatically. Starting with VS 2005, project and item templates are installed as .zip files. When you run /setup, a caching process happens, and part of that process is extracting every zip template on the machine. This doesn't just mean community templates you may have installed off the Internet. This also includes VB/C#/C++ project and item templates. This is the portion of the /setup process that can cause it to take 60 seconds or more on some machines.

So what is Microsoft doing about it?

Unfortunately, for Visual Studio 2005, this problem will not be fixed. However, we are addressing it for Visual Studio 2008. Starting with Visual Studio 2008 Beta 2 + VSSDK, you'll notice that the build time for almost all samples (and your own packages) is significantly improved. This is due to a new switch in VS 2008 called /nosetupvstemplates. In the VSSDK targets file, we will check if you have any ZipProject/ZipItem items in your project. These are the build items you typically will use when creating templates. If you don't have any templates in your project, we will add the /nosetupvstemplates flag to "devenv /setup" which causes the template caching process to be skipped. This will take the build time for most samples down to only a few seconds.

If you do have project templates in your project that need to be built, the VSSDK targets will still run the full "devenv /setup" when your templates have changed from the last build.

Comments

  • Anonymous
    July 19, 2007
    The comment has been removed
  • Anonymous
    July 20, 2007
    My naive solution to the template setup performance issue would be to compare the sources modification date to either the cached ones or some last run date (maybe per template in some sort of repository) and only perform the caching process for changed/not in the cache templates. Implementing and testing this would be a bit more expensive, though.
  • Anonymous
    July 20, 2007
    The comment has been removed
  • Anonymous
    February 07, 2011
    @Dmitry Pavlov: this wouldn't work if the user isn't an administrator. So it must be done during installation.