Asp.net mvc 4 MSBuild目标在服务器上失败,但在本地成功

Asp.net mvc 4 MSBuild目标在服务器上失败,但在本地成功,asp.net-mvc-4,msbuild,csproj,Asp.net Mvc 4,Msbuild,Csproj,对于我们的web项目,我需要项目的程序集版本来对静态内容进行版本设置 我在web项目文件中声明了一个目标,以获取程序集标识并从中检索版本号,如: <PropertyGroup> <IvanhoWebVersion> </IvanhoWebVersion> </PropertyGroup> <Target Name="SetIvanhoWebVersion" AfterTargets="AfterBuild">

对于我们的web项目,我需要项目的程序集版本来对静态内容进行版本设置

我在web项目文件中声明了一个目标,以获取程序集标识并从中检索版本号,如:

<PropertyGroup>
    <IvanhoWebVersion>
    </IvanhoWebVersion>
  </PropertyGroup>
  <Target Name="SetIvanhoWebVersion" AfterTargets="AfterBuild">
    <Message Text="-----------------">
    </Message>
    <Message Text="Entering target SetIvanhoWebVersion">
    </Message>
    <Message Text="-----------------">
    </Message>
    <GetAssemblyIdentity AssemblyFiles="$(OutputPath)$(AssemblyName).dll">
      <Output TaskParameter="Assemblies" ItemName="AssemblyIdentities" />
    </GetAssemblyIdentity>
    <CreateProperty value="%(AssemblyIdentities.Version)">
      <Output TaskParameter="Value" PropertyName="IvanhoWebVersion" />
    </CreateProperty>
    <Message Text="Assembly version = v$(IvanhoWebVersion)">
    </Message>
    <Exec Command=" &quot;$(SolutionDir)Ivanho.Lib\TranslationGenerator\TranslationGenerator.exe&quot; &quot;$(ProjectDir)Areas\UI\Static\locales\translationsrc\Translations-EN-NL-AR.xlsx&quot; &quot;$(ProjectDir)Areas\UI\Static\locales\v.$(IvanhoWebVersion)&quot;" />
  </Target>

这在本地构建时非常有效,但是当尝试将其签入我们的TFS构建服务器时,它会失败,并出现以下错误:

无法获取“bin\Ivanho.Web.dll”的程序集名称。无法加载文件 或程序集“Ivanho.Web.dll”或其依赖项之一。系统 找不到指定的路径

此错误在
GetAssemblyIdentity
调用的同一行抛出


我不明白为什么这在构建服务器上不起作用,我对MSBuild很陌生,有人能给我指出正确的方向吗?非常感谢

文件不存在或路径错误。 查看构建服务器以查看文件是否在那里。您可以使用ConvertToAbsolutionPath任务确定某些路径,请参见:。您可以输入错误语句来检查文件,例如

<Error Condition="!Exists('$(OutputPath)$(AssemblyName).dll')" Text="FileNotFound"/>