Autor Beitrag
pascalsv
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 133

Win XP Prof. SP2 / Windows 7
Visual Studio 2008 / Silverlight 3 / Silverlight 4 Beta
BeitragVerfasst: Mi 10.09.08 09:06 
Hallo zusammen,

für mein Dll-Projekt nutze ich eine externe Dll. Wenn ich das Projekt nun kompiliere, erhalte ich "meine" dll und die externe dazu.

Ist es möglich, die externe dll im Projekt so einzubauen, dass als Build-Ergebnis nur "meine" dll erzeugt wird, die die externe dll beinhaltet?

Danke,

Pascal
Th69
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Moderator
Beiträge: 4799
Erhaltene Danke: 1059

Win10
C#, C++ (VS 2017/19/22)
BeitragVerfasst: Mi 10.09.08 09:25 
Nein, statische Libraries (wie mit C/C++) sind mit C# bzw. NET nicht möglich.
Du müßtest schon den Source-Code der externen Library direkt in deine DLL einbinden.
pascalsv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 133

Win XP Prof. SP2 / Windows 7
Visual Studio 2008 / Silverlight 3 / Silverlight 4 Beta
BeitragVerfasst: Mi 10.09.08 17:01 
Hi,

danke für die eindeutige Antwort. Ich habe nun das Problem, in welches Verzeichnis diese zweite dll hingehört. Scheinbar wird sie im gleichen Verzeichnis wie die "erste" dll mit dem Hauptprogramm nicht erkannt. Was nun? Eine Ablage in c:\windows\system fände ich nicht besonders elegant.

Pascal
Kha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3803
Erhaltene Danke: 176

Arch Linux
Python, C, C++ (vim)
BeitragVerfasst: Mi 10.09.08 17:18 
user profile iconpascalsv hat folgendes geschrieben:
Scheinbar wird sie im gleichen Verzeichnis wie die "erste" dll mit dem Hauptprogramm nicht erkannt.
Das sollte eigentlich auf jeden Fall funktionieren. Zum Debuggen kannst du den Suche bei Google FUSIONLOGVW benutzen.

user profile iconTh69 hat folgendes geschrieben:
Nein, statische Libraries (wie mit C/C++) sind mit C# bzw. NET nicht möglich.
Zur Not gibt es immer noch Suche bei Google ILMERGE ;) .

_________________
>λ=
pascalsv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 133

Win XP Prof. SP2 / Windows 7
Visual Studio 2008 / Silverlight 3 / Silverlight 4 Beta
BeitragVerfasst: Mi 10.09.08 17:53 
Hi Sebastian,

danke für die Links. Eine weitere Software will ich nicht verwenden. Allerdings komme ich mit Assembly noch nicht so klar.

Hier mein bisheriges Coding:
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
Assembly SampleAssembly;
SampleAssembly = Assembly.LoadFrom(@"C:\...\Addins\pommes.dll");
// Obtain a reference to a method known to exist in assembly.
MethodInfo Method = SampleAssembly.GetTypes()[0].GetMethod("Method1");
// Obtain a reference to the parameters collection of the MethodInfo instance.
ParameterInfo[] Params = Method.GetParameters();


Ich referenziere bisher ja den Namespace der dll mit "using". Wie mache ich das hier? Ausserdem brauche ich den Zugriff auf sämtliche Variablen und Methoden der dll. Wie erreiche ich das? Und dann am besten so, dass ich sie möglichst einfach im Code aufrufen kann?

Danke,

Pascal
Kha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3803
Erhaltene Danke: 176

Arch Linux
Python, C, C++ (vim)
BeitragVerfasst: Do 11.09.08 12:28 
Warum willst du denn die Assembly dynamisch einbinden? Normalerweise einfach das andere Projekt in "Referenzen" hinzufügen, das wars.

_________________
>λ=
pascalsv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 133

Win XP Prof. SP2 / Windows 7
Visual Studio 2008 / Silverlight 3 / Silverlight 4 Beta
BeitragVerfasst: Do 11.09.08 12:51 
Ja, aber das geht nicht. Die dll wird zwar in das gleiche Verzeichnis gelegt wie die dll des Programms, aber nicht gefunden. Ich erhalte:

"Could not load file or assembly"...

Ich habe die dll in c:\windows\system kopiert aber auch das hilft nichts...
Kha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3803
Erhaltene Danke: 176

Arch Linux
Python, C, C++ (vim)
BeitragVerfasst: Do 11.09.08 15:48 
Dazu kann ich dir nicht mehr sagen als beim letzten Mal: Das sollte auf jeden Fall funktionieren. Und Fuslogvw.exe (so heißt das Ding richtig) ist kein 3rd-Party-Tool, sondern Bestandteil des SDKs.

_________________
>λ=
pascalsv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 133

Win XP Prof. SP2 / Windows 7
Visual Studio 2008 / Silverlight 3 / Silverlight 4 Beta
BeitragVerfasst: Do 11.09.08 16:17 
Komisch, ich habe die Datei Fuslogvw.exe gar nicht, obwohl ich sowohl NET2.0 als auch NET3.5 installiert habe. Wo sollte die Datei zu finden sein?

Kann ich sie irgendwo runterladen?

Danke,

Pascal
Kha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3803
Erhaltene Danke: 176

Arch Linux
Python, C, C++ (vim)
BeitragVerfasst: Do 11.09.08 22:22 
Nicht Runtime, SDK ;) .
Bei VS05 war es afair noch dabei :gruebel: ...

_________________
>λ=
pascalsv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 133

Win XP Prof. SP2 / Windows 7
Visual Studio 2008 / Silverlight 3 / Silverlight 4 Beta
BeitragVerfasst: Fr 12.09.08 10:03 
Bei VS2008 ist sie wohl nicht dabei.

Ich bekomme definitiv eine System.IO.FileNotFoundException. Leider ist die ganze Sache schwer zu debuggen. Wie kann ich denn den verwendeten Pfad auslesen?

Rufe ich ein
ausblenden C#-Quelltext
1:
2:
Assembly SampleAssembly;
SampleAssembly = Assembly.LoadFrom(@"C:\Program Files\...\myCommon.dll");

auf, findet er die dll einwandfrei, obwohl der Pfad auf das Verzeichnis mit der Programm-DLL zeigt.

:nixweiss:
pascalsv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 133

Win XP Prof. SP2 / Windows 7
Visual Studio 2008 / Silverlight 3 / Silverlight 4 Beta
BeitragVerfasst: Fr 12.09.08 13:24 
OK,

nehmen wir den Fall, ich müßte die dll manuell zur Laufzeit einbinden. Wie mache ich das am geschicktesten? Ich nutze ja schon den Namespace und die Methoden zur Entwicklungszeit...

Danke,

Pascal