Closed Harshit-Goyal10 closed 10 months ago
Tagging subscribers to this area: @vitek-karas, @agocke, @vsadov See info in area-owners.md if you want to be subscribed.
Author: | Harshit-Goyal10 |
---|---|
Assignees: | - |
Labels: | `area-Host`, `untriaged`, `needs-area-label` |
Milestone: | - |
The error message says that your application depends on Microsoft.WindowsDesktop.App
framework and you are trying to run it in a Linux docker container. Microsoft.WindowsDesktop.App
is Window specific. It does not exist on Linux.
@jkotas , Yes you are right, I am trying to do the same, But what I have to do for doing so? Do I need to install the project dependencies in the container if yes then how we can procced ?
You won't be able to run app that depends on Microsoft.WindowsDesktop.App
framework in a Linux container. You need to remove the dependency of your app on Microsoft.WindowsDesktop.App
to be able to run it in a Linux container. Why does your app depend on Microsoft.WindowsDesktop.App
framework?
@jkotas, Actually I was little bit confused regarding the two types of containers i.e. Windows and Linux containers in the docker. I think I was doing wrong, My application should be run in Windows container not in Linux container. So as of now, the correct scenario is My application is running in IIS and it should run in Windows Container not in linux. Now Can you please bit suggest as If I am trying to switch docker linux container(default) to windows container, then getting these type of issues Even though I have tried to execute the above command on windows Powershell with administrative mode
I have tried to execute the above command on windows Powershell with administrative mode
Did the script reported any errors? Have you rebooted your machine after running script? Do you see the Containers Windows feature enabled in Control Panel?
oh yes, done thanks for your support, works for me
Hi @jkotas My Earlier issue has been solved as I was trying to deploy the application in Linux Container but as per your guidance I have changed from linux to windows container and tries to build and run the container.
Now, again facing the similar kind of issues. As I was facing during the linux container.
Now this is the updated scenario. I have created an application which performs CRUD Operations using MVC Core with SQL Server in the backend. This application is working fine on IIS Server. Even when I am building an image in docker, the image and container is also created But when I am trying to run this application, then my container is getting exited immediately. While doing further analysis found that, the docker logs shows such kinds of errors which are given below : **You must install or update .NET to run this application.
You must install or update .NET to run this application.
App: C:\app\WebDCK.dll Architecture: x64 Framework: 'Microsoft.WindowsDesktop.App', version '8.0.0' (x64) .NET location: C:\Program Files\dotnet\
Learn more: https://aka.ms/dotnet/app-launch-failed
To install missing framework, download: https://aka.ms/dotnet-core-applaunch?framework=Microsoft.WindowsDesktop.App&framework_version=8.0.0&arch=x64&rid=win-x64&os=win10
Even though the version 8.0 is already installed over the system.
Microsoft.WindowsDesktop.App is framework for Windows GUI application development. It is not meant to be used for server programming and so it is not installed in the default .NET runtime docker containers. Why does your server app depend on Microsoft.WindowsDesktop.App framework? If your server app depends on it for a good reason, you need to install it into the container manually.
I have not used this framework, the Microsoft.WindowsDesktop.App framework is taken by default, I have just created the application in Dotnet core. Can you please a bit navigate to me in this ?
@Harshit-Goyal10 can you explain how you made the project, or can you show an example of the project you have? We're not sure why your application is using the Microsoft.WindowsDesktop.App framework. Are you perhaps using packages that pulled in this as a framework? Is this a web project?
Yes, there is something in your project that is introducing dependency on Microsoft.WindowsDesktop.App
framework. For example, setting <UseWindowsForms>true</UseWindowsForms>
property in your .csproj is going to introduce dependency on Microsoft.WindowsDesktop.App
framework.
Hi @davidfowl, Actually, I have simply created a ASP.net Core (Model-View-Controller Project) using targeted framework 8.0 in the VS 2022 community version. This Project performs basics CRUD operations and its working fine while trying to run in IIS. Please have a look in the below screenshot. This is the launch setting.json { "$schema": "http://json.schemastore.org/launchsettings.json", "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://localhost:1518", "sslPort": 44317 } }, "profiles": { "http": { "commandName": "IISExpress", "dotnetRunMessages": true, "launchBrowser": true, "applicationUrl": "http://localhost:5096", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, "https": { "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, "applicationUrl": "https://localhost:7234;http://localhost:5096", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } } } }
Now, I want to use the same project and wants to run in the windows docker container, for this i have used a docker windows container and a docker file. Now this projects creates an images which are given below. and the docker file is also given below:
FROM mcr.microsoft.com/dotnet/aspnet:8.0-nanoserver-1809 AS base WORKDIR /app EXPOSE 8080 EXPOSE 8081
FROM mcr.microsoft.com/dotnet/sdk:8.0-nanoserver-1809 AS build ARG BUILD_CONFIGURATION=Release WORKDIR /src COPY ["WebDCK.csproj", "."] RUN dotnet restore "./././WebDCK.csproj" COPY . . WORKDIR "/src/." RUN dotnet build "./WebDCK.csproj" -c %BUILD_CONFIGURATION% -o /app/build
FROM build AS publish ARG BUILD_CONFIGURATION=Release RUN dotnet publish "./WebDCK.csproj" -c %BUILD_CONFIGURATION% -o /app/publish /p:UseAppHost=false
FROM base AS final WORKDIR /app COPY --from=publish /app/publish . ENTRYPOINT ["dotnet", "WebDCK.dll"]
and then I have create a container and try to run the container..container is created which is given below in the screenshot
But it is exited immediately, while doing further analysis using logs with container ID, found the below error. **You must install or update .NET to run this application.
You must install or update .NET to run this application.
App: C:\app\WebDCK.dll Architecture: x64 Framework: 'Microsoft.WindowsDesktop.App', version '8.0.0' (x64) .NET location: C:\Program Files\dotnet\
Learn more: https://aka.ms/dotnet/app-launch-failed
To install missing framework, download: https://aka.ms/dotnet-core-applaunch?framework=Microsoft.WindowsDesktop.App&framework_version=8.0.0&arch=x64&rid=win-x64&os=win10
Even though the version 8.0 is already installed over the system.
We need to see the project file
Yes, there is something in your project that is introducing dependency on
Microsoft.WindowsDesktop.App
framework. For example, setting<UseWindowsForms>true</UseWindowsForms>
property in your .csproj is going to introduce dependency onMicrosoft.WindowsDesktop.App
framework.You won't be able to run app that depends on
Microsoft.WindowsDesktop.App
framework in a Linux container. You need to remove the dependency of your app onMicrosoft.WindowsDesktop.App
to be able to run it in a Linux container. Why does your app depend onMicrosoft.WindowsDesktop.App
framework?
" No, I have checked the same, there is no such property"
We need to see the project file
This is the proj file.
What happens if you change the target framework to net8.0?
What happens if you change the target framework to net8.0?
same issue persist either in 8.0 or 7.0, 6.0
I mean change the target framework to:
net8.0 instead of net8.0-windows10.0
@davidfowl , It's working, thanks for your support.
Hi .. I have created an application which performs CRUD Operations using MVC Core with SQL Server in the backend. This application is working fine on IIS Server. Even when I am building an image in docker, the image and container is also created But when I am trying to run this application, then my container is getting exited immediately. While doing further analysis found that, the docker logs shows such kinds of errors which are given below : **You must install or update .NET to run this application.
App: /app/WebDCK.dll Architecture: x64 Framework: 'Microsoft.WindowsDesktop.App', version '8.0.0' (x64) .NET location: /usr/share/dotnet/
No frameworks were found. Learn more: https://aka.ms/dotnet/app-launch-failed
To install missing framework, download: https://aka.ms/dotnet-core-applaunch?framework=Microsoft.WindowsDesktop.App&framework_version=8.0.0&arch=x64&rid=linux-x64&os=debian.12**
While all the required frameworks is already installed.
Anyone can please provide your ideas or suggestion? Thanks