Reputation: 7092
I'm trying to build simple F# console program, using FAKE build tool which include MSBuild tool, but I got the following:
FSProject.fsproj: error : Target named 'Build' not found in the project.
How can I resolve this?
I'm using VS2013 and .NET 4.5
Upvotes: 2
Views: 1844
Reputation: 5341
To found the issue, you can created your own Build-target to the fsproj-file first:
<Target Name="Build">
<Message Text="Ext = $(MSBuildExtensionsPath)" />
<Message Text="Tools = $(MSBuildToolsVersion)" />
<Message Text="msb32 = $(MSBuildExtensionsPath32)" />
<Message Text="targ = $(TargetFrameworkIdentifier)" />
<Message Text="fs = $(FSharpTargetsPath)" />
<Message Text="vs = $(VisualStudioVersion)" />
</Target>
The issue is probably that there is a condition saying something like
<PropertyGroup Condition="'$(VisualStudioVersion)' != '11.0'">
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
but with recent Visual Studio the condition is not met or the path is actually somewhere else,
like in VisualStudio\v$(MSBuildToolsVersion)\FSharp\
and not in VisualStudio\v$(VisualStudioVersion)\FSharp\
so as a quick fix
you can fallback it to something else like
<PropertyGroup Condition="'$(VisualStudioVersion)' != '11.0' And Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\')">
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
<PropertyGroup Condition="'$(VisualStudioVersion)' != '11.0' And Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(MSBuildToolsVersion)\FSharp\')">
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(MSBuildToolsVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
Upvotes: 0
Reputation: 7092
The problem was caused by the fact that FAKE build tool I used, uses older MSBuild tool version from c:\Windows\Microsoft.NET\Framework\v4.0.30319
. But VS2013 F# projects can be builded only with new version of MSBuild installed in [ProgramFilesX86]\MSBuild\12.0\bin
.
So, how to fix this issue in FAKE tool:
You should change FAKE.exe.config according to this
i.e. change MSBuildPath
setting to actual path.
Upvotes: 3