question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: The target "Build" does not exist in the project

See original GitHub issue

On MacOS the initial build.sh fails with this:

/usr/local/Cellar/mono/6.0.0.319/lib/mono/msbuild/15.0/bin/MSBuild.dll /bl:/var/folders/r1/xm_0s3y11td6zwk4mx8nplrw0000gn/T/tmpixxlW5.tmp.binlog /p:RestorePackages=False /p:Optimize=True /p:DebugSymbols=True /p:Configuration=Release /t:Build /v:q MyProject.sln
/Users/alex/Projects/MyProject/src/MyProject/MyProject.fsproj : error MSB4057: The target "Build" does not exist in the project.
/Users/alex/Projects/MyProject/src/MyProject/MyProject.fsproj : error MSB4057: The target "Build" does not exist in the project.
/Users/alex/Projects/MyProject/src/MyProject/MyProject.fsproj : error MSB4057: The target "Build" does not exist in the project.
/Users/alex/Projects/MyProject/src/MyProjectConsole/MyProjectConsole.fsproj : error MSB4057: The target "Build" does not exist in the project.
/Users/alex/Projects/MyProject/src/MyProjectConsole/MyProjectConsole.fsproj : error MSB4057: The target "Build" does not exist in the project.
: /Users/alex/Projects/MyProject/src/MyProject/MyProject.fsproj(0,0): error MSB4057: The target "Build" does not exist in the project.
: /Users/alex/Projects/MyProject/src/MyProjectConsole/MyProjectConsole.fsproj(0,0): error MSB4057: The target "Build" does not exist in the project.
Finished (Failed) 'MSBuild' in 00:00:02.1028417
Finished (Failed) 'Build' in 00:00:02.1050855

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Thoriumcommented, Oct 22, 2019

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>  
0reactions
wallymathieucommented, May 16, 2020

Looks like there hasn’t been any accepted pull requests in a while, so let’s ask about in the f# projects channel.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Target "build" does not exist in the project for Visual Studio
The problem was that I was using an old MSBuild (located in path %WINDIR%\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe ). When I tried to ...
Read more >
The target "Build" does not exist in the project. (MSB4057)
I notice this error in any VB.NET project that I try to compile (VS for Mac 7.2.2 build 11). A work around was...
Read more >
MSB4057: The target 'target name' does not exist ...
This error occurs when a target cannot be found, but it is referenced in a project file (such as in CallTarget , BeforeTargets...
Read more >
The target "Build" does not exist in the project - YouTube
c#: Visual Studio MacOS error MSB4057: The target " Build " does not exist in the project Thanks for taking the time to...
Read more >
The target “Build” does not exist in the project for Sitecore TDS ...
We need to update the scproj file – basically the TDS Project file – but Long story short – make sure that the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found