Creating component generating DLL

0

I modified some components by generating a DLL when compiling the project. Is there any way this DLL can only be used together with the current project? Is there any way to not generate the DLL and compile everything as a single executable?

    
asked by anonymous 22.12.2016 / 16:57

2 answers

0
  

Is there any way this DLL can only be used together with the project   current?

There is a business called Strong Name, basically it will create a hash between for the DLL, this way your project gets tied to that DLL:

Link:

Strong-Named Assemblies How to: Sign an Assembly with a Strong Name

  

Is there any way to not generate the DLL and compile everything as a single   executable?

There is a type of project called Shared, it does not generate DLL any code is placed inside the exe, it is available in the version of VS2015:

Link: Shared Project: An Impressive Feature of Visual Studio 2015 Preview

Visual Basic 14 - New Version Updates - Shared Projects

What is the difference between a Shared Project and a Class Library in Visual Studio 2015?

    
22.12.2016 / 17:21
0

I hope that when you are referring to components as being the controls used for manipulating the user interface (i.e. textbox, combobox, etc.).

  

Is there any way to not generate the DLL and compile everything as a single executable?

Yes, it is possible to extend components and have everything compiled into a single executable. For this to happen, simply create the class that extends the component, or its own component, into the main project.

Please note that this is not about including one project within another. The component code must be transported and adapted within the main project to be compiled into the same executable. For any other existing project (outside the main project) a DLL will be created.

In the following example, I customized a textbox and inserted a property called CorFund (I know the BackColor already exists, but I used it as an example only). Note that everything is within the main project.

publicpartialclassTextBoxPersonalizada:System.Windows.Forms.TextBox{publicvoidCorFundo(System.Drawing.Colorcor){this.BackColor=cor;}}

Personalizationconsistsofdisplayingthetextboxwiththebackgroundinred.

TheimageaboveshowsthecomponentintheToolBoxandaddedtothemainform.

Themainformcodeis:

publicpartialclassForm1:Form{publicForm1(){InitializeComponent();}privatevoidForm1_Load(objectsender,EventArgse){textBoxPersonalizada1.CorFundo(System.Drawing.Color.Red);}}

Andtheresult:

  

Is there any way this DLL can only be used together with the current project?

How much the use of the DLL only by the current project seems, at first glance, like something incoherent. If you do not want to use the functions of this DLL with other projects, place these functions within the main project, because the purpose of using libraries is to provide access to methods that can be shared by multiple applications, thus avoiding duplicate code. p>     

22.12.2016 / 17:24