Changing solution configuration
From NetGore Wiki
| Difficulty | |
|---|---|
| Topics | Engine setup |
| (view all tutorials) | |
This article describes how to change the solution configuration in NetGore, and why you would want to.
Introduction
The solution configuration allows you to change the way the solution is compiled. A huge number of programs, not just NetGore, will define at least two configurations: debug and release.
The solution configuration can be viewed and changed through Visual Studio.
- Open up the NetGore solution file (netgore.sln).
- In the Solution Explorer, right-click the solution (should be at the very top and have the name "Solution 'NetGore'") and select Configuration Manager.
- Use the drop-down box in the top-left to change the active solution configuration.
Pre-defined configurations
This section defines the meanings behind the predefined configurations that come with NetGore.
- Debug
- The default configuration, and recommended one to use for those using the sidescroller perspective.
- DebugDbClassGen
- Only builds the projects needed to run the DbClassCreator. Use this when you want to run the DbClassCreator, but other DemoGame projects don't build. This typically happens when the code generated by the DbClassCreator is invalid and needs to be reconfigured and re-run.
- DebugTopDown
- Same as Debug, but using the top-down perspective.
- Mono
- Same as Debug, but intended for those using Mono. Only needed when building for something other than Windows.
- MonoTopDown
- Same as Mono, but using the top-down perspective.
- Release
- Intended for when you are releasing your game to the public. Results in better optimized code and produces significantly less debugging information. Because there is less debugging information available, its best to not use unless you really are releasing your project to the public.
- ReleaseClient
- Same as Release, but only builds the client project. Select this when you want to build only the stuff related to the client.
- ReleaseTopDown
- Same as Release, but for the top-down perspective.
Debug vs Release
When the debug symbol is defined, a lot more checking will take place. This has a negative impact on the performance, but its worth it. Building for release mode, all of these checks are completely removed. Combined with greater optimizations being performed by the compiler, this makes release builds quite a bit faster.
Preprocessor directives that check for the debug symbol will not be run in release modes. For example:
#if DEBUG // Code in this section will be run only in debug builds #else // Code in this section will be run only in release builds #endif
There is also an attribute for checking for symbols:
[System.Diagnostics.Conditional("DEBUG")] void AssertTest() { // Code in this method will only appear in debug builds }
Most calls to methods in the Debug class will also only occur in debug builds:
System.Diagnostics.Debug.Assert(x < 10, "This assertion will never show in release builds, even if x is less than 10.");