ClickOnce publish .net5 with .netstandard library fails

Avi Stokar 6 Reputation points
2021-03-18T18:58:00.683+00:00

I have a WPF .net5 application which has 2 reference class library projects which are .netstandard and .netcore3.1. The application compiles and runs; however, Clickonce fails to publish it with the following unhelpful info:

Publish has encountered an error.
Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details. 

The output Windows in Visual Studio (16.9.2) shows that it is looking for the class library in the wrong folder:

EnnobleHr\EnnobleHR.Shared\bin\Release\net5.0-windows\EnnobleHR.Shared.dll' could not be found

This library is .netstandard2.0 as it is also consumed by the backend which uses Azure Functions (which (I think) do not support .net5 yet).

I found after initially submitting this question that if I switch the Deployment Mode to Self-Contained from Framework-dependent the publish works; howver, only if "produce single file" is NOT checked

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,400 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,125 questions
XAML
XAML
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
767 questions
{count} vote