C
C#2mo ago
WAASUL

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

Did you find this page helpful?