【问题标题】:error MSB4102: The value "" of the "Project" attribute in element <Import> is invalid. Parameter "path" cannot have zero length. F#错误 MSB4102:元素 <Import> 中“Project”属性的值“”无效。参数“路径”的长度不能为零。 F#
【发布时间】:2016-11-15 12:52:51
【问题描述】:

我在 Team city 中构建项目时遇到以下错误。

同一项目正在本地计算机上构建。本地机器有VS 2015和F# 4.0。

我的项目配置如下。

<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />


    <Choose>
        <When Condition="'$(VisualStudioVersion)' == '11.0'">
          <PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\4.0\Framework\v4.0\Microsoft.FSharp.Targets')">
            <FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\4.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
          </PropertyGroup>
        </When>
        <Otherwise>
          <PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets')">
            <FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
          </PropertyGroup>
        </Otherwise>
      </Choose>
      <Import Project="$(FSharpTargetsPath)" />

这是控制台应用程序。

【问题讨论】:

标签: f# teamcity canopy-web-testing


【解决方案1】:

前段时间我遇到了类似的问题,因为我使用管理员权限运行本地计算机,但 Visual Studio 安装程序已将环境变量设置为 user 级别,而不是管理员使用的 system 级别。因此,当以管理员身份编译时,FSharpTargetsPath 没有从环境变量(如VisualStudioVersion)正确构建。

在您的本地机器上查看在您成功使用的级别(系统或用户)为VisualStudioVersion 设置了哪些环境变量值,以及其他变量,然后检查这些是否设置为相应的Team City 机器上的关卡。

也许您在本地计算机上以 user 身份运行,而在 Team City 计算机上以 System 身份运行。

在此处查看详细信息:https://stackoverflow.com/a/21420306/152739

我希望这是有道理的。

【讨论】:

  • 嗨,斯科特,感谢您的快速回复!问题出在团队城市用作构建参考的代理上。该代理机器没有安装一些依赖项。比如,F# 4.0
  • 有人会如何确认或改变这一点?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-11-04
  • 2013-03-28
  • 2018-05-01
  • 2016-03-15
  • 2012-03-18
  • 1970-01-01
  • 2016-11-26
相关资源
最近更新 更多