MSBuild、扩展包和 TfsVersion
我正在尝试实现我在这篇文章中看到的内容: 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来 MSBuild.ExtensionPack.tasks 正在尝试查找库而不是它们所在的位置。您可以打开此文件并将其添加到文件顶部
以代替其他
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
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