aspnet / aspnet-docker

[Archived] ASP.NET Core Docker images for 1.x. Go to https://github.com/dotnet/dotnet-docker for 2.1 and up.
https://asp.net
719 stars 171 forks source link

2.0 Preview 2 images don't appear to run against project compiled against 2.0 preview 2 #261

Closed cmaslen closed 7 years ago

cmaslen commented 7 years ago

After updating my SDK (and companion VS version) to Core 2.0 preview 2 running any ASP.NET Core app in the aspnet-docker container fails. I have tried the following images:

Steps to reproduce the issue

(e.g. copy your Dockerfile or docker-compose.yml file here)

  1. After downloading VS 2017 (15.3.0 Preview 3.0), create new Web API project with Docker support.
  2. Running the app works fine at this point, but VS defaults to targeting .NET Core 1.1.
  3. Change web project to target .NET Core 2.0. At this point running in Docker fails because the target runtime is later than the installed runtime (fair enough)
  4. Change Dockerfile to use one of the 2.0.0 images (above).

Expected behavior

The application runs as before. The browser window launches pointing to the running app inside the Docker container.

Actual behavior

We get the following exception: System.AggregateException occurred HResult=0x80131500 Message=One or more errors occurred. Source= StackTrace:

Inner Exception 1: DllNotFoundException: Unable to load DLL 'libuv': The specified module or one of its dependencies could not be found. (Exception from HRESULT: 0x8007007E) ## Additional information (e.g. issue happens only occasionally) Reproducible every time. I also uninstalled preview 1 for version 2.0. ## Output of `dotnet --info` ```# dotnet --info Microsoft .NET Core Shared Framework Host Version : 2.0.0-preview2-25407-01 Build : 40c565230930ead58a50719c0ec799df77bddee9
natemcmaster commented 7 years ago

Can you share your csproj file as well?

cmaslen commented 7 years ago

Hi @natemcmaster,

Thanks for the reply. Below is the project file:

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

  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
  </PropertyGroup>

  <ItemGroup>
    <Folder Include="wwwroot\" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
    <PackageReference Include="Microsoft.AspNetCore" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
  </ItemGroup>

  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1" />
  </ItemGroup>

</Project>

Also the output of dotnet --info from my own machine which I've noticed is different to the version in the Docker container.

.NET Command Line Tools (2.0.0-preview2-006497)

Product Information:
 Version:            2.0.0-preview2-006497
 Commit SHA-1 hash:  06a2093335

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.14393
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.0.0-preview2-006497\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0-preview2-25407-01
  Build    : 40c565230930ead58a50719c0ec799df77bddee9
natemcmaster commented 7 years ago

You project is still using AspNetCore 1.1 packages. Upgrade your PackageReference's to 2.0.0-preview2.

cmaslen commented 7 years ago

Hi @natemcmaster,

That appears to have fixed it although the exact versions are not all preveiw2. Below is my corrected project file:

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

  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
  </PropertyGroup>

  <ItemGroup>
    <Folder Include="wwwroot\" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
    <PackageReference Include="Microsoft.AspNetCore" Version="2.0.0-preview2-final" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0-preview2-final" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0-preview2-final" />
  </ItemGroup>

  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1" />
  </ItemGroup>

</Project>

Thanks again. I'll try to track down a VS forum to raise the bug in since a project file should not require manual editing when using VS.