VC Runtime Binding…
Hello, I am George Mileka, a developer on the Visual C++ Libraries Team. After we released the Visual C++ 2008 Feature Pack back in April, we got a lot of useful feedback from MVPs and customers. One of the areas that definitely needed clarification is the version dependency embedded in the generated manifest.
The question goes like this: Why does the VS team provide two options:
(1) bind the application to the RTM version of the VC runtimes.
(2) bind the application to the current version of the VC runtimes.
And what is the default behavior?
Before going into why each case can be useful, I’d like to emphasize something…
The policy redirection provided by VC redirects application requests for older versions to newer ones (for a given servicing baseline*, and after applying the <app>.config file if present**).
This means that:
– an application that binds to the RTM version of the libraries can be directed to RTM or later (if a newer runtime is installed).
– an application that binds to the current version of the libraries can be directed to the current version (or later version when a newer version is released).
Now – back to answering the question.
Option (1) is useful for the following scenario:
– Alan installs the RTM product and uses it to develop his product.
– Alan builds his product and ships the VC runtime dlls he has along with it (RTM ones).
– Microsoft releases VS SP1, and the user installs it to get a fix for a non-libraries related issue (perf improvement in some area for example).
– Alan finds a bug in his own product and decides to fix it, rebuild his binaries and ship a patch for his customers.
In this scenario, Alan does not really care about the newer VC runtime dlls. Alan should be able to rebuild his binaries, and hand them to customers without having to redistribute the VC runtime. To decouple the new application binaries from the new VC runtime dlls, the user chooses to bind to the RTM version of the VC runtime dlls.
Option (2) is useful for the following scenario:
– Jim installs the RTM product and uses it to develop his product.
– Jim finds a problem with the VC libraries. The problem affects his product behavior.
– Jim asks Microsoft for a fix (a QFE) so that his product works properly.
– Microsoft fixes the problems and hands Jim a QFE with the fix. The QFE contains new headers/libraries/runtime dlls.
– Jim builds his product and ships the VC runtime dlls he got through the Microsoft QFE.
In this scenario, Jim’s product correct behavior is dependent on the newer runtime dlls. Jim prefers that his application does not start at all rather than starting and inhibiting incorrect behavior. Jim can enforce that by binding to the QFE version of the runtime dlls.
In VS2005, the default (out of the box after installing SP1) is Scenario #2.
In VS2008, the default is Scenario #1.
The reason we have switched the default behavior is that (based on customer feedback) scenario #1 is way more common than scenario #2.
One can argue that we could have had different defaults based on the release context (QFE vs. SP1), but we think this will be more confusing than just sticking with one policy for everything.
[Added 9/30/2009] If you are interested in how either scenario can be implemented, please see MSDN article: http://msdn.microsoft.com/en-us/library/cc664727.aspx
Please, let me know if you have any questions…
Visual C++ Development Team
* A “servicing baseline” can be VS RTM, VS SP1, etc.
** The <app>.config can be used to disable the central policy altogether – or it can map the application request to something else before the central policy is applied.