5

I am working on MAC and dotnet core 3.1, 5.0 and 6.0 versions are installed on my machine. I not able to build Web Application on my machine due to shared error in this ticket.

I can build web application in target framework net5.0 but not with net6.0 and console, class library projects' build successfully. I tried to build using command line, VS 2022/2019 but no success.

Project file code as below and this is empty Web API project.

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

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

  <ItemGroup>
    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.5" />
  </ItemGroup>

</Project>

Exception

/usr/local/share/dotnet/sdk/6.0.100-rc.2.21505.57/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(5,5): Error NETSDK1177: Failed to sign apphost with error code 0: /Users/abc/Projects/WebAppTest/WebAppTest/obj/Debug/net6.0/apphost: is already signed (NETSDK1177) (WebAppTest)

Further technical details

.NET SDK (reflecting any global.json):
 Version:   6.0.100-rc.2.21505.57
 Commit:    ab39070116

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  11.6
 OS Platform: Darwin
 RID:         osx.11.0-x64
 Base Path:   /usr/local/share/dotnet/sdk/6.0.100-rc.2.21505.57/

Host (useful for support):
  Version: 6.0.0-rc.2.21480.5
  Commit:  6b11d64e7e

.NET SDKs installed:
  3.1.414 [/usr/local/share/dotnet/sdk]
  5.0.402 [/usr/local/share/dotnet/sdk]
  6.0.100-rc.2.21505.57 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.20 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.0-rc.2.21480.10 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.20 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.11 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.0-rc.2.21480.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
Nima Derakhshanjan
  • 1,380
  • 9
  • 24
  • 37
techwitz
  • 51
  • 2
  • Did you fix this issue? I am facing the same problem. – Trident Nov 04 '21 at 19:28
  • No, this not fixed yet, I also raised issue with detnet devlopment team [dotnet/sdk](https://github.com/dotnet/sdk/issues/22201) You can check status and add you comments. Please let me know if you have found any soultion. Thanks – techwitz Nov 07 '21 at 05:20

3 Answers3

6

This problem is being tracked in https://github.com/dotnet/sdk/issues/22201. It appears to have resurfaced around March 2022, with the macOS 12.3.1 update.

One workaround is to disable code signing. This is slightly better than disabling the app host creation completely.

You can do this either by /p:_EnableMacOSCodeSign=false on the dotnet command, or the following in your csproj:

<PropertyGroup>
   <_EnableMacOSCodeSign>false</_EnableMacOSCodeSign>
</PropertyGroup>

Or if you're running JetBrains Rider, consider adding it as an MSBuild global property:

screenshot

Matt Johnson-Pint
  • 230,703
  • 74
  • 448
  • 575
1

Just add

 <UseAppHost>false</UseAppHost>

to your property group in the csproj or set the value to false.

Sterling Diaz
  • 3,789
  • 2
  • 31
  • 35
0

I had a similar issue on a Mac using dotnet 6, which is a console application described in: https://learn.microsoft.com/en-us/learn/modules/work-with-cosmos-db/3-exercise-work-cosmos-db-dotnet

After looking around, the fix for me was to editing the project file and adding:

<PropertyGroup>
...
  <UseAppHost>true</UseAppHost>
...
</PropertyGroup> 
granadaCoder
  • 26,328
  • 10
  • 113
  • 146