Compiling forms in C #

I want to compile each individual form in my application in order to use it as a dll myself ... I examined this and found very confusing representations of assemblies, which may or may not be what I wanted.

Is it possible to compile form1.cs, form1.designer.csand form1.resxas a single file, which will then be used as a dll. I use "dll" as an example, because it is the functionality I need with each of these forms when compiling into one file, I need to be able to call it and use it from the shell application.

I know that in VS you can create a separate project that will compile in dll, but with something on the verge of 80 forms for compilation ... it will be a dirty thing to maintain. So basically, is there an easier way?

this is the closest code I could get, but it is in the console, so it would be unforgivable if there are easier ways ... also I'm not sure if it will actually compile form1.cs, form1.designer.csand form1.resxstill work as a dll

csc /target:library /out:MathLibrary.DLL Add.cs Mult.cs

thanks for the help

+4
source share
3 answers

Possible? Yes. Goodies? Umm, not sure.

You must study the options for CSC in order to use them this way.

.

RESX ResGen.exe .

/References DLL.

, , , , . , ? ?

.

+1

, . . dll . , 80 , , , .

, exe. dll , . , dll , exe . ( dll s, ..). Type ( dll), ( , InitializeComponents, ) .

, -. , . , . ( , , ..). - :

interface ILoginImplementation
{
    public void SetInitialUserName(string name);
}

interface ILoginLogic
{
    public bool TryAuthenticate(string name, string password);
}

Implementation - , , Logic - , .

+1

, , , , - , Visual Studio .dll, .

node Add > New Solution Folder, . , .

PS: If you haven’t done this yet, you should definitely try to create an interface or a base class (or both!) From which each of your Form-classes can occur or implement. If you can abstract away and generalize part of the logic, this is likely to save you a lot of work along the way.

0
source

Source: https://habr.com/ru/post/1535485/


All Articles