Package uninstall does not remove framework assemblies

Apr 7, 2011 at 7:31 AM

Hi,

I have a package that adds two MEF framework assemblies

- System.ComponentModel.Composition

- System.ComponentModel.Composition.Initialization

Now when I uninstall the package it doesnt seem to remove these dll's. However there is no other package using these dll's. Is this a desired behavior or a bug?

Regards,

Ganesh

Developer
Apr 7, 2011 at 7:58 AM
Edited Apr 7, 2011 at 7:58 AM

That's the desired behavior. We don't do any reference counting so we don't ever attempt to remove any framework assemblies (we don't want to remove what you might have been using yourself).

Apr 7, 2011 at 8:01 AM

Thanks for the prompt reply.

But wouldnt that result it in being in the xap (in which the package was installed) for no reason and increase the xap size? This results in manual intervention in doing this clean up, dont you think?

Regards,

Ganesh

Developer
Apr 7, 2011 at 8:10 AM
Edited Apr 7, 2011 at 8:11 AM

Actually I'm pretty sure the compiler doesn't add the assembly reference to the resulting assembly unless your code actually uses something from that assembly.

Apr 7, 2011 at 8:16 AM

It apparently does.

Try creating a sample package and add the above framework assemblies for sl4. Install the package in a sl app. Then uninstall the package from the app and build the sl app. Look at the contents of the xap file. The framework dll's get included.

Developer
Apr 7, 2011 at 8:28 AM

I'm not seeing all framework dlls in there. I created a default silverlight app and built it, opened the xap and looked at the assembly in reflector:

assembly references declared in the project:

  1. mscorlib
  2. system
  3. System.Core
  4. System.Net
  5. System.Windows
  6. System.Windows.Browser
  7. System.Xml

assembly references in the resulting assembly:

  1. mscorlib
  2. System
  3. System.Windows
  4. System.Windows.Browser

What are you seeing?

Apr 7, 2011 at 8:35 AM

Ah ok. The assembly is fine. I'm referring to the xap size.

Apr 7, 2011 at 8:56 AM

In fact the xap size increases to 108 KB just because the MEF dll's was referenced. Moment you remove and build it, it comes down to 4 KB. The MEF dll's were added as part of the package installation.

Developer
Apr 7, 2011 at 9:01 AM

Seems specific to Silverlight. Maybe the xap packaging needs to be smarter :D. We can look at doing some kind of reference counting eventually.

Apr 8, 2011 at 7:01 AM

Cool. Thanks.

Apr 8, 2011 at 7:02 AM

In fact we can handle this in the Install.ps1. That's how we are managing it at the moment.