Why ClickOnce does not add Microsoft.Data.SqlClient.SNI.x86 and x64 dlls into publish folder

Viewed 32

I have a VSTO Excel Add-ins built on Net Framework 4.7.2. In this Addin, I am using some projects built on NetCore 2.0 and there were references to Microsoft.Data.SqlClient in that NetCore project.

While I'm executing Add-In on the development machine everything is ok. But when I'd like to publish my add-in using ClickOnce Add-In does not work because of missing Microsoft.Data.SqlClient.SNI.x86 and x64 DLLs. I am adding Microsoft.Data.SqlClient to my project using NuGet solution package manager.

I am seeing "Microsoft.Data.SqlClient.SNI.x86" and x64 DLLs in my bin folder, but they are not included in to publish folder.

Does anybody know how to force ClickOnce to add those dlls to the publish folder?

1 Answers

A workaround which could work is to just add the dll's from the packages folder x86 or x64 to your project. And then set Copy if newer to true for all these dll's. When inspecting the clickone files, you'll see that these dll's are included.

Another solution would be to add a post-build step and just copy the correct dll's from the packages\... folder. Or conditionally include the dll's, by manually editing the csproj file as described on the Nuget packages are not published by clickonce thread.

Finally, take a look at the similar issue posted - ClickOnce Installer does not contain unmanaged dlls from nuget package.

Related