erotavlas
erotavlas

Reputation: 4485

Bundling external dependencies to a Click Once application using Add as Link

In a WPF application ProjectWPF that references another project ProjectB, ProjectB output is a single DLL (a plug in) that I must include in a folder called 'PlugIns' in the root of 'ProjectWPF'.

Now I found a way to include the file, using Add as Link feature. What I did was created a folder called PlugIns in the ProjectWPF project. Then I Add Existing Items... and browse to the folder in ProjectB that contains the DLL - in this case bin/Debug version. Then set the properties of the linked file to Content and Copy Always.

When I build the project, everything works, the bin Debug and bin Release folders of the ProjectWPF project contain my PlugIns folder and that folder contains the DLL.

When I publish the ProjectWPF using ClickOnce, and then install it by running Setup.exe and browse the application directory I can see the folder PlugIns with the DLL inside. So Add as Link feature does work.

However this plug in DLL is only a copy of the Debug version. Even if I switch to Release in ProjectWPF, it was always grab the Debug version I originally linked to. What I want is for it to grab the appropriate version for the build mode I'm in (Release version or Debug version)

Is there a better way to manage this between Debug and Release versions? Or is there a better approach to embedding external dependencies (like plug ins) in a ClickOnce application?

P.S. this is .NET 4.5 or later

Upvotes: 1

Views: 458

Answers (1)

E-Bat
E-Bat

Reputation: 4892

You don't need to add the reference, even as a link for the deployment to work. After you generate the manifest open it with Manifest Manager Utility. Then follow this steps:

  1. Open the generated manifest
  2. Use the toolbar or menu to add ProjectB.dll. In this step you can create the folder named Plugin and use it as the target folder of the dll for you publication.
  3. Save and sign the manifest with a Click Once compatible certificate. You can create it from VS or the command prompt if you don't have one.

You can take a look here . Although this documentation point to WPF Prism application, it is valid for any manifest, WPF or Winform, generated with ClickOnce.

Upvotes: 1

Related Questions