Monday, April 26, 2010

How to install shared assembly into GAC using Inno Setup

Well... This is my first post about IT. From now I’m going to share my experience in troubleshooting problems I faced with. There are some reasons to do so. First of all I hope that this info would be helpful to other people. I often find answers to my tech questions at someone’s blog. It saves me a lot of time. So I feel responsibility to return this energy back to the World. If someone will find my post useful – I’ll reach the goal. Another reason is to practice my written English. My native language is Russian. But if I have a problem I prefer to google solution in English because, on my humble opinion, there are much more info available on English and it is more detailed than info on Russian (because English-speaking audience is much wider than Russian-speaking). So it is a good idea to share information (especially IT information) on English.

Now, let's begin.

Here the results of my investigation on how Inno Setup (I've used version 5.3.9 - latest at the moment) works with GAC.
First of all, it do allow to install assemblies in GAC (you should add gacinstall flag to the file). Inno also automatically uninstall assemblies from GAC during uninstall process.

If you forget to add StrongAssemblyName parameter to the file you will be prompted by setup compiler to do that. Note that full assembly name have to be ended by "ProcessorArchitecture=MSIL" in order the assembly to be uninstalled correctly.

But if you have more than one application using the same assembly from GAC you faced with a problem. Inno Setup (as opposed to WiX) doesn't support GAC reference counting mechanism. When both applications are installed and you uninstall one of them, Inno will remove assembly from GAC (that makes other app nonworking).

To solve this issue, you can use another Windows internal mechanism of reference counting which Inno Setup supports. You can apply sharedfile flag to the file and it will solve the issue. But you will get a small side effect. Two copies of the assembly will be installed: one in GAC and another in a destination folder of installed app. The reference counting mechanism is keep working even if the file is installed by two different apps in there own folders. Of course installers of both apps should be written on Inno Setup (I haven’t tested the case when one setup is .msi and another is made by Inno).

Another side effect – during uninstall you get a dialog that asks you whether shared assembly should be uninstalled or not (if an assemblies’ reference count become 0).

To wipe out this dialog you should add uninsnosharedfileprompt to the file’s list of flags.

Thereby to more or less reliably install an assembly into GAC by the help of Inno Setup you should add three attributes to the files in [Files] section of setup script: gacinstall sharedfile uninsnosharedfileprompt.

Example:

[Files]
Source: "Files\MyAssembly.dll"; DestDir: "{app}"; StrongAssemblyName: "MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=48d60606109a2257, ProcessorArchitecture=MSIL"; Flags: "gacinstall sharedfile uninsnosharedfileprompt"

Last, I should say I haven’t tested the case of a shared assembly between two applications which written in different installation systems (for example WiX and Inno Setup), but suppose you will have some troubles if you are going to mix them up.

Wednesday, May 23, 2007

Курилщиков потеснили

Ура!!
Теперь каждая забегаловка должна иметь места как для курящих, так и для некурящих. Причём поровну - по половине помещения!
http://www.rbc.ru/digest/index.shtml?izvestia/2007/05/23/31490119

Хорошо бы ещё запретили курить в местах скопления народа (в толпе, например, или в очереди), а также на платформах ЖД и автовокзалов!
А то стоишь, ждёшь маршрутку, а рядом с тобой 5-6 "паровозиков". И ты весь пропитываешься этим: и одежда, и волосы!

Или, например, идёшь утром на работу в толпе, а кто-то впереди дымит. На ходу дыхание учащается. Лёгкие забирают больше воздуха, чем обычно, а значит - больше дыма. Мало того, что курильщик портит своё здоровье, так ещё и окружающих заставляет делать то же самое!!

Но похоже, остаётся только мечтать об этом. Пока запретили курить только в транспорте ((
http://www.vg-news.ru/columns/consumer/consumer-230507-032330.php

Tuesday, May 22, 2007

Женская интервенция в мужское пространство

Женщины умеют очень незаметно вторгаться в нашу жизнь. А потом смотришь - и ты уже "под каблуком".

Немогого о признаках, по которым можно заметить такую опасную тенденцию )), здесь:
http://blogs.mail.ru/mail/irinka1507/36378D1E8F3F6540.html

Wednesday, May 9, 2007

Как правильно использовать Интернет

А вот ещё один очень забавный мультик.
Про то, как использовать Интернет. На англицком, правда, но мелодия оч. весёлая.
А главное - по существу! :о)
http://www.badjojo.com/viewVideo.php?video_id=1427

car for women

This summary is not available. Please click here to view the post.

Tuesday, May 8, 2007

Блондинка за рулём

У меня знакомые работают во дворе здания, которое имеет очень узкий проезд, между стенами с трудом разъезжаются две легковые машины. Дорога заканчивается тупиком (как в Бриллиантовой руке). Вдоль всей этой кишки офисы, соответственно припаркованные машины. Соответственно, въехал! места нет?? Быстро выгружай высаживай и проваливай...не создавая пробку.

За долгое время дорога развалилась совсем, и решено было всем "бизнесцентровским колхозом" дорогу заасфальтировать. В добровольно принудительном порядке т.е. Все среди себя договорились, что машины парковать не будут, и охраннику сказали что бы всех пришлых гонял.

И вот в один прекрасный день в кишку въезжает светловолосое насекомое на мерине "S" класса, ни разу не старом. Останавливается поперек всей дороги, с понтом закрыла машину и направляется в здание. К ней подошел охранник и вполне корректно сказал, что не стоит машину здесь ставить. Мол тут дорогу делать будут и сейчас щебень привезут. На что соотв. охранник был торжественно послан (на что он даже не обиделся). Блондинка была в здании достаточно долго. Но когда она вышла то увидела следующую картину....

Восемь куч приблизительно по 13 тонн каждая, были насыпаны от ее машины до самого выхода в шахматном порядке (подозреваю что охранник подсуетился) исключая даже мысль о том что отсюда можно выехать. При этом из окон офисов уже свисали истерически ржущие работники.

Визг блондинки был пронзителен, а фантазия безгранична.....

Судя по излагаемому матом, здесь должны были материализоваться из воздуха "братки" в количестве уж ни как не меньше чем с 2-ой Белорусский фронт.... А дальше она допустила громадную ошибку.

Демонстративно достает телефон.
Звонит.

При этом давит слезу в кратце рассказывая суть проблемы.....

И ожидая праведного гнева благоверного (для окружающих) переводит телефон в режим громкой связи...(дабы окружающие да убоялись). После небольшой паузы из телефона устало обреченным голосом раздается.....

"СТОЙ ТАМ! СЕЙЧАС Я ПРИВЕЗУ ТЕБЕ ЛОПАТУ!"

Люди начинают падать из окон....

ЗАНАВЕС!