I'm developing Silverlight application in expression blend2 and VS2008.
For that, I need to know which type of executable file it will be generated whether .exe or some other.
Silverlight was meant to be run through a web browser.
When building SL applications, the result will be a .xap file.
The .xap file is really a zip file, and includes AppManifest.xaml, compiled output assembly of the Silverlight project (.dll) and any other resource files referred by the Silverlight application.
Related
I develop a Silverlight application and I renamed the extension from XAP to ZIP. With WinZip I can view all my files and folders of the Silverlight application.
I have no experience with Windows Phone development so, recently I try to do the same with a Windows Phone XAP file and renamed it to ZIP.
When I try do open with WinZip I get the message:
"Cannot open file 'xxxx.zip'. It does not appear to be a valid archive"
I try the same with WinRAR, 7Zip, PeaZIP and I can't still open the file.
My question is:
Are Silverlight XAPs and Windows Phone XAPs different things?
Thank you
I don't know the if and what the differences might be but I do know that you can open Windows Phone XAP files using those programs (at least WinRAR). You can verify this by creating a WP project in Visual Studio, build the project and then go to the /bin/release or /bin/debug directory and open the XAP file with WinRAR for example. I just did this with a Windows Phone 8 app built using Visual Studio 2012.
BUT you can only do that to XAP files which are NOT signed. This is because when the XAP file is uploaded to the store they are signed to protect them and guarantee that no-one has tampered with the code. The XAP files are automatically signed when uploaded to the store (see submission step 4 here: http://msdn.microsoft.com/en-us/library/windowsphone/help/jj206729(v=vs.105).aspx).
More about signing of XAP files for LightSwitch can be found here, but I would guess it works in a similair way for Windows Phone XAP files.
The spec, how they work, and layout is the same. However the binary executables in them are different and compiled for the specific platform.
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.
There's just so many files. The XAP file, DLL file, HTML file, PDB File, and then I have all these folders with 2 letter words where inside each folders are 2 dll files.
What do these files (in general) represent?
Thanks
The XAP file represents the Silverlight application (Silverlight Application Package, the X likely refers to the XAML base of Silverlight).
DLL files are your application's dependencies, some of which are created to facilitate serialization and localization.
Because Silverlight is browser-hosted, it requires an HTML page to host the control when you debug it.
The PDB file contains the "program database" which includes all the metadata Visual Studio uses to provide those nice descriptive tooltips when you mouse over a variable in the IDE.
Folders with two letters represent country codes and are used for localization.
I am working with Silverlight 4.0 and Windows Application Composite Framework (Prism).
I have created couple of modules which are Silverlight libraries so they are compiled into dlls and not xaps.
I want to register these modules into my Shell application using ModuleCatalog.xaml. If I package my modules into .xap then this approach works fine but since my modules are .dll, I am getting exception during load.
So my question is, will be possible to register silverlight module dll in ModuleCatalog.xaml?
This is not possible because Silverlight packages assemblies in .xap packages. Thus, if an assembly is not in the main .xap (the one of the Shell), Prism must know how to download the .xap file where it's located at to be able to download and load modules correctly.
Imagine that, if the application downloaded the module's from a server, downloading the .xap package and loading an assembly in the application is possible and easy in Silverlight, while doing it directly with a .dll is not.
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.