MSBuild、扩展包和 TfsVersion

发布于 2024-11-14 10:21:07 字数 1734 浏览 4 评论 0原文

我正在尝试实现我在这篇文章中看到的内容: TFS 和 msbuild 版本最后一个变更集的编号。也就是说,我试图在构建时获取最后一个变更集编号,以便可以在 AssemblyVersionInfo.cs 中使用它。

我正在使用 VS 2008 和 TFS 2008。我已经安装了 MSBuild Extension pack v3.5.9.0 (x64)。它位于 C:\Program Files\MSBuild\ExtensionPack 中。这是我的 MSBuild 项目:

<Project ToolsVersion="3.5" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="C:\Program Files\MSBuild\ExtensionPack\MSBuild.ExtensionPack.tasks"/>
  <Target Name="Default">
    <TfsVersion  TfsLibraryLocation="C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies"
                 LocalPath="$(SolutionRoot)">
      <Output TaskParameter="Changeset" PropertyName="ChangesetNumber"/>
    </TfsVersion>
    <Message Text="TFS ChangeSetNumber: $(ChangesetNumber)" />
  </Target>
</Project>

这是我运行脚本的方式:

C:\Build\TeamBuildTypes\Nightly_Main>MSbuild test.proj

这是我的错误消息:

C:\Build\TeamBuildTypes\Nightly_Main\test.proj(4,5): error MSB4062: The "MSBuild.ExtensionPack.VisualStudio.TfsVersion" task could not be loaded from the asse
mbly C:\Program Files (x86)\MSBuild\ExtensionPack\MSBuild.ExtensionPack.dll. Could not load file or assembly 'file:///C:\Program Files (x86)\MSBuild\ExtensionPack\MSBuild.ExtensionPack.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, and that the assembly and all its dependencies are available.

感谢任何帮助。

谢谢, 斯科特

I am trying to implement what I see in this post: TFS and msbuild version number with last changeset. That is, I am trying to get the last Changeset number at build time so I can use it in an AssemblyVersionInfo.cs.

I am using VS 2008 and TFS 2008. I have installed MSBuild Extension pack v3.5.9.0 (x64). It is in C:\Program Files\MSBuild\ExtensionPack. Here is my MSBuild project:

<Project ToolsVersion="3.5" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="C:\Program Files\MSBuild\ExtensionPack\MSBuild.ExtensionPack.tasks"/>
  <Target Name="Default">
    <TfsVersion  TfsLibraryLocation="C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies"
                 LocalPath="$(SolutionRoot)">
      <Output TaskParameter="Changeset" PropertyName="ChangesetNumber"/>
    </TfsVersion>
    <Message Text="TFS ChangeSetNumber: $(ChangesetNumber)" />
  </Target>
</Project>

Here is how I am running the script:

C:\Build\TeamBuildTypes\Nightly_Main>MSbuild test.proj

Here is my error message:

C:\Build\TeamBuildTypes\Nightly_Main\test.proj(4,5): error MSB4062: The "MSBuild.ExtensionPack.VisualStudio.TfsVersion" task could not be loaded from the asse
mbly C:\Program Files (x86)\MSBuild\ExtensionPack\MSBuild.ExtensionPack.dll. Could not load file or assembly 'file:///C:\Program Files (x86)\MSBuild\ExtensionPack\MSBuild.ExtensionPack.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, and that the assembly and all its dependencies are available.

Any help appreciated.

Thanks,
Scott

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

最佳男配角 2024-11-21 10:21:07

看起来 MSBuild.ExtensionPack.tasks 正在尝试查找库而不是它们所在的位置。您可以打开此文件并将其添加到文件顶部

<ExtensionTasksPath>C:\Program Files\MSBuild\ExtensionPack\</ExtensionTasksPath>

以代替其他 ExtensionTasksPath 声明(只需注释它们并添加它)。这应该可以解决路径问题。
我假设存在 C:\Program Files\MSBuild\ExtensionPack\MSBuild.ExtensionPack.dll

Looks like MSBuild.ExtensionPack.tasks is trying to find libraries not where they are located. You can open this file and add this in the top of the file

<ExtensionTasksPath>C:\Program Files\MSBuild\ExtensionPack\</ExtensionTasksPath>

in place of other ExtensionTasksPath declarations (just comment them and add this). This should fix the paths problem.
I assume that there exists C:\Program Files\MSBuild\ExtensionPack\MSBuild.ExtensionPack.dll

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文