FSharp构建在MSBuild的失败,但在Visual Studio工程确定 [英] FSharp build fails in MSBuild, but works ok in Visual Studio

查看:661
本文介绍了FSharp构建在MSBuild的失败,但在Visual Studio工程确定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些项目在我的解决方案,其中也有F#项目。一切都建立在Visual Studio很好,但是当我试图用我的MSBuild服务器的TeamCity(这没有安装VS)来构建它,它引发以下生成错误:

I have a number of projects in my solution, among which also a F# project. Everything builds fine in Visual Studio, but when I try to build it with MSBuild on my TeamCity server (which does not have VS installed) it throws the following build error:

C:\TeamCity\buildAgent\work\42c74d8b9d19a844\FSharpEngine\MY_FSHARP_PROJECT.fsproj : error MSB4057: The target "Clean" does not exist in the project.
[16:27:58]Done Building Project "C:\TeamCity\buildAgent\work\42c74d8b9d19a844\Folder0\MY_FSHARP_PROJECT.fsproj" (Clean target(s)) -- FAILED.
[16:27:58]Done Building Project "C:\TeamCity\buildAgent\work\42c74d8b9d19a844\Folder1\REFERENCING_FSHARP_PROJECT.csproj" (Clean target(s)) -- FAILED.
[16:27:58]Done Building Project "C:\TeamCity\buildAgent\work\42c74d8b9d19a844\Folder2\UPPER_REFERENCING_FSHARP_PROJECT.csproj" (Rebuild target(s)) -- FAILED.
[16:27:58]Done Building Project "C:\TeamCity\buildAgent\work\42c74d8b9d19a844\Folder4\UPPER_UPPER_REFERENCING_FSHARP_PROJECT.csproj.metaproj" (Rebuild target(s)) -- FAILED.
[16:27:58]Done Building Project "C:\TeamCity\buildAgent\work\42c74d8b9d19a844\MY_SOLUTION.sln" (Rebuild target(s)) -- FAILED.
[16:27:58]Done Building Project "C:\TeamCity\buildAgent\work\42c74d8b9d19a844\MY_SOLUTION.sln.teamcity" (TeamCity_Generated_Build target(s)) -- FAILED.

我已经安装了TeamCity的服务器上的MSBuild工具和F#的框架,但我仍然不知道为什么这个错误被抛出。

I have installed MSBuild Tools and F# framework on my TeamCity server, but I still don't know why this error is thrown.

是不是有人遇到了这个错误,可以给我如何解决它一些线索? (我已经失去了一天,仍然没有运气)。

Did someone came across this error and can give me some clues on how to fix it? (I've lost a day already and still no luck).

推荐答案

我们有相同的使用 AutoFixture.AutoFoq ZeroToNine

我们所做的修改.fsproj文件。

What we did was to modify the .fsproj files.

首先,你必须添加

<TargetFSharpCoreVersion>4.3.0.0</TargetFSharpCoreVersion>

到第一个&LT;的PropertyGroup方式&gt;

其次,您替换

<Import Project="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets" Condition=" Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')" />

本:

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

最后,替换

<Reference Include="FSharp.Core, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">

<Reference Include="FSharp.Core, Version=$(TargetFSharpCoreVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">

如果你想看到这一背景下,您可以查看的ZeroToNine承诺,做上述

If you want to see this in context, you can review the ZeroToNine commit that does the above.

这篇关于FSharp构建在MSBuild的失败,但在Visual Studio工程确定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆