Skip to content

Changing TargetName in csproj breaks app host #34103

Open
@Symbai

Description

@Symbai

Description

When I set TargetName in csproj file and its different than AssemblyName it breaks the app host executable. If I open .deps.json file I can see that runtime dll file name is still named as AssemblyName.

Reproduction Steps

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

  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net6.0-windows</TargetFramework>
    <Nullable>enable</Nullable>
    <UseWPF>true</UseWPF>
    <AssemblyName>1</AssemblyName>
    <TargetName>Test</TargetName>
  </PropertyGroup>

</Project>

Expected behavior

Building this project should generate the following files and the app should work.

Test.deps.json
Test.exe
Test.runtimeconfig.json
Test.dll

Actual behavior

Building this project generates the following files and the app doesnt work. I believe the app host executable is looking for 1.dll

1.deps.json
1.exe
1.runtimeconfig.json
Test.dll

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions