我有.txt文件,我希望其内容的某些部分在调试和发布版本中有所不同。
.txt
{Bunch of text. debug and release...} #if DEBUG {My texts onlyfor debug build} #else {And texts onlyfor release} #endif {Other bunch of texts...}
这可能吗?
yrefmtwq1#
您可以根据示例使用#if DEBUG语句在应用程序启动时生成.txt文件。你甚至可以包含两个文件myFile.txt.debug和myFile.txt.release,然后在应用程序启动时将正确的文件复制到myFile.txt中,这些文件可以作为内容文件或包含在项目资源中。对于XML和JSON文件,您可以使用https://github.com/microsoft/slow-cheetah根据构建配置生成文件。
#if DEBUG
1条答案
按热度按时间yrefmtwq1#
您可以根据示例使用
#if DEBUG
语句在应用程序启动时生成.txt文件。你甚至可以包含两个文件myFile.txt.debug和myFile.txt.release,然后在应用程序启动时将正确的文件复制到myFile.txt中,这些文件可以作为内容文件或包含在项目资源中。
对于XML和JSON文件,您可以使用https://github.com/microsoft/slow-cheetah根据构建配置生成文件。