Hello everyone,
I'm trying to use MSBuild Community Tasks to generate C++ header file
with version information.
The script MyApp.msbuild that I'm using looks like following:
<Project xmlns="
http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks
\MSBuild.Community.Tasks.Targets" />
<ItemGroup>
<Tokens Include="Major">
<ReplacementValue>4</ReplacementValue>
</Tokens>
<Tokens Include="Minor">
<ReplacementValue>5</ReplacementValue>
</Tokens>
<Tokens Include="Version">
<ReplacementValue>6</ReplacementValue>
</Tokens>
<Tokens Include="BuildNumber">
<ReplacementValue>101</ReplacementValue>
</Tokens>
</ItemGroup>
<TemplateFile TemplateFile="Include/Templates/version.h.template"
OutputFile="Include/version.h" Tokens="@(Tokens)" />
<ItemGroup>
<ProjectToBuild Include="MyApp.sln" />
</ItemGroup>
<Target Name="Release">
<MSBuild Projects="@(ProjectToBuild)"
Properties="Configuration=Release" Targets="Rebuild"
BuildInParallel="True" />
</Target>
<Target Name="Debug">
<MSBuild Projects="@(ProjectToBuild)"
Properties="Configuration=Debug" Targets="Rebuild"
BuildInParallel="True" />
</Target>
<Target Name="BetaRelease">
<MSBuild Projects="@(ProjectToBuild)"
Properties="Configuration=BetaRelease" Targets="Rebuild"
BuildInParallel="True" />
</Target>
<Target Name="BetaDebug">
<MSBuild Projects="@(ProjectToBuild)"
Properties="Configuration=BetaDebug" Targets="Rebuild"
BuildInParallel="True" />
</Target>
</Project>
When I try to build the project from the command line using MSBuild
4.0.30319.1 I constantly get the following error:
MyApp.msbuild(19,5): error MSB4067: The element <TemplateFile> beneath
element <Project> is unrecognized
I'm using the stable build of MSBuild.Community.Tasks.msi, and also I
tried using the latest nightly build version 1.3.0.514. In both cases
the result is the same.
I also tried to play with variable $(MSBuildExtensionsPath) by
replacing it with $(MSBuildExtensionsPath32) or even with absolute
path to file MSBuild.Community.Tasks.Targets. Didn't help either.
When I wrap <TemplateFile> with another <Target> element, MSBuild
produces error like:
MyApp.msbuild(20,23): error MSB4064: The "TemplateFile" parameter is
not supported by the "TemplateFile" task. Verify the parameter exists
on the task, and it is a settable public instance property.
I suspect that I'm missing some small detail or may be the
installation of MSBuild Community Tasks went wrong so that MSBuild
simply doesn't see Community Tasks targets.
My operating system is Windows 7 Ultimate.
Any help will be appreciated.
Thanks