Click here to Skip to main content
15,898,222 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Suppose if a XAP contains 5 dlls. We can load one dll's StreamResourceInfo into a assembly like below.

VB
Dim appManifest As String = New System.IO.StreamReader(Application.GetResourceStream(
              New System.Windows.Resources.StreamResourceInfo(e.Result, Nothing),
              New Uri("AppManifest.xaml", UriKind.Relative)).Stream).ReadToEnd()
Dim doc As XDocument = XDocument.Parse(appManifest)
Dim nspace As XNamespace = doc.Root.Name.Namespace

// parts contains 5 dlls.
Dim parts As List(Of XElement) = (From assemblyParts In doc.Descendants(nspace + "AssemblyPart") Select assemblyParts).ToList()
Dim asm As System.Reflection.Assembly = Nothing

For Each xe As XElement In parts
    Dim source As String = xe.Attribute("Source").Value
    Dim asmPart As New AssemblyPart()
    Dim streamInfo As StreamResourceInfo = Application.GetResourceStream(
                 New StreamResourceInfo(e.Result, "application/binary"),
                 New Uri(source, UriKind.Relative))

    If source = "WebPortalUI.dll" Then
        asm = asmPart.Load(streamInfo.Stream)
    Else
        asmPart.Load(streamInfo.Stream)
    End If
Next


I want to load two dlls StreamResourceInfo of a XAP file into a assembly. How can I do this?
Posted
Updated 24-May-11 1:40am
v2

1 solution

You could create a single assembly with all of the resources in it, and load that one assembly whenever you need it in the other assemblies. That's the way I'd do it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900