System.DllNotFoundException in client's PC while click Once deployment

420 views Asked by At

I have created an application in C# and WPF. The application uses a DLL written in C++ language.

I have imported this DLL in my C# application using DLLImport function like

    [DllImport("Project2013.dll")]
    static extern void InitTasksDispatcher();

I have referenced the DLL by right clicking project-->Add-->Add Existing Item--> and gave the path of DLL and used it "Add as a link" option.

I have already ensured to set Build Action as "Content" and Copy to output directory parameter as "Copy Always".

Then I Change the mode to Release mode and build the whole solution. It succeeded.

Then I made setup using ClickOnce deployment and created the setup file.

Found that it is running well on a system having the visual studio professional 2013 but it failed on client system. It says System.DllNotFoundException and nothing else. I have made installed VC++ redistributable on client PC. Still, it causes problem.

I also copied the dll.deploy file on different locations like in Application Files folder and with setup file also. Still it does not work. Please help me out if anyone have faced the same before.

1

There are 1 answers

0
sondergard On

Have you tried specifically including it as part of the ClickOnce package? Go to Project properties -> Publish -> Application Files, locate the dll, and change the publish status to Include (not auto)