Запаковываем с помошью утилиты fastseal.exe

Sealing a Management Pack using fastseal.exe
Following on from Transferring Incident Action Logs to the Data Warehouse this post is a quick guide on how to seal a Management Pack using fastseal.exe. There are lots of instructions on how to do this already, but here are mine.

You need to seal a Management Pack (.xml) into a “.mp” file if one of the following is true:

You want to reference your MP from another MP (unsealed MPs cannot be referenced)
Your MP contains Data Warehouse extensions
Your MP contains one or more console tasks and you want to prevent the security warning when they get run
You want consistent Guids for you classes and properties, etc on every system your MP is imported on, for example, to refer to from code.
Create your SNK

Firstly, you’ll need to create a Strong Name Keyfile (.snk) to seal your Management Pack with. I use sn.exe for this, which is installed as part of Visual Studio or available from the Windows SDK in a location such as “C:\Program Files\Microsoft SDKs\Windowsv7.0A\bin” or “C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin”.

Create your snk:
sn -k yourkey.snk

Extract the public key from your new snk into a second new snk:
sn -p yourkey.snk yourpublickey.snk

Get the readable public key token from the second file:
sn -tp yourpublickey.snk > yourpublickeytoken.txt

The last line of the txt file will say something like “Public key token is c2e33c3aa46ba97e”. You need this value in your Management Pack.

Note that sn.exe switches are case sensitive.

Update your Management Pack

Edit your .xml Management Pack in Visual Studio or your preferred xml editor and scroll down to the section and add the line:

Replace the value of “c2e33c3aa46ba97e” with your new public key token and save your Management Pack.

If you don’t do this, your Management Pack will seal but Service Manager will throw an error when you try and import it.

Note – if you are using the Authoring Tool to seal a Management Pack, do not add this line as the AT does it for you.

Download fastseal.exe

Fastseal.zip (from blogs.technet.com)

Seal your Managment Pack

Place your .xml, fastseal.exe and your .snk (yourkey.snk, not yourpublickey.snk) into the same folder and seal the MP like this:

fastseal.exe YourMP.xml /keyfile yourkey.snk /company “Your Company Name”.

You can now import your sealed .mp file.

Changing a Sealed Management Pack

If you need to make changes to your sealed MP, edit the unsealed .xml and increase the version by at least one in the section. Make your changes and reseal. When you re-import, Service Manager will “upgrade” your existing Management Pack version to the new version. You cannot re-import a sealed Managment Pack if the same version already exists.

Deleting a Sealed Management Pack

If you delete a sealed MP, all of the data that it defined such as new classes (and all instances of these classes) or class extensions (and all extension data) will be lost.

However, you can re-import such a Management Pack again and all of your classes and extensions, etc will be recreated with the same Guids.

If your MP contained Data Warehouse extensions, you should wait for the MPSync/ETL process to complete the removal of the Management Pack before importing it again.

Реклама

Добавить комментарий

Заполните поля или щелкните по значку, чтобы оставить свой комментарий:

Логотип WordPress.com

Для комментария используется ваша учётная запись WordPress.com. Выход /  Изменить )

Google+ photo

Для комментария используется ваша учётная запись Google+. Выход /  Изменить )

Фотография Twitter

Для комментария используется ваша учётная запись Twitter. Выход /  Изменить )

Фотография Facebook

Для комментария используется ваша учётная запись Facebook. Выход /  Изменить )

w

Connecting to %s