cloudfoundry / dotnet-core-buildpack

Cloud Foundry buildpack for .NET Core on Linux
http://docs.cloudfoundry.org/buildpacks/
Apache License 2.0
91 stars 90 forks source link

The specified framework 'Microsoft.AspNetCore.All', version '2.1.1' was not found. #188

Closed mjnorman closed 6 years ago

mjnorman commented 6 years ago

What version of Cloud Foundry and CF CLI are you using? (i.e. What is the output of running cf curl /v2/info && cf version? cf version 6.35.0+5c7de3e32.2018-03-08

What version of the buildpack you are using? latest

If you were attempting to accomplish a task, what was it you were attempting to do? Push an app with AspNetCore.App 2.1.x

global.json:

 "sdk": {
    "version": "2.1.300"

csproj (also tried not locking version number see dotnetcli issue (https://github.com/dotnet/cli/issues/9519):

    <PackageReference Include="Microsoft.AspNetCore.All" />
    <PackageReference Include="Microsoft.AspNetCore.App">
      <Version>2.1.*</Version>
    </PackageReference>

What did you expect to happen? Successful push

What was the actual behavior?

2018-06-21T20:16:37.940-05:00 [STG/0] [OUT] -----> Download go 1.9.1 2018-06-21T20:20:13.876-05:00 [STG/0] [OUT] -----> Running go build supply 2018-06-21T20:20:29.544-05:00 [STG/0] [OUT] -----> Dotnet-Core Buildpack version 2.1.1 2018-06-21T20:20:29.544-05:00 [STG/0] [OUT] -----> Supplying Dotnet Core 2018-06-21T20:20:29.831-05:00 [STG/0] [OUT] -----> Installing libunwind 1.2.1 2018-06-21T20:20:29.831-05:00 [STG/0] [OUT] Copy [/tmp/cache/final/dependencies/10049b6ebf7e832b899ad805e311c53dfb50e6987726fb32743145262e3f3a74/libunwind-1.2.1-linux-x64-80af276a.tgz] 2018-06-21T20:20:29.883-05:00 [STG/0] [OUT] -----> Installing dotnet 2.1.300 2018-06-21T20:20:29.883-05:00 [STG/0] [OUT] Copy [/tmp/cache/final/dependencies/d5cfac8804902b8f8ffec7494b264cba116d94b233e81a78e4ca0e395c355739/dotnet.2.1.300.linux-amd64-a35910c5.tar.xz] 2018-06-21T20:24:46.698-05:00 [STG/0] [OUT] -----> Running go build finalize 2018-06-21T20:24:51.456-05:00 [STG/0] [OUT] -----> Finalizing Dotnet Core 2018-06-21T20:24:51.456-05:00 [STG/0] [OUT] Required dotnetframework versions: [2.1.0] 2018-06-21T20:24:51.456-05:00 [STG/0] [OUT] Using dotnet framework installed in /tmp/contents579879306/deps/0/dotnet/shared/Microsoft.NETCore.App/2.1.0 ................. 2018-06-21T20:33:41.457-05:00 [APP/PROC/WEB/0] [ERR] It was not possible to find any compatible framework version 2018-06-21T20:33:41.458-05:00 [APP/PROC/WEB/0] [ERR] The specified framework 'Microsoft.AspNetCore.All', version '2.1.1' was not found. 2018-06-21T20:33:41.458-05:00 [APP/PROC/WEB/0] [ERR] - Check application dependencies and target a framework version installed at: 2018-06-21T20:33:41.458-05:00 [APP/PROC/WEB/0] [ERR] /home/vcap/deps/0/dotnet/ 2018-06-21T20:33:41.458-05:00 [APP/PROC/WEB/0] [ERR] - Installing .NET Core prerequisites might help resolve this problem: 2018-06-21T20:33:41.458-05:00 [APP/PROC/WEB/0] [ERR] http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409 2018-06-21T20:33:41.458-05:00 [APP/PROC/WEB/0] [ERR] - The .NET Core framework and SDK can be installed from: 2018-06-21T20:33:41.458-05:00 [APP/PROC/WEB/0] [ERR] https://aka.ms/dotnet-download 2018-06-21T20:33:41.458-05:00 [APP/PROC/WEB/0] [ERR] - The following versions are installed: 2018-06-21T20:33:41.458-05:00 [APP/PROC/WEB/0] [ERR] 2.1.0 at [/home/vcap/deps/0/dotnet/shared/Microsoft.AspNetCore.All]

Please confirm where necessary:

cf-gitbot commented 6 years ago

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/158546755

The labels on this github issue will be updated when the story is started.

sclevine commented 6 years ago

Thanks for the report @mjnorman.

Are you pushing a published app, or just source code? Can you provide a stripped-down version of the app that demonstrates the staging failure?

mjnorman commented 6 years ago

This was with a published project. Oddly enough if I push from the main project directory without doing a publish, I don't receive any errors and the app runs.

I was able to recreate via "dotnet new webapi", add reference to Microsoft.AspNetCore.All with no version reference.

Package pushed with

dotnet publish -c Release
cd/to/dir
cf push Repro -b https://github.com/cloudfoundry/dotnet-core-buildpack.git

Leads to the same AspNetCore.All errors mentioned above. Repro can be found here, https://github.com/mjnorman/DotNetCoreAllRepro

tylerphelan commented 6 years ago

@mjnorman The current latest dotnet core buildpack does not contain the 2.1.1 dotnet runtime. We will release a new buildpack with that dependency soon. In the meantime, pushing the app un-published should work. You could also try publishing as a self contained app.

mjnorman commented 6 years ago

Ok I see the issue now. Since I am running this from a concourse pipeline, and issuing the publish from the latest microsoft/dotnet docker image (which has 2.1.1), it is expecting it to be there when the buildpack runs. Thanks for the help!