Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
7
Erster Beitrag:
vor 5 Jahren, 8 Monaten
Letzter Beitrag:
vor 5 Jahren, 8 Monaten
Beteiligte Autoren:
Hugo Tessaro, Arie, John Marrone

How to include a C# assembly when generating executable

Startbeitrag von Hugo Tessaro am 23.02.2012 18:02

Hello,

I developed a C# class library, and I am using it in WinDEV projects.
I added my C# DLL following this steps: Workshop > .NET > Use a .NET assembly in this project, then added my DLL.

I can use in my project normally, but when I create the executable of my WinDEV application and try to execute functions of my DLL in other computer, the application return error because the executable try to find the DLL with the path I specified when I added the assembly in the project...

someone can help me? =(

Thanks

Antworten:

Well, I found a solution to run the application...

First u need to add your assembly to GAC (using gacutil.exe, then your assembly will be in C:\Windows\assembly (I think u need to sign the assembly too, I used SharpDevelop, right click on your project > Properties > Signing > check Sign the assembly, u need .NET Framework SDK installed)), then add this to your WinDEV project.
Now u can use Inno Setup to auto install your DLL in GAC

Inno Setup Script (I recommended u to use ISTool)
[Files]
Source: ..\..\..\FULLCLIB\FULLCLIB\bin\Debug\FULLCLIB.dll; DestDir: {app}; Flags: restartreplace ignoreversion gacinstall; StrongAssemblyName: FULLCLIB

If someone know any solution to add the assembly directly to executable (to dont need instal lthe DLL to GAC), reply please... =P

Thanks

von Hugo Tessaro - am 23.02.2012 20:02
Hugo,
I have made C# dll too and the only hting I need to do is putting the dll into the applications exe directory.
No register, GAC, signing, nothing.
Maybe it has something to do with options generating the assembly? I don;t know. I use VS2010 and just hit the build button.

von Arie - am 24.02.2012 08:24
Hum..

Arie,
In your window List of .NET assemblies when u add your DLL in WinDEV project, the physical name is the path of your DLL in project of VS2010 or u added your DLL in other directory? Because when I use a class of my DLL the project WinDEV (ver. 15) try to find the DLL in "physical name"

Later I will compile the DLL in VS

Thanks

von Hugo Tessaro - am 24.02.2012 12:59
I did some test. It appears on my development machine, the DLL is registered by Visual Studio, say in c:\dev\vs\app1\bin\debug\test.dll

After that I copied this dll into my Windev project map, say:
c:\dev\mywindev\exe\test.dll

In the list of .NET assemblies it shows the windev map, because I imported it from there.

When I remove the dll from the WD-map, my app is still running.
If I remove it from the VS-map, I get the error, same as you have.

So I guess: my Windev application first starts searching in the current map. If it doesn't find the dll it searches the registry and switches to the registered map (the VS location).
If it doesn;t find it there an exception is thrown.

von Arie - am 24.02.2012 14:42
Arie

I hate to bother you but how do you get this site back to english? The post are in english but the forum is in who knows what. I just clicked on the top post and you were the unlucky one. If you can help me I would really be thankful.

John

von John Marrone - am 24.02.2012 15:05
John, no problem.
Find the [control centre] link at the top of the forum.
(2nd orange bar if you are in the Windev forum..
But is sits also in the "forum list".
Then goto the "language" under "options".

von Arie - am 24.02.2012 15:49
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.