Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-Targeting .NET Framework & .NET Core #63

Open
RehanSaeed opened this issue Sep 26, 2017 · 9 comments
Open

Multi-Targeting .NET Framework & .NET Core #63

RehanSaeed opened this issue Sep 26, 2017 · 9 comments

Comments

@RehanSaeed
Copy link

RehanSaeed commented Sep 26, 2017

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.

@akoeplinger
Copy link
Member

The easiest solution would be to take the Mono image and just install .NET Core in your Dockerfile, or the other way around :)

@RehanSaeed
Copy link
Author

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.

@akoeplinger
Copy link
Member

akoeplinger commented Sep 26, 2017

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.

@RehanSaeed
Copy link
Author

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.

@akoeplinger
Copy link
Member

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.

@dnperfors
Copy link

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 :)

@akoeplinger
Copy link
Member

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: dotnet/designs#33

@markteovel14
Copy link

My application is a .NET Framework it is possible to run a docker image with mono?
Thanks!

@iceagebuck
Copy link

Is there any progress on this request? I have similar requirement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants