sdk: Publishing standalone app with a dot '.' in name on linux generates executable in an unexpected way

Steps to reproduce

  • On Ubuntu 16.04 LTS, install the latest version of CLI (I had 5825)
  • mkdir sample.webapi
  • cd sample.webapi
  • dotnet new webapi
  • Open the .csproj file and add a runtime identifier for linux-x64 <RuntimeIdentifiers>linux-x64</RuntimeIdentifiers> and save the file
  • Open the NuGet.config file and remove the dotnet-core feed as aspnetcore-dev would suffice here
  • dotnet restore
  • dotnet publish -r linux-x64

Expected behavior

The published output should have an executable with name sample.webapi

Actual behavior

An executable with name sample.webapi.webapi

Environment data

dotnet --info output:

.NET Command Line Tools (2.0.0-preview1-005825)

Product Information:
 Version:            2.0.0-preview1-005825
 Commit SHA-1 hash:  b4a821109d

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  16.04
 OS Platform: Linux
 RID:         ubuntu.16.04-x64
 Base Path:   /home/kiran/.dotnet/sdk/2.0.0-preview1-005825/

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0-preview1-002061-00
  Build    : 2b70ec9c3b014af0c2a5f45de0e5b73a1ae51c09

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 36 (20 by maintainers)

Commits related to this issue

Most upvoted comments

@peterhuene any chance to get a fix into 2.2? It’s a bit sad that dotnet run doesn’t work when a RuntimeIdentifier is specified in the project file and there is a dot in the project name…

@fbarletta as a workaround, could you add this to the project and test if it works?:

  <Target Name="FixRidSpecificHost" AfterTargets="_ComputeNETCoreBuildOutputFiles">
    <ItemGroup>
      <None Remove="@(NativeAppHostNETCore)" />
      <None Include="@(NativeAppHostNETCore)" Link="$(AssemblyName)" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="Never"/>
    </ItemGroup>
  </Target>

Found it. The culprit is https://github.com/dotnet/sdk/blob/8c5d7a7c5bfd3b3eba5cb5bde4339dda470bd39a/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.Sdk.targets#L291

The host is copied into the obj folder with the right name for embedding the dll name and then included as copy local item with the pseudo extension added again

nativehostissue

@livarcocc this is current block us adopt net core 2.0, i noticed you tag the milestone to 2.1.0, do you have idea about what the target date for 2.1.0?

I think I am seeing the same issue on Mac OS too.

cc @livarcocc