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.

MS Build error - The target "Rebuild" does not exist in the project

See original GitHub issue

Description

Checking out the project and building it using the build.cmd file.

My system info:

  • OS: Windows 8.1
  • IDE: Visual Studio 2017 Community, with F# support installed

Repro steps

  1. Checkout the repository, happens with master (9b1bc25) branch.
  2. Open command-line window and navigate to the checkout directory
  3. Execute build.cmd

Expected behavior

The build process completes without error.

Actual behavior

An error occurs in MSBuild, details below:

  1. Building I:\Projects\OSS\Paket\Paket.sln failed with exitcode 1.
  2. MSB4057: I:\Projects\OSS\Paket\tests\Paket.Tests\Paket.Tests.fsproj(0,0): The target “Rebuild” does not exist in the project.
  3. MSB4057: I:\Projects\OSS\Paket\src\Paket.Core\Paket.Core.fsproj(0,0): The target “Rebuild” does not exist in the project.
  4. MSB4057: I:\Projects\OSS\Paket\src\Paket\Paket.fsproj(0,0): The target “Rebuild” does not exist in the project.
  5. MSB4057: I:\Projects\OSS\Paket\integrationtests\Paket.IntegrationTests\Paket.IntegrationTests.fsproj(0,0): The target “Rebuild” does not exist in the proje ct.

The project is being checked out at I:\Projects\OSS\Paket

Known workarounds

None I can think of at the moment.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Thoriumcommented, Jun 27, 2019

To found the issue, I created my own Rebuild-target to the fsproj-file first:

<Target Name="Rebuild">
	<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 was that a project file was saying

  <PropertyGroup Condition="'$(VisualStudioVersion)' != '11.0'">
    <FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
  </PropertyGroup>

but with VS2019 the path was actually in VisualStudio\v$(MSBuildToolsVersion)\FSharp\ and not in VisualStudio\v$(VisualStudioVersion)\FSharp\ so

  <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>  

fixed it.

0reactions
Thoriumcommented, Jun 27, 2019

Seems to be back when VS2019 is installed.

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 >
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 >
MSBuild error MSB4057 after updating to VS 2019 16.10.0
After the update I'm getting the message error MSB4057: the target "Project1" does not exist in the project when I try the command...
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 >
Error MSB4057: The target “Package” does not exist in the ...
Error MSB4057: The target “Package” does not exist in the project ... Solution 1: if it's Project is not found ,then add a...
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