docker / for-win

Bug reports for Docker Desktop for Windows
https://www.docker.com/products/docker#/windows
1.85k stars 287 forks source link

RUN ["dotnet", "restore"] doesn't restore NuGet packages #1668

Closed wijnandhonselaar closed 6 years ago

wijnandhonselaar commented 6 years ago

Expected behavior

Expected the buildstep to restore the NuGet packes that are declared in the .csproj and packages.config

Actual behavior

Buildstep returns:

Step 4/9 : RUN ["dotnet", "restore"]
 ---> Running in 8f1ff4a32ebe
  Nothing to do. None of the projects specified contain packages to restore.
Removing intermediate container 8f1ff4a32ebe
 ---> d634ff16c200

Information

Diagnostic ID: 14C5988D-1D4C-486F-978A-73F349750EAF/2018-02-07_13-07-32

I can't find any decent documentation on how to collect my NuGet packages as a docker build step and this is clearly not working like expected. The project is part of a simple small Visual Studio Solution with other .NET Framework 4.6.2 projects.

Dockerfile:

FROM microsoft/dotnet-framework-build:4.7.1 as build-env

WORKDIR /app
COPY . /app

RUN ["dotnet", "restore"]
#Change output path from build to /app/out
RUN ["dotnet", "build"]

FROM microsoft/dotnet-framework:4.7.1
WORKDIR /app
#Change from patch to build-env /app/out
COPY --from=build-env /app .

ENTRYPOINT ["MessageProcessor.exe"]

packages.config:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="GreenPipes" version="1.2.1" targetFramework="net462" />
  <package id="MassTransit" version="4.1.0.1406-develop" targetFramework="net462" />
  <package id="MassTransit.RabbitMQ" version="4.1.0.1406-develop" targetFramework="net462" />
  <package id="Microsoft.Diagnostics.Tracing.EventSource.Redist" version="1.1.28" targetFramework="net462" />
  <package id="NewId" version="3.0.1" targetFramework="net462" />
  <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net462" />
  <package id="Newtonsoft.Json.Bson" version="1.0.1" targetFramework="net462" />
  <package id="RabbitMQ.Client" version="5.0.1" targetFramework="net462" />
  <package id="System.Reflection.Emit.Lightweight" version="4.3.0" targetFramework="net462" />
  <package id="whonselaar.Message.EventTypes" version="1.0.0" targetFramework="net462" />
</packages>

MessageProcessor.csproj: (same packages as packages.config


  <ItemGroup>
    <Reference Include="GreenPipes, Version=1.2.1.98, Culture=neutral, PublicKeyToken=b800c4cfcdeea87b, processorArchitecture=MSIL">
      <HintPath>..\packages\GreenPipes.1.2.1\lib\net452\GreenPipes.dll</HintPath>
    </Reference>
    <Reference Include="..." etc..></Reference>
</ItemGroup>

System specs

Application is .NET Framework 4.6.2 Tested with the most recent Docker stable and edge releases (17.12.0-ce-win47 & 18.02.0-ce-rc2) Windows 10 Enterprise 1709

Steps to reproduce the behavior

  1. git pull https://github.com/wijnandhonselaar/EventDrivenMessenger.git
  2. cd EventDrivenMessenger/MessageProcessor
  3. docker build -t messageprocessor .
pgayvallet commented 6 years ago

Hello,

The build steps are correctly executed and I can't find any decent documentation on how to collect my NuGet packages as a docker build step doesnt really looks like an Docker4Win issue.

docker-robott commented 4 years ago

Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle locked