Dynamically Loaded Modules (.xap) with Build Server Versioning
-
Hi All, I recently started working on a new project. One of my first tasks was to make the modules load dynamically. Basically the client would download the shell xap then when they required another module this modules xap file would be downloaded. Doing this doesn't force the user to download one massive xap file and therefore improve performance. I have this working without too much trouble however the problem I have is that once on the client I have no reference to the xap file that I have downloaded unless I hard code something. So at the moment I have solved this by creating an AvailableApplicationModule.shared.cs file which contains a list of all dynamic modules in the solution, then in the bootstrapper these are loaded into the module catalog. E.g.
public static ApplicationModuleInfo SampleModule
{
get
{
return new ApplicationModuleInfo
{
ModuleName = "SampleModule",
ModuleType = GetModuleTypeForModule("SampleModule", "SampleModuleModule"),
InitializationMode = InitializationMode.OnDemand,
Ref = "Example.UI.SampleModule.xap"
};
}
}The GetModuleTypeForModule will return the Fully qualified name like: Example.UI.SampleModule.SampleModuleModule, Example.UI.SampleModule, Version=1.1.0.0, Culture=neutral, PublicKeyToken=537c3450b3658434 Then in the client tier I can access the module catalog get the typename and then create an instance of this ModuleType which will then initialise itself. Unfortunatly by doing this I have to specify a build version. Now this is fine on a local machine as I can just override the build targets to force the version to 1.1.0.0 however once I commit this to TFS the actual build number will be used. Since I have to construct this fully qualified name in code it'll break as instead of getting 1.1.0.0 it'll be something like 1.0.15.1345. Which it won't be able to find as I need to specify the version number in code. I guess this is a common problem so I'm just looking for some adivce on how you guys handle this? Not sure if this is relevant but I'm using PRISM and Castle as the container. Thanks Phil