I have a utility library for doing some common things in C#.
I want to return an array of Assets in a JSON file in the project root, but the results will be different depending on whether the parent project is Debug or Release.
For example:
{ProjectRoot}\Assets.json
{
"debug": {
"css": [
"/public/vendor/bootstrap/3.3.5/css/bootstrap.min.css"
],
"js": [
"/public/vendor/bootstrap/3.3.5/js/bootstrap.min.js",
]
},
"release": {
"css": [
"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"
],
"js": [
"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js",
]
}
}
Then I use it by checking DEBUG or RELEASE and returning the proper list to the ViewBag.
I already do this manually in a couple projects and I'm about to start another. I would like add it to a utility project. However, setting #if DEBUG
in the library will return the correct files for the library build, but not for the parent project.
Is there any way to get whether the parent project build is debug or release without another preprocessor wrap?
I would just like to set ViewBag.Assets = MyLib.Assets
for simplicity, rather than checking for Debug or Release in my parent project and wrapping the ViewBag setting.
Is this possible at all?