Skip to content

Instantly share code, notes, and snippets.

@jzi96
Last active March 4, 2016 10:26
Show Gist options
  • Save jzi96/0a472e838e64bfb7498b to your computer and use it in GitHub Desktop.
Save jzi96/0a472e838e64bfb7498b to your computer and use it in GitHub Desktop.
Ideas and snippet for MsBuild fiiles - Propertygroup and task to convert xsd to cs before build
<!--Propertygroup and task to convert xsd to cs before build
Item must have Property MyXsd
-->
<None Include="Configuration\Parameter.xsd">
<SubType>Designer</SubType>
<MyXsd>Custom</MyXsd>
</None>
<PropertyGroup>
<WIN_SDK_PATH>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows@CurrentInstallFolder)</WIN_SDK_PATH>
<WIN_SDK_BIN_PATH>$(WIN_SDK_PATH)\bin</WIN_SDK_BIN_PATH>
<SVCUTIL>"$(WIN_SDK_BIN_PATH)\svcutil.exe"</SVCUTIL>
<XSD>"$(WIN_SDK_BIN_PATH)\xsd.exe"</XSD>
</PropertyGroup>
<Target Name="BeforeBuild">
<Exec Outputs="Configuration" Command="$(XSD) /classes /n:MyNS.Configuration /out:Configuration /nologo @(None->'%(fullpath)', ' ')" Condition="'%(None.MyXsd)'=='Custom'" />
</Target>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment