question

Wami007-9389 avatar image
0 Votes"
Wami007-9389 asked PetrusKIM-2099 commented

C++/CLI V.S error " ClassLibrary.dll isn't a valid win32 application" . Changing startup item .

Click to see Error Image.png



Hello Everyone...
I am trying to creat "UserControl" then add it to "MainForm" in C++/CLI. But i found only one solution to add "UserControl" to "MainForm" via creating project as a Class Library.dll ...
But in this case I can't Target Startup Item to Main form to Build .exe and V.S gives an error normally when trying to build "ClassLibrary" . Any Solution for it? ....

dotnet-csharpc++dotnet-runtimedotnet-standard
· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Must İ need create .dll for adding userControl to Form and import it to another Windows Form Project ?

0 Votes 0 ·

@Wami007-9389

As far as I'm concerned you need create a .dll that contain a user control that can be imported in a windows form.

C++/CLI V.S error " ClassLibrary.dll isn't a valid win32 application" . Changing startup item .

You couldn't run dlls directly, normally they get dynamically loaded into an exe.

0 Votes 0 ·

I am do it already but , desired make it without .dll :(

0 Votes 0 ·
Show more comments
PetrusKIM-2099 avatar image
1 Vote"
PetrusKIM-2099 answered PetrusKIM-2099 commented

Class Library is not an Executable Program.
So, You need another Executable .Net Program to execute and test your library.


86865-image.png



The red box is user control from c++/cli.


image.png (90.4 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I can add UserControl separately using ClassLibrary but it getting hard to control project and desire make it in same Form Project ((

0 Votes 0 ·

If your C++/CLI DLL project include an user control, then you can find the control in the Toolbok.
First, in the Toolbok, click "Choose Items..." menu.
Next, Click "Browse..." button and select your DLL file.
Then You can see the control.
87360-vs.png


0 Votes 0 ·
vs.png (41.7 KiB)
Wami007-9389 avatar image
0 Votes"
Wami007-9389 answered

If anyone can add UserControl in MainForm (.exe) project Or No way to make it without Seperate (ClassLibrary) tell me please ...

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.