0

I writing and open-source winforms app, and my program depends on another open-source project called ObjectListView.

ObjectListView is its own project in my solution and referenced as such, but its output is set as a .DLL.. It's just an enhanced ListView control. Is there any way that the project ObjectListView can be embedded in my own assembly without having to ILMerge or use some form of packer? (Defeating the purpose of an open-source project)

My initial thought was just to manually drop all the source files and whatnot into my own project, but that seems rather clunky and far from an idea solution.

PS; I did try searching for this but I didn't come across much that wasn't related to embedding DLLs into an output assembly.. Not merging projects like this. I apologize in advance if this question has been answered before.

Lundin
  • 195,001
  • 40
  • 254
  • 396
MisterNad
  • 432
  • 3
  • 14
  • 2
    What is your objection to distributing it with your executable? This is how libraries have been distributed for ages. Building it all into one file is less common, as far as I'm aware. – ProgrammingLlama Sep 01 '20 at 09:24
  • It is possible to [load it from an embedded resource](https://stackoverflow.com/questions/9228423/how-to-use-an-dll-load-from-embed-resource), of course. – ProgrammingLlama Sep 01 '20 at 09:25
  • 1
    You can add the whole Project to your Solution, reference the assembly as usual. Is there a problem with that? – Jimi Sep 01 '20 at 09:28
  • @Jimi this is precisely what I'm doing. My solution contains the ObjectListView as a project as well as /my/ project. I've added the entire project to my solution, referenced it and build. Works just fine, but still goes out with a DLL.. And I'm trying to get a single-file distribution with this project. – MisterNad Sep 01 '20 at 10:02
  • @John There seems to be little point to including the project in my solution if it's just going to be a separate library. I was trying not to have to distribute anything more than a single file. (This is intended for computer ..illiterate.. people. So "put this on your desktop and run it" is infinitely easier to explain lol) – MisterNad Sep 01 '20 at 10:05
  • 3
    Well, you distribute a single installer, so... what matters if you have one or more assemblies under `/bin/` (or whatever) when you deploy? Everyone does. – Jimi Sep 01 '20 at 10:17
  • There's not going to be an installer. It's literally a single file, drop and go. This single-file program is just a wrapper/GUI for an open source, single file, command-line--only tool. I had even considered embedding that external tool, but for purposes of updating, decided against it. So is there no way to accomplish what I asked in the OP? – MisterNad Sep 01 '20 at 10:36
  • I'm not sure how you made the jump to "no way to accomplish" when I linked you to a question that had code to do exactly that. – ProgrammingLlama Sep 01 '20 at 10:40
  • @John In my 'PS' in the OP, I mentioned not wanting to have it compile to a .DLL that's embedded in my application. I'm essentially trying to merge the two projects, not embed one assembly in another. – MisterNad Sep 01 '20 at 10:42
  • There's a project type that you can include in another project and it essentially compiles straight into that. I'm not at my computer right now and I completely forget what it's called. It's like a class library but without being its own assembly. – ProgrammingLlama Sep 01 '20 at 10:48
  • I love portable apps and I appreciante the effort you spend on this. Nothing is wrong with ILMerge. Just don't do it manually. Set up a build process and have it automated. – Thomas Weller Sep 01 '20 at 11:49
  • @John I took a gander around build settings and output types, but am not seeing what you're referring to. If you get a chance to take a peek for me, I'd appreciate it :) – MisterNad Sep 02 '20 at 01:59
  • 1
    I think it's a "Shared Project". – ProgrammingLlama Sep 02 '20 at 02:32
  • @John Googling shared projects leads me to think this is actually precisely what I was looking for. Thank you! – MisterNad Sep 02 '20 at 03:02

1 Answers1

1

If you don't want a separate DLL, and you don't want an embedded DLL, then perhaps a "Shared Project" project type is what you're looking for. The docs state:

A Shared Project does not get compiled on its own, it exists purely as a grouping of source code files that can be included in other projects. When referenced by another project, the code is effectively compiled as part of that project. Shared Projects cannot reference any other project type (including other Shared Projects).

While I don't think your project is exactly what it's intended for, I think it will work in your scenario.

See What is the difference between a Shared Project and a Class Library in Visual Studio 2015? for more information.

ProgrammingLlama
  • 36,677
  • 7
  • 67
  • 86