开发者

MSBuild, Extension Pack and TfsVersion

开发者 https://www.devze.com 2023-03-11 08:38 出处:网络
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 开发者_如何学JAVAthe last Changeset number at build time so I can use i

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 开发者_如何学JAVAthe 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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消