简体   繁体   English

错误MSB4102:元素中“Project”属性的值“” <Import> 是无效的。 参数“path”的长度不能为零。 F#

[英]error MSB4102: The value “” of the “Project” attribute in element <Import> is invalid. Parameter “path” cannot have zero length. F#

I am getting following error while building project in Team city. 我在Team city中构建项目时遇到以下错误。

Same project is getting build on Local machine. 同一个项目正在本地机器上构建。 Local machine has VS 2015 and F# 4.0. 本地机器有VS 2015和F#4.0。

My Project Configuration is as below. 我的项目配置如下。

<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)" />

This is Console application. 这是控制台应用程序。

I had a similar problem a while back, because I was running the local machine with Administrator privileges, but the Visual Studio installer had set environment variables at the user level and not the system level which Administrator uses. 我有一个类似的问题,因为我在运行具有管理员权限的本地计算机,但Visual Studio安装程序已在user级别设置环境变量,而不是管理员使用的system级别。 So when compiling as Administrator, the FSharpTargetsPath was not being correctly built from environment variables like VisualStudioVersion . 因此,在以管理员FSharpTargetsPath进行编译时,无法从VisualStudioVersion等环境变量正确构建FSharpTargetsPath

Have a look on your local machine to see what environment variables values are set for VisualStudioVersion at the level you are successfully using (System or User), as well as other variables and then check that these are set at the corresponding level on the Team City machine. 查看本地计算机,查看在您成功使用的级别(系统或用户)上为VisualStudioVersion设置的环境变量值,以及其他变量,然后检查这些值是否在Team City的相应级别设置机。

Perhaps you are running as user on your local machine and System on the Team City machine. 也许您在本地计算机上运行user ,在Team City计算机上运行System

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

I hope this makes sense. 我希望这是有道理的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM