我有一个带有一些 NuGet 包引用的小型 .NET Framework 4.6.2 应用程序。执行时:docker build -t myapp .
我收到错误:Could not resolve this reference.
对于每个引用的 NuGet 包。
我试过了:
- 添加
RUN ["dotnet", "restore"]
以从 .csproj 恢复包 - 将图像标签更改为
:4.6.2
如何将 NuGet 包添加到构建过程?
谢谢你的时间!
Dockerfile:
FROM microsoft/dotnet-framework-build:4.7.1 as build-env
WORKDIR /app
COPY . /app
RUN ["dotnet", "build"]
FROM microsoft/dotnet-framework:4.7.1
WORKDIR /app
COPY --from=build-env /app .
ENTRYPOINT ["MessageProcessor.exe"]
构建步骤中单个引用的完整错误:
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2041,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "GreenPipes, Version=1.2.1.98, Culture=neutral, PublicKeyToken=b800c4cfcdeea87b, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\app\MessageProcessor.csproj]