Where on the client side will all the XAP files will be downloaded to and used by the Silverlight runtime?
The are downloaded to a temp internet folder (like other internet content). You should not need to know/care as all access is via relative path or assembly references.
Related
When the Silverlight application is loaded , I expect that Xap file should be in Temporary Internet Files, but can not find it, how can I make sure that my default path and do I have any setting to change this path and is it possible to run silverlight application without Xap file. I mean the Framework loads the Xap file in memory and stores the Xap file in Temporary Internet Files for future use ?
For in-browser applications the plugin relies on the browser's cache ("temporary internet files" in the case of internet explorer). For out-of-browser applications the xap will be stored in a file called application.xap in .../AppData/Local/Microsoft/Silverlight/OutOfBrowser/. or similar.
I'm not sure why you couldn't find it in IE's cache. I clearly see xaps cached in Chrome which is what I mostly use.
We use the .NET resource manager to localize our Silverlight application and want to embed the satellite assemblies for the german language ("de") into the XAP file. Therefor, we set the neutral language to "en" and added "de" to the list of supported languages in the csproj file. This works fine, when we build the project locally. If we build the Silverlight solution with MSBuild (TFS), Silverlight will try to fetch the satellite assemblies with HTTP requests from /ClientBin/de/*.dll instead of taking those files embeded into the XAP (which do exist). Because the webserver returns 404 error codes for the non existent files, Silverlight crashes with an initialization error.
It turned out that if we remove a custom TFS build activity manipulating the assembly info code files, the Silverlight applications works as expected. Strangely, after re-enabling the activity the compiled XAP application still works (verified for two different build definitions working on seperate branches). The custom activity manipulates the assembly attributes AssemblyConfiguration, AssemblyCompany, AssemblyProduct, AssemblyCopyright, AssemblyTrademark, AssemblyVersion, and AssemblyFileVersion.
Some additional hints:
The custom activity will change the assembly info files before any compilation is done
Compiling the manipulated sources with Visual Studio will build a working XAP
The content of the XAP files (working and not working) is equal (nearly same sizes, no difference in manifest file)
The resource manager is instantiated using ResourceManager("Resource", Assembly.GetExecutingAssembly())
My questions are:
Why does Silverlight try to fetch those satellite assemblies from /ClientBin/de/ instead of just using those in the XAP file?
What kind of attribute in the assembly info file could cause such a behavior?
Why does re-enabling the versioning activity not break the XAP again?
And here's the solution: We use a tool named "Total Commander" for editing a file in the generated XAP to adjust the URL the (generic) client connects to. Since we added the localization dlls, editing the XAP with the Total Commander will lead to the behavior described above. If we manipulate the XAP with WinRAR or the internal Windows archive manager, all works as expected.
Edit: After comparing the XAP files we found, that Total Commander uses the backslash (\) to seperate directories, whereas WinRAR and the Silverlight Tools use slashes (/). It seems that we discovered a hidden Silverlight feature here ;-)
Is it possible to store resx files and access them from the application package without changing any code?
EDIT: I don't want to embed them into the assembly. The resource files should be able to be modified without compiling the project so I tought storing them in XAP and replace when needed.
Thanks.
It is possible to include any file in a XAP by specifying that its build action to be Content.
However I'm not sure that is useful to you in the way you are hoping. Silverlight can only utalise a resx file in the intended manner if it is embedded in a dll.
Instead of using .resx files consider using ResourceDictionary .xaml files.
a XAP file is encrypted. you could load resources into isolated storage and access them in a similar way to a resource.
I am developing some application project in Silverlight using deep zoom.I copy my images under ClientBin/Source .However I notice that the associated .xap file is formed only once? I change the code and re-run but still see that there is no modification in the .xap file.Why does this happen?
Copying files to the ClientBin folder is a modification to the associated web project not to the silverlight project. The MSBuild code detects that none of the files that make up the content of the XAP file has changed and hence doesn't bother to rebuild something which would turn out have exactly the same as the last build.
I've used the "Reduce XAP size by using Application library caching" setting. I see that some dlls are now excluded from the .xap file but some aren't, specifically
System.Reactive.dll
System.Windows.Controls.DataVisualization.Toolkit.dll
System.Windows.Controls.Theming.Toolkit.dll
System.Windows.Controls.Toolkit.dll
Any idea why this is the case?
thanks
The "Reduce XAP size" feature only leaves DLLs out of the XAP where there's a .extmap file next to the DLL (for examples, you can look at any of the SDK assemblies under \Program Files (x86)\Microsoft SDKs\Silverlight\vX.0\Libraries\Client and their respective extmap files). The assemblies that are still being included probably are either missing the extmap file, or it's somehow improperly defined.
What version of the toolkit are you using?
In VS open the References folder and select one of these dlls. Then look at the Path value in the properties of that reference. Open the folder that contains the dll.
Present in that folder should be a matching *.extmap.xml. This file is used in creating the external zip file for the dll. If this file isn't present then regardless of the "Reduce XAP size by using Application library caching" setting the dll will still be included in the XAP.
The latest versions of the Toolkit (Nov09 for SL3 and Apr10 for SL4) both include a set of these extmap.xml files. However if you have the practice of copying such library files into your project (commonly people use "Libs" sub-folder under the project) then you may not have copied these files.