Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] "-windows" TargetFramework requires "Microsoft.WindowsDesktop.App" and can't be deployed to Azure #4525

Closed
jsquire opened this issue Jan 18, 2024 · 1 comment

Comments

@jsquire
Copy link

jsquire commented Jan 18, 2024

Issue Transfer

This issue has been transferred from the Azure SDK for .NET repository, #41390.

Please be aware that @robertmuehsig is the author of the original issue and include them for any questions or replies.

Details

Describe the bug

When you create a "Windows" specific Web Application like that:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net6.0-windows</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Azure.Identity" Version="1.10.4" />
  </ItemGroup>


</Project>

Then the resulting project will require the WindowsDesktop runtime:

{
  "runtimeOptions": {
    "tfm": "net6.0",
    "frameworks": [
      {
        "name": "Microsoft.NETCore.App",
        "version": "6.0.0"
      },
      {
        "name": "Microsoft.WindowsDesktop.App",
        "version": "6.0.0"
      },
      {
        "name": "Microsoft.AspNetCore.App",
        "version": "6.0.0"
      }
    ],
    "configProperties": {
      "System.GC.Server": true,
      "System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
      "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
    }
  }
}

Microsoft.Identity.Client adds WebView2 and other stuff to the dependency tree:
image

The problem:
a) It was quite suprising that the target runtime dependency has changed.
b) This WindowsDesktop Runtime is not available on Azure (e.g. App Service).

Expected behavior

It seems wrong that the TargetFramework "net6.0-windows" is treated like "the application will be run on a desktop environment".
I always thought that "net6.0-windows" is for applications that uses Windows Specific APIs, which might be a Web Application. With the current behavior we had to use "net6.0" (which is in the end a good thing, but feels a bit drastic just because one NuGet package has a weird feature backed in).

Actual behavior

The desktop runtime is required.

Reproduction Steps

  • Create a MVC App and use "net6.0-windows" (or net8.0-windows) as TargetFramework
  • Add Azure.Identity
  • Deploy to azure

Result:

You must install or update .NET to run this application.

App: C:\inetpub\wwwroot\primedocs\Service\PrimeDocs.Service.Host.dll
Architecture: x64
Framework: 'Microsoft.WindowsDesktop.App', version '6.0.0' (x64)
.NET location: C:\Program Files\dotnet\

No frameworks were found.

Learn about framework resolution:
https://aka.ms/dotnet/app-launch-failed

Environment

Azure App Service

@pmaytak
Copy link
Contributor

pmaytak commented Jan 18, 2024

This is a known behavior. We're discussing the best approach to take. #4468 is the issue for tracking this.

Closing this as a duplicate.

@pmaytak pmaytak closed this as not planned Won't fix, can't repro, duplicate, stale Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants