Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

install .net framework 4.7.2 in docker

I'm new to .Net Environment, I'm trying to implement docker here for my firm. They were using 4.5 earlier so I used the following statement in my dockerfile:

RUN Install-WindowsFeature NET-Framework-45-ASPNET ; \
Install-WindowsFeature Web-Asp-Net45

Now, I want to do the same for framework 4.7.2 - I thought it will work if I run the statements like :

RUN Install-WindowsFeature NET-Framework-472-ASPNET ; \
Install-WindowsFeature Web-Asp-Net472

But it's not working this way instead shows the following error :

Install-WindowsFeature : ArgumentNotValid: The role, role service, or feature
name is not valid: 'NET-Framework-472-ASPNET'. The name was not found.
At line:1 char:1
+ Install-WindowsFeature NET-Framework-472-ASPNET ; Install-WindowsFeat ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (NET-Framework-472-ASPNET:Strin
   g) [Install-WindowsFeature], Exception
    + FullyQualifiedErrorId : NameDoesNotExist,Microsoft.Windows.ServerManager
   .Commands.AddWindowsFeatureCommand

Please help me with the same. I am really stuck and can't find anything on the internet.

like image 720
NealGul Avatar asked Nov 18 '25 07:11

NealGul


1 Answers

Instead of Installing the NET-Framework yourself, you could use

FROM microsoft/aspnet

or

FROM microsoft/dotnet-framework:4.7.2

to use an image with dotnet framework already installed.

or whatever version you need.

See https://hub.docker.com/u/microsoft/ for all the images on docker hub

like image 138
Oofpez Avatar answered Nov 20 '25 22:11

Oofpez



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!