visual studio 2015 - How can I set custom MsBuild property from VSIX without writing into .csproj file? -
i create vsix extension visual studio, adds custom drop-down menu. need value menu apply .csproj property of file without changing file itself, configuration menu. example:
<propertygroup> <configuration condition=" '$(configuration)' == '' ">debug</configuration> </propertygroup> <propertygroup condition=" '$(configuration)' == 'debug' "> <defineconstants>debug;trace;</defineconstants> </propertygroup>
-- default content of .csproj. when selecting "debug" visual studio configuration drop-down menu, configuration property value switch debug without changing .csproj file , '#if debug'-block in code file activated.
i have multiply projects in solution , each project have property. if overwrite .csproj, these changes monitored source control, not want. please.
how can set custom msbuild property without writing .csproj file?
if custom msbuild property propertygroup in project file, can invoke msbuild pass parameter project file msbuild command line:
<propertygroup> <customtestname>testvalue1</customtestname> </propertygroup>
the command line:
msbuild /p:custaomtestname=testvalue2
alternatively, can use option "condition
" in custom property, [debug/release]
in project file:
<propertygroup> <customtestname>testvalue</customtestname> </propertygroup> <target name="checkpropertieshavebeenset"> <error condition="'$(customtestname )'=='customtestnamenotset'" text="something has gone wrong.. custom test name not entered"/> <propertygroup> <customtestname condition="'$(customtestname)'=='changetestvalue'">changetestvalue</customtestname > </propertygroup> </target>
Comments
Post a Comment