Error generating ClickOnce deployement of a Net 5 app with Net Std 2.1 libraries

Joan Magnet 36 Reputation points
2021-03-01T11:18:15.767+00:00

I recently started to develop a WPF project with Visual Studio 2019. (I'm new in the WPF world)

My solution has the next projects:

MyProject.App (net5.0-windows10.0.18362.0 .exe)

Dependencies:

  • Microsoft.Extensions.Hosting
  • Microsoft.NetCore.App
  • Microsoft.WIndows.SDK.NET.Ref
  • Microsoft.Windows.Desktop.App.WPF
  • Newtonsoft.Json
  • ModernWpfUI (ModernWpf)
  • MyProject.Domain
  • MyProject.Data
  • MyProject.Services

MyProject.Domain (netstandard2.1 .dll)

Dependencies:

  • NetStandard.Library

MyProject.Data (netstandard2.1 .dll)

Dependencies:

  • NetStandard.Library
  • Dapper (Dapper)

MyProject.Services (netstandard2.1 .dll)

Dependencies:

  • NetStandard.Library
  • MyProject.Domain
  • MyProject.Data

When I try to publish the .App project using ClickOnce, I'm getting the next error:

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.

And the output says:

2>Metadata file 'F:\Projectes\X3\MyProject\MyProject.Data\bin\Release\net5.0-windows10.0.18362.0\MyProject.Data.dll' could not be found
2>Metadata file 'F:\Projectes\X3\MyProject\MyProject.Domain\bin\Release\net5.0-windows10.0.18362.0\MyProject.Domain.dll' could not be found
2>Metadata file 'F:\Projectes\X3\MyProject\MyProject.Services\bin\Release\net5.0-windows10.0.18362.0\MyProject.Services.dll' could not be found

It seems it is looking for my library projects at: \net5.0-windows10.0.18362.0 directory, but in fact they are generated at: \netstandard2.1 folder.

How can I solve it?

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,421 questions
Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,682 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Joan Magnet 36 Reputation points
    2021-03-04T19:44:32.253+00:00

    What I found by now:

    Edit publish profile file .pubxml:

    Find actual <TargetFramework> tag:

    <TargetFramework>net5.0-windows10.0.18362.0</TargetFramework>

    and replace it by:

    <TargetFrameworks>net5.0-windows10.0.18362.0;netstandard2.1</TargetFrameworks>

    1 person found this answer helpful.
    0 comments No comments