I have a WPF app that works with local SQLite and Entity Framework Core. I want to distribute my app using ClickOnce.
Everything works fine when I run it using Visual Studio 2017. But app had a crash on a start when I used ClickOnce. The crash was so early so I couldn't even log the exception. After some time I found that in publish folder some dlls were missed. For example System.Runtime. All references are NuGet packages. Then I found that despite of I have a reference to the dlls in my project ClickOnce application files list doesn't contains it.
The only solution I have found for now is to add missed dlls as files in root of my project and set build action to Content. In ClickOnce application file dialog I set publish status to Include.
It works now but it looks like not the best way to do it. The question is why they are missed in the first place. More likely I missed something or I am not understand the root of the problem.
UPD:
You can find an example code here.
It works from Visual Studio but crashes on a start when you try to install it as ClickOnce application.
UPD: The problem was fixed in Visual Studio Professional version 15.6.1
there is 2 way for solve this.
at first you have to go properties > publish >Application Files and at this place make your dll's include in your project
but if it not work go to refrence and make dll CopyLocal = False you add dll like exist Item in your project and make them Copy always
it will work correctly
but for your sample i watch this and i solved it look at this image :
you have 4 dll you need do this for them
at first go to your refrence and make them Copy Local False
thin go to the path of each dll and add them like Exist Item then make all f them Copy To Output Directoey CopyAlways
then Publish it and run it Like this picture I run it From publish file and its work
Even if you set the dll to copy local, the dll will not get copied over unless you actually use the dll in your code. You might try adding System.Runtime in your code somewhere like this maybe?
Based on Issue 9 on https://blogs.msdn.microsoft.com/bclteam/p/asynctargetingpackkb/ I was able to do the following:
Symptom
ClickOnce applications targeting .NET Framework 4.0 that reference the
Microsoft.Bcl
orMicrosoft.Bcl.Async
packages may experience aTypeLoadException
or other errors after being installed.Resolution
This occurs because ClickOnce fails to deploy certain required assemblies. As a workaround, do the following: