aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

ASP.NET core project does not create executable in published files when referenced by another project in .net 9.0

Open anandanthony opened this issue 8 months ago • 0 comments

Hello team, we are seeing an issue wherein one of our ASP.NET core app referencing another app when published does not generate the executable expected for the referenced project in the publish folder. This has only started to happen after we moved to .net 9.0.

Following are the .csproj of the primary and referenced apps.

Primary:

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

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
    <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\AppExeNotAvailable\AppExeNotAvailable.csproj" />
  </ItemGroup>

</Project>

Referenced:

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

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
    <PublishSingleFile>true</PublishSingleFile>
  </PropertyGroup>

</Project>

The way we publish the primary App is by running the command: dotnet publish .\PrimaryExeApp\PrimaryExeApp.csproj --no-restore -c Release -r win-x64 --self-contained true -p:PublishReadyToRun=true -p:PublishReadyToRunComposite=true -o ./publish8.0 /warnaserror

Adding screenshot for the publish folder for .net8.0 and .net9.0

.net8.0 Image

.net9.0

Image

Since our primary app depends on the executable generated by the referenced app, we expect the same publish behavior we were seeing in .net8.

Ask: Steps, change on how we can get the executable of a referenced project when publishing the primary app referencing the project.

anandanthony avatar Jun 13 '25 23:06 anandanthony