1

My problem is that DLLs needed by my ClickOnce app are cluttering my project folder and I would like to move them to a bin folder but don't know a simple way to do so and still get the files to distribute.

To explain:

I'm distributing a C# app with ClickOnce. It has the following components:

  • One C# application
  • One CLR DLL
  • Umpteen C++ DLLs

All of these build to a tidy little bin folder.

Now the CLR DLL is referenced from the C# project, so it copies and deploys fine.

But I also want to distribute the C++ DLLs as part of the ClickOnce project, so I've done the thing that people say to do, which is add them to the C# project (drag ... drop), and in Properties, set Build Action to Content and Copy to Output Directory to Copy if Newer.

ClickOnce seems to deploy these files quite nicely.

The problem, though, is that now I have a bunch of binaries dumped into my C# project folder (and appearing in the project root in the IDE), which mixes executable files with source files in a way that is extremely obnoxious.

Can anyone clue me in to a simple way to keep all my DLLs in the output folder where they belong, and also have them distributed by ClickOnce?

Matthew Lowe
  • 1,350
  • 1
  • 17
  • 29

1 Answers1

1

Move you C++ DLLs somewhere sensible then when you add them to the project choose to add them as a Link instead of the standard Add which copies the files to the project folder.

To do this follow these steps:

  1. Right click the project file and choose add existing file.
  2. Navigate to the location of the file(s).
  3. Click the down arrow next to the Add button and select Add as Link
John Hunter
  • 4,042
  • 4
  • 26
  • 35
  • Wow. That is well-hidden. For other people's benefit, you right-click, Add Existing Item, and then when you select the item, there's a drop-down on the Add button that lets you choose "Add as Link". I'll test this to be sure it works with ClickOnce. – Matthew Lowe May 10 '11 at 04:07
  • Yes, that works well! Now it would be nice to find a way to separate the source files from the binaries in the solution explorer. – Matthew Lowe May 10 '11 at 04:41
  • Edit: updated solution with clearer steps. I'm not sure you can sort the solution explorer out. You could try the [visual studio power tools](http://visualstudiogallery.msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef/) that has a solution navigator which is pretty cool. – John Hunter May 17 '11 at 19:47