C
C#3mo 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
lycian3mo ago
Depends on how it's included. If it's just an include item you can use Condition="'$(Configuration)' == 'Debug'
Anton
Anton3mo ago
you mean exclude source files from being compiled? or not serve some files unless in debug?
v0fbu1vm
v0fbu1vmOP3mo 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
Anton3mo ago
no you can definitely achieve that there's the Compile item you can exclude files from it
Anton
Anton3mo 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
Anton3mo ago
add the conditional that andrew suggested above as an attribute for the Compile tag
v0fbu1vm
v0fbu1vmOP3mo ago
@Anton I will take a look into that. Thank you very much guys for the input.

Did you find this page helpful?