Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear Friends,
I have created a library project in my current solution. I want to publish the setup where the dll file I am using become the part of my exe file. I Don't want it to separately visible on the client side. Please help.
Regards
Posted
Comments
Sergey Alexandrovich Kryukov 11-Mar-15 11:20am    
Not clear. DLLs representing a .NET assemblies can be used through referencing or reflection, other DLLs — through P/Invoke. Just read on these topics, try to understand better what you want to achieve, the use "Improve question" link above.
—SA

1 solution

You can use ILMerge to combine multiple .NET assemblies into a single .NET assembly.

You can use the approach from the following article (also there are some additional approaches mentioned at the bottom of the article under the 'Alternatives' section):
Load DLL From Embedded Resource[^]

But because your library project is in the same solution what you can do is just edit your 'csproj' file so that on 'release' mode you include the compiling of the library project's classes as well.
That would look something like the following:
XML
<ItemGroup Condition=" '$(Configuration)' == 'Release' ">
  <Compile Include="relative-path-to-your-library-project\*.cs">
    <Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
    <Visible>false</Visible>
  </Compile>
</ItemGroup>
 
Share this answer
 
v2
Comments
J imran 11-Mar-15 12:03pm    
not getting the last solution... you mean I need to edit csproj file of my application assembly and give the path of the reference assembly classes?
Mario Z 20-Mar-15 17:22pm    
Hi, I just wanted to let you know that I wrote a small Tip that demonstrates how to do this:
Combining multiple .NET assemblies
Mario Z 11-Mar-15 12:11pm    
Yes exactly, you would edit the csproj of your executable project and add a path to your library project. With the '*.cs' wildcard you are selecting each class from your library project.
I hope that will be enough, unfortunately I don't know what your library consists of so some additional inclusions could be required.
Also just as a side note, for this approach your executable project needs to have all the reference that your library project has (after all it will compile its content).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900