c# - MSBuild run XSD Task before files get compiled -
i'm pretty new msbuild , trying xsd task run c# files need run app refreshed each time run build.
i've got build task working following.
<usingtask taskname="xsd" assemblyname="microsoft.build.cpptasks.common, version=4.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a"/> <target name="generatecsfromxsd" beforetargets="build"> <itemgroup> <xsdinput include="xml\file1.xsd"/> <xsdinput include="xml\file2.xsd"/> </itemgroup> <xsd generatefromschema="classes" language="cs" sources="@(xsdinput)" /> </target>
this works fine. each time run build regenerate new c# file file1 , file 2 inputs. issue if delete file1 , file2.cs files repo, , run build, build fail because reason files xsd task making not generated @ time looks source files compile.
i thought beforetargets="build"
cause files generated before did else. ideas? i've tried beforetargets="compile"
you can refer https://mhut.ch/journal/2015/06/30/build_time_code_generation_msbuild more details on how hook code generation logic.
or simplest in beforebuild
target, msbuild executes before other targets.
Comments
Post a Comment