Xandor
❔ Microsoft.Net.Build.Containers - Adding .Net to a server core image
Hey everyone,
Newbie here, trying to learn as i go, and have something to make that's worth it.
I've been making alot of smaller simple applications to help myself in my job, and now i'm on a new one.
I'm making a small web app to make administering several systems easier from a single web console.
For this project i'm using "ASP.NET Core Web App" as a template , and .Net 7
My though was that I would try to put this in a docker container, and therefor though I would test out the "Microsoft.Net.Build.Containers" package for this.
But since one of the modules i need is the "System.DirectoryServices.AccountManagement", I'll have to put it on a windows docker server as it's not supported on linux, this is ok.
But when using i.e "mcr.microsoft.com/dotnet/aspnet:7.0", I get the error:
"Unable to load DLL 'activeds.dll' or one of its dependencies: The specified module could not be found. (Exception from HRESULT: 0x8007007E)"
From what I found, is that this is not supported in the images.
"Solution" that people say, is to use the "Server Core" image instead.
I tried using the "<ContainerBaseImage>mcr.microsoft.com/windows/servercore:ltsc2022</ContainerBaseImage>" image for it, but then I get told:
"You must install .NET to run this application."
In a normal Dockerfile, it's not too hard to add this. But how do i do it with this container package?
2 replies