Good day everyone,
I'm trying to containerize my ASP.NET Core Application. In my previous projects, this sample docker file works perfectly fine.
FROM microsoft/dotnet:sdk AS build-env
COPY . /app
WORKDIR /app/MyApp
RUN dotnet build
RUN dotnet publish -c Release -o out
FROM microsoft/dotnet:2.2-aspnetcore-runtime
EXPOSE 80
WORKDIR /app
COPY --from=build-env /app/MyApp/out .
ENTRYPOINT [ "dotnet","MyApp.dll" ]
But the problem is, I have a project application that uses a 3rd party assembly or dll (Covered by red marker).
In my local project solution, it compiles and runs alright. But when I'm trying to build my project image, the C# files that use that assembly return an error, it says The type or namespace name 'the_assembly' could not be found.
This happens when the docker step is in RUN dotnet build
, RUN dotnet restore
or RUN dotnet publish...
Any help please?
Check your csproj file if it holds that dll reference as realitve location somewhere in your solution. Maybe you have it in some other place, so this file is not included in docker copy.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.