0

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

从命令行执行时出现错误 - 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>
4

1 回答 1

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

ie - 只生成有效的 MSBUILD XML 项目

于 2013-04-10T17:06:49.820 回答