C
C#5mo ago
v0fbu1vm

Include directory only in DEBUG.

Is there a way to only include a directory in debug. It's an asp net core web app?
7 Replies
lycian
lycian5mo ago
Depends on how it's included. If it's just an include item you can use Condition="'$(Configuration)' == 'Debug'
Anton
Anton5mo ago
you mean exclude source files from being compiled? or not serve some files unless in debug?
v0fbu1vm
v0fbu1vmOP5mo ago
Exactly, I can of course exclude them using
#if DEBUG
#endif
#if DEBUG
#endif
Although it would be easier to just ignore the entire directory.
Anton
Anton5mo ago
no you can definitely achieve that there's the Compile item you can exclude files from it
Anton
Anton5mo ago
Exclude Files from the Build - MSBuild
Discover how to explicitly exclude or conditionally include files from builds for MSBuild project files with attributes and wildcards.
Anton
Anton5mo ago
add the conditional that andrew suggested above as an attribute for the Compile tag
v0fbu1vm
v0fbu1vmOP5mo ago
@Anton I will take a look into that. Thank you very much guys for the input.

Did you find this page helpful?