Skip to content

aspnetcorev2_inprocess should not be published for PublishAot libraries #40487

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

Open
eerhardt opened this issue Apr 26, 2024 · 2 comments
Open
Labels
Area-WebSDK untriaged Request triage from a team member

Comments

@eerhardt
Copy link
Member

Describe the bug

When building a Native AOT library that references an ASP.NET nuget package on windows, the aspnetcorev2_inprocess.dll is being published to the output folder.

To Reproduce

dotnet publish -r win-x64 the following library:

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

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <InvariantGlobalization>true</InvariantGlobalization>
    <PublishAot>true</PublishAot>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.4" />
  </ItemGroup>
</Project>
using Microsoft.AspNetCore.Authentication.JwtBearer;
using System.Runtime.InteropServices;

namespace MyLibrary;

public static class EntryPoints
{
    [UnmanagedCallersOnly(EntryPoint = "MyValidate")]
    public static int MyValidate()
    {
        JwtBearerPostConfigureOptions o = new JwtBearerPostConfigureOptions();
        return 1;
    }
}

Look in the bin\Release\net8.0\win-x64\publish folder:

image

that aspnetcorev2_inprocess.dll shouldn't be present. It is not used by the library.

This is similar to #29896, but for libraries and not web apps.

Exceptions (if any)

N/A

Further technical details

  • Include the output of dotnet --info
❯ dotnet --info
.NET SDK:
 Version:           8.0.300-preview.24203.14
 Commit:            b7e38f457d
 Workload version:  8.0.300-manifests.a11d0ba5
 MSBuild version:   17.10.0+4f6b1bb28

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.22631
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\8.0.300-preview.24203.14\

.NET workloads installed:
 [aspire]
   Installation Source: SDK 8.0.300-preview.24203, VS 17.11.34822.286
   Manifest Version:    8.0.0-preview.7.24224.7/8.0.100
   Manifest Path:       C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.0.0-preview.7.24224.7\WorkloadManifest.json
   Install Type:        FileBased


Host:
  Version:      8.0.2
  Architecture: x64
  Commit:       1381d5ebd2

.NET SDKs installed:
  3.1.426 [C:\Program Files\dotnet\sdk]
  6.0.129 [C:\Program Files\dotnet\sdk]
  6.0.321 [C:\Program Files\dotnet\sdk]
  6.0.421 [C:\Program Files\dotnet\sdk]
  7.0.118 [C:\Program Files\dotnet\sdk]
  7.0.408 [C:\Program Files\dotnet\sdk]
  8.0.300-preview.24203.14 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.27 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.27 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.29 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.27 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.29 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

cc @halter73 @DamianEdwards

@ghost ghost added Area-NetSDK untriaged Request triage from a team member labels Apr 26, 2024
@DamianEdwards
Copy link
Member

DamianEdwards commented Apr 26, 2024

Huh that's interesting. What is it that triggers the copying of that file, the transitive <FrameworkReference />?

@eerhardt
Copy link
Member Author

What is it that triggers the copying of that file, the transitive ?

Correct. It originates from resolving the "RuntimePack" assets:

image

In #29984, we ended up setting PublishIISAssets=false when PublishAot == true. But that is only with the WebSDK, which doesn't really help here since I'm just building a library and the ASP.NET runtime pack is getting brought in transitively.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-WebSDK untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

2 participants