13

I am getting following error while building project in Team city.

Same project is getting build on Local machine. Local machine has VS 2015 and 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.

rmunn
  • 34,942
  • 10
  • 74
  • 105
Kunal Shah
  • 333
  • 2
  • 3
  • 9
  • 1
    Issue was on the Agent which the Team city was using as reference for doing build. That agent machine was not having some dependencies installed. Like, F# 4.0 – Kunal Shah Jul 13 '16 at 10:49
  • Does this answer your question? [External VS2013 build error "error MSB4019: The imported project was not found"](https://stackoverflow.com/questions/19718281/external-vs2013-build-error-error-msb4019-the-imported-project-path-was-not) – Jim G. Jun 02 '20 at 12:26

1 Answers1

6

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. So when compiling as Administrator, the FSharpTargetsPath was not being correctly built from environment variables like VisualStudioVersion.

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.

Perhaps you are running as user on your local machine and System on the Team City machine.

See details here: https://stackoverflow.com/a/21420306/152739

I hope this makes sense.

Community
  • 1
  • 1
Scott
  • 17,127
  • 5
  • 53
  • 64
  • 4
    Hi Scott, Thanks for quick reply! Issue was on the Agent which the Team city was using as reference for doing build. That agent machine was not having some dependencies installed. Like, F# 4.0 – Kunal Shah Jul 13 '16 at 10:47
  • How would someone confirm or change this? – WEFX Jun 15 '18 at 17:46