MsBuild Subversion错误元素<project>无法识别</project>

时间:2013-04-10 15:35:44

标签: .net svn msbuild

我正在尝试编写一个Msbuild脚本,该脚本将检索在subversion中保存到本地路径的解决方案,然后构建解决方案。

从命令行执行时,我收到错误 - MSB4060该元素无法识别,或在此上下文中不受支持。任何指针都会非常感激。

<project name="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003>">

  <PropertyGroup>
    <RepositoryPath>http://Path<RepositoryPath>
    <svnUsername>USERNAME</svnUsername>
    <svnPassword>PASSWORD</svnPassword>
    <LocalPath>LOCAL_PATH_TO_COMPILE_SOLUTION</LocalPath>
    <solutionFileName>SOLUTION_FILENAME</solutionFileName>
  </PropertyGroup>

  <!--<ItemGroup>
  </ItemGroup>-->

  <Import Project="C:\Program Files\MSBuild\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>

  <Target Name="GetSource">
    <Message Text="Checking out trunk into $(LocalPath)" />
    <SvnCheckout RepositoryPath="$(RepositoryPath)"
        LocalPath="$(LocalPath)"
        UserName="$(svnUsername)"
        Password="$(svnPassword)">
      <Output TaskParameter="Revision" PropertyName="Revision" />
    </SvnCheckout>
    <Message Text="Have got revision: $(Revision)"/>
  </Target>

  <Target Name="Build" DependsOnTargets="GetSource;Clean;" />

  <Target Name="Clean">
    <MSBuild Projects="$(LocalPath)$(solutionFileName)" Targets="Clean;Rebuild" />
  </Target>

</project>

1 个答案:

答案 0 :(得分:1)

  • 在示例中使用大写Project根元素而不是小写project
  • 使用正确的命名空间xmlns="http://schemas.microsoft.com/developer/msbuild/2003"(即在关闭引号之前删除>
  • 修复RepositoryPath
  • 的结束标记

即。 - 只生成有效的MSBUILD XML项目