c# - MsBuild with Solution Files with DefineConstants -
currently, in automated build, use devenv.exe build solution files:
devenv /build myproject1.sln now, want create 2 versions of application, normal version, , light version. source code these 2 versions same, it's in light version of features disabled, , use #define lite preprocessor directives ( in csproject file, these constants defined under defineconstants property group).
in msbuild--or normal devenv build--is possible specify whether symbol want should present in build? reason ask because want build sln file first time lite preprocessor directives ( lite version), , second time, without lite preprocessor directives ( full version).
in project file add new propertygroup section lite version
<propertygroup condition="'$(liteversion)'=='true'"> <defineconstants>$(defineconstants);lite</defineconstants> </propertygroup> remove lite definitions of defineconstants.
msbuild.exe myprojeect1.sln msbuild.exe myprojeect1.sln /p:liteversion=true you can create additional configuration in vs switch between versions. can lead configuration mismatches when forgot add flag lite config. can suggest more elegant solution. create .bat file or change link run myproject1.sln:
set liteversion=true devenv.exe myproject1.sln
Comments
Post a Comment