Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Let's see how we can update our Configuration class to exclude our test data when we're not building a debug version of our application.
Follow Along
To follow along commiting your changes to this course, you'll need to fork the dotnet-ef-migrations repo. Then you can clone, commit, and push your changes to your fork like this:
git clone <your-fork>
cd dotnet-ef-migrations
git checkout tags/v1.8 -b excluding-test-data-in-production
Creating Custom Build Configurations
For a walkthrough of how to create a custom build configuration, see the following on MSDN.
Once you've created your custom build configuration, you can then define a symbol that can be used with preprocessor directives. See this MSDN resource for information on how to define symbols (be sure to scroll down to the section labeled "To set this compiler option in the Visual Studio development environment").
Here's an article on CodeProject that walks through a complete example of how to use conditional compilation to control runtime settings for different deployment scenarios.
Additional Learning
For more information about C# preprocessor directives, see the following resources.
- https://www.tutorialspoint.com/csharp/csharp_preprocessor_directives.htm
- https://msdn.microsoft.com/en-us/library/ed8yd1ha.aspx
For more information about Debug and Release configurations, see the following on MSDN.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up