question

JoanMagnet avatar image
0 Votes"
JoanMagnet asked ·

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

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?


windows-wpfdotnet-standard
· 5
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@JoanMagnet-8888
Could you show me what is your TargetFramework in your .Net 5 project csproj file? What version of Microsoft.WIndows.SDK.NET.Ref did you install? What does you set for your Publish location for the ClickOnce Publish?

0 Votes 0 ·

That's my TargetFramework: <TargetFramework>net5.0-windows10.0.18362.0</TargetFramework>

Microsoft.Windows.SDK.Net.Ref version: 10.0.18362.13

Publish location is a shared folder:: \\myServer.domain.com\Fitxers\X3\Setups\X3CmdADH\



0 Votes 0 ·

@JoanMagnet-8888
All WPF assemblies are already implicitly referenced automatically when using Microsoft.NET.Sdk.WindowsDesktop.This includes UIAutomation.dll. SO I didn't install Microsoft.WIndows.SDK.NET.Ref and Microsoft.Windows.Desktop.App.WPF in the NuGet but add UIAutomation in the Net 5 project reference, then I can publidh with ClickOnce. Could you try to add UIAutomation for your project to try?

0 Votes 0 ·
Show more comments

1 Answer

JoanMagnet avatar image
0 Votes"
JoanMagnet answered ·

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>

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.