Can I run Visual Studio and .Net Framework in a docker container on Mac?
Asked Answered
B

2

7

I have a Visual Studio Code app (Angular/.Net Core Web Api app) for work and I can develop, debug and run it on my personal Mac when I VPN into my companies network.

I also have a desktop work PC on my companies site and a remote work server that I can RDP into to do all my work, but I prefer my personal Mac!

I now need to create a .Net Web Api app (NON .Net Core) that my .Net Core app needs to call over http (for WCF web services that won't run on .Net Core), so I created a Visual Studio .Net Framework web Api app on one of my Win PC work machines and I can run both projects side by side (Visual Studio Code and Visual Studio) on my PC but not my Mac.

Is there any way to get the .Net Framework app working on my Mac? ex. in a Docker container or maybe even just running the app in a container, so that my .Net Core app can call it?

Another idea I have but not sure if possible - When I run the .Net Core app on my Mac I'm VPN'd into my companies network. If I run the .Net Web app on my work desktop or the remote server would I be able to connect to it from my Mac?

Bearberry answered 19/2, 2020 at 6:53 Comment(0)
F
7

Visual Studio Code is a JavaScript application, which is what makes it nice a portable (and also kind of slow). The Visual Studio Framework is a different animal; one that is very territorial. Compiled applications that target the .NET framework will absolutely not run on MacOS, or Linux, or Solaris or..... anything not Windows. .NET core is portable to MacOS though.

As per this post (Can you install and run apps built on the .NET framework on a Mac?) there is the option of using Mono to recompile the code and run it on the Mac. Unfortunately, it does not support the full .NET Framework, and likely requires some non-trivial modifications to the code to make it work. If you go this route, you're either going to be limited to the areas of the Framework that are supported by Mono, or you'll have to maintain 2 different versions of the same code base. Neither option sounds very good to me.

As far as running in Docker, that will not work. Docker is fundamentally tied to the host operating system due to the use of kernel namespaces to provide isolation for processes and other system resources. It does not provide the same kernel API that the .NET Framework would require.

If you are absolutely determined to keep the development work on the Mac, the best option is probably to use a thick virtual machine that runs a full copy of Windows. This has the obvious downsides of being much more expensive (both in terms of the system resources it will need, and the software licensing costs), and you end up using Windows anyway (so you might as well just RDP to a real Windows machine). Probably not the answer you were hoping for (and I would love for someone to list some options that I've missed), but I think you're going to end up doing some work in Windows.

Farahfarand answered 22/2, 2020 at 1:8 Comment(8)
just curious, what's this link about: hub.docker.com/_/microsoft-dotnet-framework-samplesBearberry
You can containerize .NET framework, but you need to do it from a Windows host. I had to be careful to say "will not run on MacOS, Linux, or Solaris..." instead of "will not run in Docker" since that would be untrue. For your use case though, that is probably pretty useless. The link you posted doesn't seem to mention this, but this one makes it clear: learn.microsoft.com/en-us/dotnet/architecture/microservices/…Farahfarand
The container, with the .Net Framework, won't run on a Mac? So basically, I don't have any options to run a .Net Framework app on my Mac?Bearberry
That is correct, unfortunately. The .NET framework is pretty tightly coupled with Windows, whereas docker is tightly coupled to whichever operating system is running on the host machine (so you need Windows to containerize Windows applications). The only real option is to get a copy of Windows and install it in a thick virtual machine like Virtual Box, but doing that is so contrary to what you wanted to do in the first place that you might as well just RDP to a windows machine instead (it will be easier and cheaper).Farahfarand
using a VM isn't out of the question - I just have a 2013 Macbook Air that is sluggish with a VM running. I had it installed a while back and uninstalled it because it was too slow. I guess I need a new machine...Bearberry
My personal opinion is that trying to go the VM route sounds like it would be a huge headache. The way I see it, if you already have a dedicated windows machine to use for dev work, it seems like the path of least resistance to just RDP in and use that. When you think about it, running a VM isn't really much different, except it comes with the performance hit just by virtue of being in a VM. Also it will be hogging resources on your Mac.Farahfarand
How can you run sql server in a container on a Mac then, what’s the difference? Eg builtin.com/software-engineering-perspectives/…. Is it because the sql server image is actually Linux and the mac docker is somehow actually running a Linux container?Nolanolan
@Nolanolan your guess is exactly right. The MS SQL Server image is based on Alpine linux. You can check this by pulling the image, starting it, and then doing docker exec [container ID] uname -aFarahfarand
B
0

You can't run .NET Framework , because this working with layer architecture from operative system, when running, so many libraries is on migration and now running in .NET core via nuget recomendation is use oficial net core image from microsoft or run you docker over a microsoft server system.

Bareback answered 26/2, 2020 at 23:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.