Abscissa
Abscissa

Reputation: 72

How to support a different language/compiler in an msbuild project?

In an msbuild project, how can I tell msbuild how to invoke a compiler for a language that msbuild doesn't natively support?

(For example, with make/makefiles and most other buildsystems, it's possible to say "For all sources with .xyz extension, build them by running command 'xyzc SOME_VAR_WITH_THE_COMPILER_FLAGS SOME_VAR_WITH_SOURCE_FILENAME'". How to do the equivalent for msbuild?)

Upvotes: 0

Views: 639

Answers (1)

Nikerboker
Nikerboker

Reputation: 833

It is not hard:

<ItemGroup>
  <XyzzyFiles Include="*.xyz"/>
</ItemGroup>

<Target Name="Build">
  <Exec Command="MyCompiler %(XyzzyFiles.FullPath)"/>
</Target>

In this sample MyCompiler will be sequentially called for each .xyz file.

If you want to make single call to MyCompiler, passing list of files, use

<Target Name="Build">
  <Exec Command="MyCompiler @(XyzzyFiles->'%(FullPath)', ' ')"/>
</Target>

Upvotes: 1

Related Questions