Reputation: 10680
I'm in the final stages of a project at the moment. As part of my efforts, I have been reorganising the main MVC solution to use references to pre-compiled libraries, rather than having 15 different projects in the one solution.
My question relates to where the Release/Debug switch is applied.
Say for example, that my lower level libraries are built in Debug mode and my main web client app is built in Release mode.
Will the project be built in Release mode ( because that's the config of the main app ) or debug mode ( because the main app depends binaries compiled in debug mode )?
Upvotes: 1
Views: 131
Reputation: 5649
In the scenario you describe, your web project will be built as a "Release" assembly and will depend on a "Debug" assembly. The reason for the quotes is that the only difference between a "Release" and "Debug" assembly (unless using non-default options) is the exclusion or inclusion, respectively, of debug symbols and optimization of the IL in the assembly. So, it is a perfectly valid situation to be in, having a release assembly referencing a debug assembly, though it's probably not one you want to be in. As there'll be more IL in the debug assembly (because its built wirhout optimizations) giving the JIT more work to do to try to optimize the code it will run on the machine, probably resulting in a not as optimized, slower experience at run time.
Depending on whether or not you are digitally signing your referenced assemblies, you could use a post-build task to replace the debug compiled, referenced assemblies with release compiled assemblies for your project's output.
An argument can be made that you should not be referencing debug compiled assemblies outside of the solution being used to create them, as the operative assumption for referencing a DLL as a file (as opposed to doing a project reference in the IDE) is that the assembly is a tested, finished version of the functionality it contains.
In summary, the way your project is compiled is not dependent on the build configurations of the assemblies it references, but, if possible, you should reference the release compiled versions of those assemblies instead.
Upvotes: 2