Add Application in ein anderes Project per XIDE

Deutschsprachiges X#-Forum – German language forum

Moderator: wriedmann

Post Reply
lagraf
Posts: 419
Joined: Thu Jan 18, 2018 9:03 am

Add Application in ein anderes Project per XIDE

Post by lagraf »

Hallo,
ich habe ein Projekt LIBS, wo ich eine Sammlung von Libs verwalte, unter anderem eine Wrapper Lib _RKSV 1.76, welche 2 Fremd-Dlls für den Zugriff auf Smartcards referenziert.

In einem anderen Projekt WW habe ich eine App RBKASSA, die diese _RKSV 1.76 referenziert. Dazu habe ich die _RKSV 1.76 per "Add application" aus LIBS hinzugefügt und in RBKASSA referenziert. Starte ich RBKASSA, funktionieren die Zugriffe auf die Smartcard NICHT!

Importiere ich jedoch die App RBKASSA direkt in das Projekt LIBS, dann funktioniert alles! Es klappt also, wenn App und Lib im gleichen Projekt sind, es funktioniert jedoch nicht, wenn die Lib _RKSV 1.76 eingebunden wurde.

Gibt es da ein Problem in XIDE, oder muss ich das anders machen, wenn ich die LIBS anderen Projekten zur Verfügung stellen will?

LG Franz
User avatar
Chris
Posts: 4573
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Add Application in ein anderes Project per XIDE

Post by Chris »

Hi Franz,

What do you mean by it does not work, do you get an error message? At compile time or runtime? Are the compiler options the same in both cases? Also the dlls are the correct ones and in the folder when the app runs from (typically the Debug or Release folder)?

There should be no problem for this to work in either way.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
lagraf
Posts: 419
Joined: Thu Jan 18, 2018 9:03 am

Re: Add Application in ein anderes Project per XIDE

Post by lagraf »

Hi Chris,
I have a project called RKSV with X# lib _RKSV 1.76 which references 2 extern C# DLLs ITGRKSVCom.dll and RKSVComComplete.dll.

Then I have a second project Warenwirtschaft where I added lib _RKSV 1.76 from project RKSV. Within a testing app TEST I referenced this lib _RKSV 1.76, you see this project in attached jpg.

When I debug app TEST the stack is as follows:
1) call to _RKSV 1.76 class RKSV method GetReadersCount()
2) call to _RKSV 1.76 class RKSVINT method GetReadersCount()
3) call to foreign dll RKSVComComplete method GetReadersCount() -> wrong return of 0

It looks like that this call cannot be done because these 2 DLLs reside in project RKSV and not in project Warenwirtschaft! It comes back with value 0 instead of 1. No errors or warnings at compile and runtime.

Regards, Franz
Attachments
test.jpg
User avatar
robert
Posts: 4243
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: Add Application in ein anderes Project per XIDE

Post by robert »

Franz,
Add a reference to the C# DLLs in your main project and make sure that they are copied to the bin folder.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
lagraf
Posts: 419
Joined: Thu Jan 18, 2018 9:03 am

Re: Add Application in ein anderes Project per XIDE

Post by lagraf »

Hi Robert,
- I added ref ITGRKSVCom.dll and RKSVComComplete.dll to app TEST
- wrote USING RKSVComComplete to code
- wrote USING ITGRKSVCom to code
- compiled with error XS0246 (ITGRKSVCom could not be found)

So I deleted line USING ITGRKSVCom and compiled successful.
Both DLLs are now under project Warenwirtschaft dir \Bin\Debug.
But still no correct return when calling foreign DLL method.

What else can I try?
Franz
User avatar
Chris
Posts: 4573
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Add Application in ein anderes Project per XIDE

Post by Chris »

Hi Franz,

There should be absolutely no difference if the dll is part of the project or an external reference. Just please note that for external references, XIDE (like VS) by default automatically copies the referenced dlls to the bin folder, so if you are referencing and older dll version, then this will be always copied to the bin folder when compiling or running from within XIDE, overwritting a different version that might already exist there. This can be changed by clicking Edit/properties on the reference (in the app properties window, or right click on the reference item in the Project explorer) and disabling the "Copy to Bin folder" option, but I wouldn't suggest doing that, instead make sure that you are referencing the correct version.

So, please do as Robert said, and if this still doesn't work, can you please zip and send me the two projects, so I can have a look here?
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
lagraf
Posts: 419
Joined: Thu Jan 18, 2018 9:03 am

Re: Add Application in ein anderes Project per XIDE

Post by lagraf »

Hi Chris, I found it!

The 2 foreign DLLs reference 3 more foreign DLLs and these are not copied to the bin folder when compiling, cause XIDE has no knowledge about them.

I copied all 5 DLLs into bin folder and then it worked!

Thanks, Franz
Post Reply