Multi-Targeting .NET Framework & .NET Core
Steps to reproduce the issue
I'd like to be able to build my project targeting .NET Framework (Mono) and .NET Core.
Expected behavior
A docker image exists with both the .NET Framework (Mono) and .NET Core.
Actual behavior
No such image exists.
Additional information
I was not certain where to raise this issue, so I've also raised it here.
The easiest solution would be to take the Mono image and just install .NET Core in your Dockerfile, or the other way around :)
That's exactly what I'm now looking into.
Multi-targeting is a fairly common scenario, particularly for library authors. and I don't want to have to maintain a docker image. I was hoping that a more expansive image could be created but I'm not sure who would maintain it.
I suppose this is a more general problem with docker images and not being able to somehow merge them when you want dependencies from two base images. I'm sure docker are on it.
You don't need to maintain a persistent Docker image yourself, you'd just install .NET Core as normal in the Dockerfile and create a temporary image before invoking your build script.
I'm trying to use Circle CI, to build NuGet packages. So I don't actually have a Dockerfile. Plus I'd rather not maintain all this with each version update.
Yeah, understood. I think it'd need to be driven by the .NET Core team since they'd need to make it work on Windows with .NET Framework as well.
I just tried it the other way around, I took the .NET Core docker image and installed mono in there like this:
FROM microsoft/dotnet:2.0-sdk AS build-env
ENV MONO_VERSION 5.10.0.160
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
RUN echo "deb http://download.mono-project.com/repo/debian stable-jessie/snapshots/$MONO_VERSION main" > /etc/apt/sources.list.d/mono-official-stable.list \
&& apt-get update \
&& apt-get install -y mono-runtime binutils curl mono-devel ca-certificates-mono fsharp mono-vbnc nuget referenceassemblies-pcl \
&& rm -rf /var/lib/apt/lists/* /tmp/*
ENV FrameworkPathOverride=/usr/lib/mono/4.5/
WORKDIR /app
COPY . .
RUN dotnet build -c Release -o out
FROM mono
WORKDIR /app
COPY --from=build-env /app/MyTestApp/out ./
ENTRYPOINT ["mono", "MyTestApp.exe"]
My test application has a 'normal' project file and a .NET Core style project file targeting the .NET Framework (something I am experimenting with) and this works great. I think it would be helpful to have this as an official container :)
The .NET team is working on getting the .NET Framework reference assemblies into a NuGet package so you can build using the .NET Core tooling as well which I guess solves this too: https://github.com/dotnet/designs/pull/33
My application is a .NET Framework it is possible to run a docker image with mono? Thanks!
Is there any progress on this request? I have similar requirement.