KB Article K18330
Visible to All Users

How to load Office and Bonus skins' libraries at runtime

Description:
I have an application that uses your Skins Library. To reduce an installation's size, Office and Bonus skins are not included in it by default. I want to provide a capability to download the "Skins Pack" separately that would install the Office (DevExpress.OfficeSkins.vX.Y.dll) and Bonus (DevExpress.BonusSkins.vX.Y.dll) skins DLLs to my application's directory if a user wants them. How can I load these DLLs if they are present?

Answer:
To load DLLs dynamically use the static LoadFile method of the Assembly class. This is the standard class and you can find more information about it in the Assembly.LoadFile Method (String) MSDN help topic.
Then, all you need is to call the SkinManager's RegisterAssembly method. For more information, please see the Custom Skin Registration help topic.
Your final code can look like this:

C#
public Form1() { InitializeComponent(); string fileName = "DevExpress.BonusSkins.v9.3.dll"; if (File.Exists(fileName)) { Assembly SampleAssembly = Assembly.LoadFile(Path.GetFullPath(fileName)); DevExpress.Skins.SkinManager.Default.RegisterAssembly(SampleAssembly); } else MessageBox.Show("File not found"); }
Visual Basic
Public Sub New() InitializeComponent() Dim fileName As String = "DevExpress.BonusSkins.v9.3.dll" If File.Exists(fileName) Then Dim SampleAssembly As System.Reflection.Assembly = System.Reflection.Assembly.LoadFile(Path.GetFullPath(fileName)) DevExpress.Skins.SkinManager.Default.RegisterAssembly(SampleAssembly) Else MessageBox.Show("File not found") End If End Sub

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.