使用TFS部署代理部署本机库

时间:2014-12-03 15:30:33

标签: tfs msbuild libgit2sharp

我在使用libgit2sharp工作的项目中使用Git2 library。现在,最后一个版本used project properties files instead of custom build action。虽然这在Visual Studio 2013中构建或使用“发布”操作时工作正常,但它在使用TFS构建服务器时根本无法工作。

以下是csproj文件中的导入说明。

  <Import Project="..\packages\LibGit2Sharp.0.20.0.0\build\net40\LibGit2Sharp.props" Condition="Exists('..\packages\LibGit2Sharp.0.20.0.0\build\net40\LibGit2Sharp.props')" />

  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
    <PropertyGroup>
      <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
    </PropertyGroup>
    <Error Condition="!Exists('..\packages\LibGit2Sharp.0.20.0.0\build\net40\LibGit2Sharp.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LibGit2Sharp.0.20.0.0\build\net40\LibGit2Sharp.props'))" />
  </Target>

以下是问题的props文件:

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <ItemGroup>
        <None Include="$(MSBuildThisFileDirectory)\..\..\lib\net40\NativeBinaries\amd64\git2-3f8d005.dll">
            <Link>NativeBinaries\amd64\git2-3f8d005.dll</Link>
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </None>
        <None Include="$(MSBuildThisFileDirectory)\..\..\lib\net40\NativeBinaries\amd64\git2-3f8d005.pdb">
            <Link>NativeBinaries\amd64\git2-3f8d005.pdb</Link>
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </None>
        <None Include="$(MSBuildThisFileDirectory)\..\..\lib\net40\NativeBinaries\x86\git2-3f8d005.dll">
            <Link>NativeBinaries\x86\git2-3f8d005.dll</Link>
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </None>
        <None Include="$(MSBuildThisFileDirectory)\..\..\lib\net40\NativeBinaries\x86\git2-3f8d005.pdb">
            <Link>NativeBinaries\x86\git2-3f8d005.pdb</Link>
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </None>
    </ItemGroup>
</Project>

因此,再次使用Visual Studio发布或构建项目会将NativeBinaries文件夹复制到bin文件夹,这完全没问题。但是,使用TFS构建部署设置,永远不会使用RemoteAgent在服务器上传输该文件夹。

MSBuild参数:

/p:DeployTarget=MsDeployPublish /p:Configuration=MEP-DEV /p:DeployOnBuild=True /p:CreatePackageOnPublish=False /p:MsDeployPublishMethod=RemoteAgent /p:AllowUntrustedCertificate=True

在构建日志文件中,我可以看到正在安装Libgit2sharp NuGet包,但是在任何地方都没有提到这些库,就好像它们被部署过程忽略了一样。

0 个答案:

没有答案