LO's Sharp Devs

C# , XNA Game Development Blog. Intentionally more than only for game authors but for C# programmers in general.

Moje zdjęcie
Nazwa:
Lokalizacja: Poland

czwartek, 2 lipca 2009

VS 2008 - Disappearing dependencies

Hi, after a long break I have something interesting to post :) I've encountered lately some weird behaviour of Visual Studio 2008 Installer Projects. I checked roughly Google, to find if anyone have solved that - but seen only problem mentioned. Therefore I will describe the issue and then how I dealt with this.

I've been re-factoring rather complex yet simple project with many project files in this. More to say: web-service, web-client, windows-service application (with own installer for each one), bunch of plug-in files used by windows service, couple of tool libraries, business layer library, DAL library, communication library, testing projects, etc.
I wanted to get rid with DAL and business layer being directly or indirectly referenced by plug-ins or web-client which I'd considered at least a "bad design". Therefore I've created two separate libraries with almost only interfaces within them - let say BaseInterfaces.dll and Interfaces.dll (data object and root classes were already separated into another file or files so when I tried to use only one interface library there occurred circular reference, which I did not intended to fix at the moment) .
I changed then almost all projects and libraries within solution to use them, and after a standard juggle with code I removed bad references to Business layer and DAL. Compiled everything, verified that all executes correctly, packed installers and delivered to first line QA.
Then bump! Windows service crashes on start! Quick check - and there is missing Interfaces.dll. What?! It works here on testing framework, web page and web-service install correctly...
So then I've checked installers and it appeared that this file was not installed into root folder, however - while another copy being referenced by plug-ins (that were located in sub-folder of Windows service) was installed correctly! It of course also installed right for web-service and web-client.
I've checked project outputs, references and dependencies, tried to remove outputs from installer and put them back. I even tried to add that missing library output directly into installer - file was still missing (So not even appearing on the list of the files going to be installed into "Application Folder").
Then I started investigating Windows service app once again. I've seen that it referenced directly to Interfaces.dll (because was calling some object in BusinessLayer.dll that implemented one of the interfaces contained within, and in such situation just "inheriting" reference in is not enough) and "inherited" BaseInterfaces.dll the normal way from BusinessLayer.dll (that used both interface libraries of course). That second one has been built into installer correctly. And both appeared in both Windows Service and BusinessLayer.dll "Bin" and "obj" folders.
Then I just added that BaseInterfaces.dll directly to Service references. And yes! It disappeared from the installer project too! What the ...? Ah so!

After small code change I was able to remove Interfaces.dll reference from Windows service project and then all went fine from that point...

CONCLUSION:

It appears, that installer optimization is sometimes too "smart". It has found that I'm referencing that DLL in the "outputted" project, but also, that I'm not using it directly there, so it considered to mark it as not required or used at all. It seems that it anyway did it it in such way that covered that this library IS actually used by other libraries that are called by the service itself, or even more - when it is directly added to the installer project! I, therefore, consider this behaviour of installer as a bug.


I hope that it could help someone. Any comments?

Etykiety: , , , , ,

Komentarze (0):

Prześlij komentarz

Subskrybuj Komentarze do posta [Atom]

<< Strona główna