I have a common silverlight project. This project project, among other things, includes constants and static classes.
The silverlight App i have references this common library.
In addition, i have a handful of external modules that are loaded on-demand (via Prism). Each module is its own .Xap file and they too reference the common library.
So now each Xap in my silverlight application has a reference to the Common.dll.
Does this mean the common.dll is loaded every time a xap is loaded, or does it essentially mean only the main App's common.dll is ever loaded?
The ultimate question im getting at is this:
If i make a code change (bug fix) in the common.dll, do i have to release ALL Xap files or just the main App xap?
Thanks.
If you use Assembly Caching in all projects that reference the common dll then you'll just get one copy downloaded as it's own zip file. This way all the different XAP files will reference the same dll. Otherwise common.dll will be included in each XAP file that references.
You'll need to create a common.extmap.xml file for your common.dll which needs to be in the same folder from where the dll is referenced.
By default DLLs are loaded on demand. This means that you can't really guarantee which directory they will load from. This is a common issue among modular applications and one that there isn't a ready prescription for. It depends on requirements, essentially.
Some things you can do:
GAC the Common.dll in the target environment. This will allow you to control the versioning of that DLL centrally.
Release everything every time Common.dll changes (as you mentioned).
We have opted for number 2 (we treat our "Common.dll" as a contract assembly that changes rarely) in order to keep our xcopy deployments intact.
Number 1 might make more sense if you anticipate that code churn on Common.dll will be high or you want to keep your deployment schedules for modules completely autonomous (like if the modules were being developed and deployed by seperate teams with seperate build and source respositories, for example).
Edit: It looks like Silverlight has something to provide an xcopy variant of the GAC approach. ChrisF's answer is probably the way I would go with Silverlight (we do WPF, so that's a bit different). I'll leave this here for posterity.
Related
I am using VS2008 to publish my application files using ClickOnce. I read somewhere that ClickOnce intelligently does only partial updates; meaning it only downloads files from the network share if the file has changed in subsequent updates. However, this wasn't working for me. So I did some research and stumbled upon this MSDN article - http://msdn.microsoft.com/en-us/library/ms404267.aspx. It says that if we build using VS, it doesn't perform the partial updates. Can anyone tell me why this is the case? If so, is there a way to atleast let the referenced dlls to be downloaded only for the first time. I am using Microsoft Practices Enterprise Library and some 3rd party controls (with huge Theme files).
Thanks,
Uniball
Partial updates work fine in ClickOnce even when building in VS. However, if you have a solution made up of a few projects (eg a couple of class library projects and an executable) then any time you rebuild all the projects the timestamp on the assembly files will change, even if the code hasn't. Since ClickOnce really only looks at the timestamps to decide whether a file needs updating, it'll pull down the (unchanged) assemblies as new files when the user updates.
The workaround is to pull any dependent projects out of your executable's solution file and build them separately. That means that any assemblies whose code doesn't change very often will only get pulled down to the client once. If you need to change the assembly, you simply open its solution and make the change, then reopen your executable's solution and rebuild that. The next ClickOnce update will pull down both the exe and the changed assembly.
Hope that's clear enough!
I'm using MEF in silverlight to dynamically load some plugins from a secondary xap file. This secondary XAP file is built from a project that references various plugin projects, all of which are built against dlls that are already in the primary xap file.
As such, I want pretty explicit control over which dlls end up in this secondary xap. Including any dlls from the main xap file is redundant (and also causes issues with MEF recomposition). But Visual Studio seems to insist on including various dependent dlls even when the CopyLocal property is only set to True for the references to the plugin projects.
So far the only thing I've found that works is to add explicit references to probelmatic always-included dlls in the top-level project that builds the secondary xap, and set CopyLocal to False in the reference properties. But this is brittle as the dependencies change.
Am I thinking about this wrong? Should I just be building a separate xap for each plugin dll (in which case setting CopyLocal to false for all references seems to work)?
As well as setting Application Library Caching on your Silverlight project by selecting the "Reduce XAP size by using application library caching" option in your project settings (source) you need to have an extmap.xml file in the same location as your shared dll.
So if your dll was Microsoft.Expression.Effects.dll then you'd need to create (or copy) Microsoft.Expression.Effects.extmap.xml.
It looks like this:
<?xml version="1.0"?>
<manifest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<assembly>
<name>Microsoft.Expression.Effects</name>
<version>2.0.20525.0</version>
<publickeytoken>31bf3856ad364e35</publickeytoken>
<relpath>Microsoft.Expression.Effects.dll</relpath>
<extension downloadUri="Microsoft.Expression.Effects.zip" />
</assembly>
</manifest>
The version number should match the version number of the dll.
If you don't have the public key token you can replace that with null.
This will copy the dll to a separate zip file which can be then shared by several xap files or only downloaded once if it's not going to change when you xap file changes.
Take a look here: http://msdn.microsoft.com/en-us/library/dd833069(VS.95).aspx
Specifically, look at the section entitled "To configure an assembly for use with application library caching". It describes a method for doing something that's at least pretty close to what you're looking for.
I woulld like to localize my WPF application with resource files. It good technics. But I have requirement to give ability to end user to change some localization information (for example some word traslation). It means change information in the resourse files on the fly (in run time). Is it possible ?
This would involve recompiling the resources on the fly; and reloading them will be quite difficult (as DLLs cannot be unloaded without unloading an AppDomain).
In such a configuration, you're better off using the database to store your translations.
The home page for DotNetNuke 5.2 is around 252.6KB. It uses 15 JavaScripts and 8 CSS files. The number of resources DotNetNuke uses seems excessive to me. I am looking for best practices creating DotNetNuke skins that limit the JavaScript and CSS resources.
You can use the Unload CSS Skin Object to remove links to some of the CSS files loaded by the framework (like Default.css, portal.css & any module-specific CSS files). You can then move all of those styles into the skin (or portal stylesheet, whichever is your preference), so that there's only one stylesheet that gets loaded.
I don't know of any solutions for combining JavaScript resources or reducing the number of scripts that DNN requires.
From 6.1 onward, the Client Resource Management component is the solution for this. It automatically combines all your files, cleaning them up, removing comments, and minifying if desired.
http://www.dotnetnuke.com/Resources/Wiki/Page/Client-Resource-Management-API.aspx
It takes a little getting used to, but the control is quite nice. You can decide which order they'll go in, you can group the files in bunches if you don't want one big single file - maybe you want certain bunches of scripts together but not all.
One thing to remember is that when you're doing development (as noted by the comment below, which I've since edited this post), you should always use debug=true in the web.config, otherwise if you are using Resource Mgmt and change your source files, you'll constantly need to regenerate the combined files by going into Site Settings, Client Resource Management, and increment the version. It's kind of a protection to keep anything from altering your clients' browser caches without intent (that's the message box that pops up to let you know when you do it). I'm sure if you have a zillion users this might make a difference.
Part of that is just the dynamic nature of DNN - there are some good resources that R2i has published about combining javascript and CSS
One concrete suggestion is to combine all your skin and contianer css in one file and if you have full control of the site to combine the css from the modules you use into that same file.
I know with the addition of the Telerik controls there is some abilities to combine resource files
Another thing that helps is to combine graphics into a single file and use CSS (the sprite technique) to cut down number of files loaded and calls to the sever
Like it was stated above, it's the nature of the beast. Each module will have at least 1 css file included. You can check out PageBlaster from snapsis.com, I believe it will do what you are looking for.
I am new to both WPF and WCF, and have a WPF app that has a service reference to a WCF one. I have all sorts of files created under Service References/MyService. I am not so sure which need to go into source control and which don't.
I have a .disco, a .datasource, a .wsdl, 3 .xsds, 2 configuration.svcinfos, a Reference.cs,
and a Reference.svcmap.
I assume most are generated, yet I don't know which belong to source control and which do not.
Put all of them under source control, why not?
It's part of your code and it's needed to compile the project. If you use an automated build system, then you don't want that script to generate this code again, right?
As a bonus you'll get a history of changes to your service interface, could be useful too.
All of those files are source files, so they all belong under source control.
How about adding all of them to the source control in the first instance and then remove those that never change later?