SteeltoeOSS / Connectors

Connectors simplify connecting to standalone and CloudFoundry services
https://steeltoe.io/docs/steeltoe-connectors/
Apache License 2.0
27 stars 13 forks source link

Support for .NET Core 2.1? #25

Closed thnk2wn closed 5 years ago

thnk2wn commented 5 years ago

I see the readme mentions Core 2.0 and I'm targeting 2.1. Should it work with 2.1 or are changes required?

When I push and run the app I see this error:

An assembly specified in the application dependencies manifest (my-app.deps.json) was not found: package: 'Microsoft.AspNetCore.Hosting.Abstractions', version: '2.0.0'

Currently my project file looks like this:


<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <RuntimeIdentifiers>win7-x64;linux-x64</RuntimeIdentifiers>
    <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
    <RootNamespace>myapp</RootNamespace>
  </PropertyGroup>

  <PropertyGroup>
    <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.1" />
    <PackageReference Include="RabbitMQ.Client" Version="5.1.0" />
    <PackageReference Include="Steeltoe.CloudFoundry.ConnectorCore" Version="2.1.1" />
  </ItemGroup>

</Project>
cf-gitbot commented 5 years ago

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

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

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

TimHess commented 5 years ago

Steeltoe works with .NET Core 2.0+, you should not have any issues using 2.1.

That error can probably be fixed by how you publish/push the app - for a quick resolution, you could try running dotnet publish before you cf push (some related reading https://github.com/dotnet/coreclr/issues/13542)

thnk2wn commented 5 years ago

@TimHess Thanks.

I looked into that post and similar before and tried various changes to no avail.

I'm already doing a publish before cf push.

I put the very small reference app at https://github.com/thnk2wn/pcf-river-flow-processor.

First I do a publish with:

> dotnet publish -r linux-x64 -c Release
Microsoft (R) Build Engine version 15.8.166+gd4e8d81a88 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 100.91 ms for C:\Source\Tools\river-flow-processor\river-flow-processor.csproj.
  river-flow-processor -> C:\Source\Tools\river-flow-processor\bin\Release\netcoreapp2.1\linux-x64\river-flow-processor.dll
  river-flow-processor -> C:\Source\Tools\river-flow-processor\bin\Release\netcoreapp2.1\linux-x64\publish\

And then a push with:

> cf push
Pushing from manifest to org sandbox / space dev as user@domain.com...
Using manifest file C:\Source\Tools\river-flow-processor\manifest.yml
Getting app info...
Updating app with these attributes...
  name:                river-flow-processor
  path:                C:\Source\Tools\river-flow-processor\bin\Release\netcoreapp2.1\linux-x64
  buildpacks:
    https://github.com/cloudfoundry/dotnet-core-buildpack.git
  command:             cd ${HOME} && exec ./river-flow-processor --server.urls http://0.0.0.0:${PORT}
  disk quota:          150M
  health check type:   process
  instances:           1
  memory:              128M
  stack:               cflinuxfs2
  services:
    queue-svc

Updating app river-flow-processor...
Comparing local files to remote cache...
Packaging files to upload...
Uploading files...
 1.09 MiB / 1.09 MiB [=========================================================================================================================] 100.00% 1s  1.09 MiB / 1.09 MiB [=========================================================================================================================] 100.00% 1s Waiting for API to complete processing files...

Stopping app...

Staging app and tracing logs...
   Cell ff2d5da4-d2c6-4153-9c11-9346a7748070 creating container for instance a0a45c33-0cb5-45e2-924d-426ff3b1a5db
   Cell ff2d5da4-d2c6-4153-9c11-9346a7748070 successfully created container for instance a0a45c33-0cb5-45e2-924d-426ff3b1a5db
   Downloading build artifacts cache...
   Downloading app package...
   Downloaded app package (28.6M)
   Downloaded build artifacts cache (104.3M)
   -----> Download go 1.9.1
   -----> Running go build supply
   -----> Dotnet-Core Buildpack version 2.2.0
   -----> Supplying Dotnet Core
   -----> Installing libunwind 1.2.1
          Copy [/tmp/cache/final/dependencies/931e8e87ceb16f6aa1ad99433f838ebb0c19470e08865b23d4bfcf17c8176cef/libunwind-1.2.1-cflinuxfs2-db7f7257.tar.gz]
          using the default SDK
   -----> Installing dotnet-sdk 2.1.403
          Copy [/tmp/cache/final/dependencies/35c51b8086dc1170cf2899b556c69dfba8114426799464c925f01c0bc0c9cb36/dotnet-sdk.2.1.403.linux-amd64-cflinuxfs2-ccd3f8eb.tar.xz]
   -----> Installing dotnet-runtime 2.1.5
          Copy [/tmp/cache/final/dependencies/650512bc41448aa057d7dd44117040d5e275e93cb7dba04fba120c665e65b607/dotnet-runtime.2.1.5.linux-amd64-cflinuxfs2-19b6620a.tar.xz]
   -----> Running go build finalize
   -----> Finalizing Dotnet Core
   -----> Cleaning staging area
          Removing dotnet-sdk
   Exit status 0
   Uploading droplet, build artifacts cache...
   Uploading droplet...
   Uploading build artifacts cache...
   Uploaded build artifacts cache (104.3M)
   Uploaded droplet (29.4M)
   Uploading complete
   Cell ff2d5da4-d2c6-4153-9c11-9346a7748070 stopping instance a0a45c33-0cb5-45e2-924d-426ff3b1a5db
   Cell ff2d5da4-d2c6-4153-9c11-9346a7748070 destroying container for instance a0a45c33-0cb5-45e2-924d-426ff3b1a5db

Waiting for app to start...
Start unsuccessful

TIP: use 'cf.exe logs river-flow-processor --recent' for more information
FAILED

Perhaps I need to explicitly add a reference to an asp.net core dependency? I'm not actually using web assemblies directly in my console app, they're coming in via Steeltoe.

thnk2wn commented 5 years ago

Sorry I think this was user error on my part. I had my manifest path set to bin\Release\netcoreapp2.1\linux-x64 instead of bin\Release\netcoreapp2.1\linux-x64\publish