BradleyB's WebLog
-
Web Application Projects Officially released!
Web Application Projects has been released! It live at:
-
How to share dynamic URLs across multiple Web Application Projects
I was recently asked how to configure a Dynamic URL so that it could be updated in machine.config and affect all Web Application Projects calling that Web Reference on that machine. This is fairly straight forward in VS03 and in VS05 Web Site projects.
-
How to open a website in Visual Studio 2005 from the command line
I’ve seen several queries asking how to launch Visual Studio 2005 opening a specific folder as a website from the command line. Unfortunately Visual Studio 2005 does not support this by default but you can enable the scenario by writing a macro.
-
Tips to optimize design-time build performance for Web Sites in Visual Studio 2005
Move App_Code files into a separate class library project
I'm repeating this tip because even if you don't change the default build options you can improve build performance by moving the files from App_Code into a separate class library project.
Check for conflicting dependencies
If you do have conflicting dependencies, the web site project will do a full clean rebuild on every build even if only a page changes. The problem is when you add a file based references that have a common dependency but to different versions of that dependency. A file based references have a .dll.refresh file in the bin folder. The .refresh file has the path to the original assembly. These paths are checked on every build.
In this example we have two assemblies, A.dll and B.dll both dependent on Foo.dll.
A.dll -> dependent on Foo.dll
B.dll -> dependent on Foo.dll
When A.dll is refreshed the project system will discover the dependency on Foo.dll and copy it into bin. Likewise when B.dll is refreshed Foo.dll will be copied if different than the one already in bin. The problem is that when a class library is built by a class library project in VS it caches the dependencies. So as you can see here Class Libraries A and B both have a private copy of Foo.
ClassLibraryA
A\bin\debug\A.dll
A\bin\debug\Foo.dll
ClassLibraryB
B\bin\debug\B.dll
B\bin\debug\Foo.dll
ClassLibraryFoo
Foo\bin\debug\Foo.dll
If ClassLibraryFoo is updated and only ClassLibraryB is recompiled then ClassLibraryB has a updated copy for Foo.dll but ClassLibraryA does not. When the web project is built, the refresh of A is copying in it's copy of Foo and the refresh of B is copying in it's copy. Each time Foo is copied because it's different than the one already in bin.
Because the bin is changing with every VS build the ASP.Net compilation cache is invalidated forcing a full build. Thus every build is a full build.
To fix this problem do one of the following: -
How to auto-increment assembly version using a custom MSBuild task
The assembly version string has the format “major.minor.build.revision”, such as 2.0.50727.42. Here is a sample on how to create a custom MSBuild task for Web Deployment Projects to auto-increment the build and revision portion of your version strings with each build.