1

For test purposes I wrote an little ASP.NET Core Web API project, set the .csproj to contain this:

<PropertyGroup>
  <TargetFramework>netcoreapp2.0</TargetFramework>
  <RuntimeFrameworkVersion>2.0.0</RuntimeFrameworkVersion>
</PropertyGroup>

When I push this project to CF it installs "dotnet-framework 2.0.0" as it should, but in addition it tries to install "dotnet-framework 2.0.6" which is not available in the CloudFoundry environment I am using (MindSphere) and is therefore failing.

Why is CF trying to install multiple .NET Core versions? And where could that 2.0.6 come from or how to tell the CloudFoundry buildpack explicitly which version to use?

Karen Tamrazyan
  • 157
  • 1
  • 11
ThisWillDoIt
  • 340
  • 7
  • 22

1 Answers1

1

TIL the project template adds a .NET Core CLI extenstion to the .csproj. This package is not recogniced by the NuGet package manager and therefore it is hard to miss.

But the real probelm is that this package is not bound to the specified "RuntimeFrameworkVersion" but has its own dependencies and loads them no matter what. In my case the extension had an dependency on 2.0.6 which it tried to load in addition to my specified version 2.0.0

Because the added CLI extension is not needed for the app in production the solution was to remove this paragraph from the .csproj...

<ItemGroup>
  <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.3" />
</ItemGroup>
ThisWillDoIt
  • 340
  • 7
  • 22