Hamid Z
Hamid Z

Reputation: 327

c# different file content for debug and release

I have .txt file which I want some parts of its content to be different for debug and release build.

{Bunch of text. debug and release...}

#if DEBUG
{My texts onlyfor debug build}
#else
{And texts onlyfor release}
#endif

{Other bunch of texts...}

Is such thing possible?

Upvotes: 0

Views: 142

Answers (1)

apc
apc

Reputation: 5566

You could generate your .txt file when your application starts based on your example using #if DEBUG statements.

You could even include your two files as myFile.txt.debug and myFile.txt.release and then copy the right one to myFile.txt when the application starts. These could be included as content files or in your projects resources.

For XML and JSON files you can use https://github.com/microsoft/slow-cheetah to generate file based on your build configuration.

Upvotes: 1

Related Questions