Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 565
user1186050 Avatar asked Feb 19 '20 06:02

user1186050


People also ask

Can .NET Framework run in a Docker container?

NET 6; you can use Docker containers that include the traditional . NET Framework. However, a recommended approach is to use . NET 6 as you extend an existing application, such as writing a new service in ASP.NET Core.

Can I run Visual Studio in a Docker container?

The Visual Studio Code Dev Containers extension lets you use a Docker container as a full-featured development environment. It allows you to open any folder inside (or mounted into) a container and take advantage of Visual Studio Code's full feature set.

Does Visual Studio for Mac support .NET framework?

Visual Studio 2022 for Mac includes nearly everything you'll need for .NET 7 development, from responsive C# web UIs in Blazor to event-driven solutions using Azure Functions.

Can you run .NET framework on Mac?

NET Core will install and run on macOS - and just about any other desktop OS. IDEs are available for the mac, including: Visual Studio for Mac.


1 Answers

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.

like image 80
Z4-tier Avatar answered Sep 19 '22 23:09

Z4-tier