Kudu: error MSB4057: The target "_GenerateRestoreGraphProjectEntry" does not exist in the project.

Created on 18 Dec 2016  路  8Comments  路  Source: projectkudu/kudu

Get this error when trying to deploy a .Net Core project (generated by VS 2017 RC) to an azure web app from a github repository. Not really sure what it refers to, but here's the full log:

Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling ASP.NET Core Web Application deployment.
D:\home\site\repository\src\WebApplication1.csproj : error MSB4057: The target "_GenerateRestoreGraphProjectEntry" does not exist in the project.
Failed exitCode=1, command=dotnet restore "WebApplication1.sln"
An error has occurred during web site deployment.
\r\nD:\Program Files (x86)\SiteExtensions\Kudu\59.51212.2600\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"

When performing the mentioned command (dotnet restore) locally, it seems to work as expected.

Most helpful comment

Thanks for your repository, yup its a version problem:

D:\websitetest>dotnet restore
D:\websitetest\src\WebApplication1\WebApplication1.csproj : error MSB4057: The target "_GenerateRestoreGraphProjectEntry" does not exist in the project.

D:\websitetest>"C:\dotnet-dev-win-x64.latest\dotnet.exe" restore

Welcome to .NET Core!
---------------------
....

the reason that publish profile works is because VS build your project locally and then push it to azure whereas github deployment gets the source code and build your project remotely (in azure, with azure's build tools)

I will try to get you the schedule for azure's build tool updates
meanwhile if you need CI, you can probably work around this issue by uploading the latest dotnet cli (it's just some executables) to azure and change the build path.
I will need to test this solution and let you know later?

All 8 comments

Is your dotnet cli version 1.0.0-preview4-004233 as described in this stackoverflow thread?
can you run dotnet msbuild at command line?, I want to know your msbuild version:

C:\>dotnet --version
1.0.0-preview4-004079

C:\>dotnet msbuild
Microsoft (R) Build Engine version 15.1.0.0
Copyright (C) Microsoft Corporation. All rights reserved.

I suspect that Azure's msbuild is not up to date with your VS, which can be the cause of this issue
But just in case, can you share a github repository that highlights your project structure so that I can try to reproduce the issue at my end, thanks

@watashiSHUN Hi. Here's the output from dotnet msbuild:

>dotnet msbuild
Microsoft (R) Build Engine version 15.1.458.808
Copyright (C) Microsoft Corporation. All rights reserved.

and dotnet --version

>dotnet --version
1.0.0-preview4-004233

I created a new asp.net core project using the template in Visual Studio 2017 RC (including the Web Api template). I Restored the Nuget packages, and then updated them to the latest (1.1.0). I also changed the csproj file to target .net core 1.1.
Here is a link to the repository: https://github.com/michaeldaw/websitetest

I created a new azure web app and set up the deployment options to source from that github repository. Here is a screenshot of the deployment process:
image

When I clicked on the "View Log" link for the final failed step, this log appeared:
image

It sounds like you're right about the msbuild version being behind on Azure.

Also, I wanted to mention that if I publish the project using a Publish Profile (generated in Visual Studio), it deploys the app correctly. This is why, if you navigate to the website shown in the screenshots (http://websitetest000.azurewebsites.net/api/values) you'll see the web api working.

I hope this is of some help. Let me know if there's more I can do.

Thanks for your repository, yup its a version problem:

D:\websitetest>dotnet restore
D:\websitetest\src\WebApplication1\WebApplication1.csproj : error MSB4057: The target "_GenerateRestoreGraphProjectEntry" does not exist in the project.

D:\websitetest>"C:\dotnet-dev-win-x64.latest\dotnet.exe" restore

Welcome to .NET Core!
---------------------
....

the reason that publish profile works is because VS build your project locally and then push it to azure whereas github deployment gets the source code and build your project remotely (in azure, with azure's build tools)

I will try to get you the schedule for azure's build tool updates
meanwhile if you need CI, you can probably work around this issue by uploading the latest dotnet cli (it's just some executables) to azure and change the build path.
I will need to test this solution and let you know later?

Thanks @watashiSHUN. The difference in where the project is built between CI and publishing didn't occur to me.
I'll find some time to try uploading the CLI. Seems like a valuable technique. As for testing it out yourself, I wouldn't go too far out of your way on my account. I'm satisfied with being able to use a publish profile for the time being. If it's simply a matter of time until the azure build tools are updated, then I can wait.
However, since .net core seems to be undergoing a lot of changes lately, I imagine people will continue to run in to issues like this. If there's some way to allow users to select/update their msbuild or cli version from the portal interface, it would probably solve some problems.

I'm seeing the same issue. Tried updating global.json with "version": "1.0.0-preview4-004233" with no luck.

Please keep us updated!


EDIT: now it works!

This issue also affects the default docker-image. which we use for running CI on bitbucket/pipelines. Everything works just fine using project.json files.

Locally the project works using msbuild and

dotnet --version
1.0.0-preview4-004233

Pipelines file:

image: microsoft/dotnet:1.1.0-sdk-msbuild
 branches:
    feature/*:
      - step:
          script: # We only test features, no deployment
            - dotnet --version
            - dotnet restore project.sln

output:

dotnet --version
+ dotnet --version
1.0.0-preview3-004056
Completed at 2017-01-03T13:00:08Z

dotnet restore Frontstage.sln
+ dotnet restore Frontstage.sln
==/opt/atlassian/pipelines/agent/build/src/OurProject/ourproject.csproj : error MSB4057: The target "_GenerateRestoreGraphProjectEntry" does not exist in the project.

Is there anywhere I can find a road-map or timeline suggesting when this will fixed?

Thanks.

@mikkel-busch not sure I understand your scenario. Are you even using Kudu here?

Preview4 tooling is now available on App Service, so this should now work for Kudu users.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

estei picture estei  路  3Comments

thomassondergaard picture thomassondergaard  路  5Comments

suwatch picture suwatch  路  6Comments

jonsagara picture jonsagara  路  8Comments

martinstenhoff picture martinstenhoff  路  6Comments