I have satellite assemblies pre-built and I want to add them into the silverlight xap file after the file has been built. I know if I do this manually all I need to do is add the files into the xap (it's a zip file) and update appmanifest.xaml.
Are there any tools out there (or msbuild task) that I can call in the post build process?
you can dynamically load dll's at runtime. Have a look here: Dynamic assembly loading
Have you considered using MEF? Here's a linke where they show how to download XAP's at runtime. Silverlight TV 11: Dynamically Loading XAPs with MEF.
I hope this helps you.
BR,
TJ
Related
I am authoring a management pack with custom views using Silverlight / WPF (shared code) and MP authoring console and MP authoring tool in Visual Studio.
I am following this tutorial on custom views.
Widget for SCOM operation and web console - custom
In Section 4.1: It mentions: Add a reference to Microsoft.EnterpriseManagement.CompositionEngine and Microsoft.EnterpriseManagement.Presentation.Core assemblies. These can typically be found in the Console folder of the Operations Manager installation. Attention: the assemblies from the RTM/CU1 installation will not work! You need to download the sample project files and use the included assemblies.
I cannot add references to the Silverlight project. I get an error message:
Is there any way to get around this?
I understand that the .net runtime is different than that of Silverlight. Yet, this tutorial shows a working example, so it there a missing step or a different binary. What am I missing?
In Section 4.1: It mentions: Add a reference to Microsoft.EnterpriseManagement.CompositionEngine and Microsoft.EnterpriseManagement.Presentation.Core assemblies. These can typically be found in the Console folder of the Operations Manager installation. Attention: the assemblies from the RTM/CU1 installation will not work! You need to download the sample project files and use the included assemblies.
The important bit is the bit in bold, you need to download the sample project and copy the references from there. Were you doing this?
http://gallery.technet.microsoft.com/Creating-a-Widget-for-104711ac
If you download this zip and go to the following sub directory
\Creating a Widget for Operations Manager Dashboard - Walkthrough %231.zip\Creating a Widget for Operations Manager Dashboard - Walkthrough #1\Section_4\AlertSummarySilverlight\Bin\Debug
You'll see the two assemblies in this folder. Copying them out of the zip into another folder and add a reference to them. This works for me in Silverlight 5.
Can anybody suggest a tool to convert Silverlight xap files to Windows executables? I googled and got this this link but it does not work.
Edit: The Silverlight application has been compiled without the out-of-browser switch and I want to know if there is a solution which does not require me to open the project and recompile with out-of browser mode on.
A XAP file is just a Zip file that has a different extension. You can easily use libraries like SharpLib or DotNetZip to extract the contents of it. You can also manualy change the extension of a .xap file to .zip and then extract it in a folder. When extracted, you would get all the assemblies that were bundled as part of the .xap file.
Everything is clearly explained in the following link,
Extracting Assemblies from a XAP File
This link might be of interest:
http://www.amazedsaint.com/2010/05/how-to-create-offline-installer-no.html
It describes creating an installer that installs silverlight on machines where it is not present, as well as an Out-of-browser silverlight application and start menu links. You can use this installer on machines with no internet connection and no .net runtime installed. So it offers most of the practical benefits of converting it to an exe. I followed that procedure before and found it good.
How does Silverlight application work in browser?
E.g When I access a page having Silverlight control, how does Silverlight runtime extract data/ dlls from 'XAP' package? does it load all dlls in one go or support lazy loading of dlls?
If you're interested in some of the inner working of how the silverlight plugin and how it reads the XAP visit http://stuff.seans.com/2009/03/23/hello-silverlight-world-part-3-the-lifecycle-of-a-silverlight-control/#comment-826
He sums it up very well.
The Silverlight Runtime will extract and load all the DLLs from the Xap file before executing the entry point. Other files within the Xap will be extracted in an on demand fashion.
If you have significant "data" files in your Silverlight project and they need to be in the Xap add them as "Content" rather than as "Resource".
For larger Silverlight apps there are technologies such as MEF which allow you to divide up your app into multiple XAPs and support the dynamic loading of dlls.
Silverlight xap file is just a zip file that contains all required dll s, and files for executing. browser downloads, than extracts files and start executing using Silverlight player, which is light version of .NET engine. Of course there are technologies for lazy loading dll's too, I guess, if you need it.
I'm using MEF with my Silverlight 4 app to dynamically load xap files. To optimize this process, I've removed various assemblies from my xaps since I know they've already been loaded by the base xap. This reduces the size of my dynamically loaded xaps. I accomplished this by setting the "Copy Local" flag for each assembly reference to "false".
This all seems to work fine when I build in Visual Studio 2010 - my xaps are much smaller. However, when the same projects are built by the build server, all the excluded references are once again in the xap file hence tripling the size of the xap.
I've read several blogs/articles regarding similar experiences but no resolution. Very frustrating - any help is appreciated.
Xap files are just Zip files with a different extension. So if you can't figure out why the build server is including the assemblies you don't need, you could create a post-build step that treats the Xap as a Zip and removes those assemblies from it.
Basically i want to utilize the Silverlight Video player on Codeplex in another Silverlight application. Is this possible. Can anyone point me in the right direction on how to achieve this?
Thanks
J
If you just have a few assemblies of interest, such as those video player .dll files, then you could of course:
Rename the .xap to .zip
Extract the contents
Copy the .dll assemblies into your project
Reference the .dll's
Unfortunately, I'm guessing that you might be wanting to take advantage of the actual video player application - which includes custom handling for init parameters of the control, and just include that .Xap file into your solution. I don't know of an easy way to do that.
adding another xap file to your project, yes. you'll need to manually load the assemblies inside the xap package to utilize it.
Check the downloadable project solution here: http://www.wintellect.com/CS/blogs/jprosise/archive/2010/06/21/dynamic-localization-in-silverlight.aspx
the solution basically has two silverlight projects, the ExternalResources project's generated xap gets created and it's assemblies are manually loaded when needed.