【发布时间】:2011-09-23 11:13:36
【问题描述】:
这是我在 silverlight 项目中的参考列表。
Microsoft.Practices.Unity.Silverlight<br/>
mscorelib<br/>
Prospector.ProviderMatching.LinkedDataObjects<br/>
Prospector.ProviderMatching.SLDataObjects<br/>
System<br/>
System.ComponentModel.DataAnnotations<br/>
System.Core<br/>
System.Net<br/>
System.ServiceModel<br/>
System.Windows<br/>
System.Windows.Browser<br/>
System.Windows.Controls<br/>
System.Windows.Controls.Data.Input<br/>
System.Windows.Controls.Toolkit<br/>
System.Windows.Data<br/>
System.Xml<br/>
当我在本地构建项目时,我的 xap 文件的内容如下所示。
AppManifest.xaml
Microsoft.Practices.Unity.Silverlight.dll
Prospector.ProviderMatching.DataObjects.SL.dll
Prospector.ProviderMatching.Silverlight.dll
Prospector.ProviderMatching.SLDataObjects.dll
ServiceReferences.ClientConfig
System.ComponentModel.DataAnnotations.dll
System.Windows.Controls.Data.dll
System.Windows.Controls.Data.Input.dll
System.Windows.Controls.dll
System.Windows.Controls.Toolkit.dll
System.Windows.Controls.Toolkit.Internals.dll
System.Windows.Data.dll
当这被签入并且构建服务器启动时,它会创建一个包含以下内容的 xap 文件。
AppManifest.xaml
Microsoft.Practices.ServiceLocation.dll
Microsoft.Practices.Unity.Silverlight.dll
Prospector.ProviderMatching.DataObjects.SL.dll
Prospector.ProviderMatching.Silverlight.dll
Prospector.ProviderMatching.SLDataObjects.dll
ServiceReferences.ClientConfig
System.ComponentModel.DataAnnotations.dll
System.Windows.Controls.Data.dll
System.Windows.Controls.Data.Input.dll
System.Windows.Controls.dll
System.Windows.Controls.Toolkit.dll
System.Windows.Controls.Toolkit.Internals.dll
System.Windows.Data.dll
如您所见,我在 xap 文件中获得了应用程序不使用的代码块。然而,这不仅浪费带宽,而且实际上阻止了 silverlight 应用程序做任何事情,它被下载但没有运行。
如果我从 xap 文件和 manifest.xml 中删除有问题的 Microsoft.Practices.ServiceLocator.dll,silvlight 应用程序就会按预期运行。
有没有人知道为什么构建服务器包含这个库以及如何防止它这样做......?
【问题讨论】:
-
只是一个想法...您在使用 Prism 吗?您是否检查过您没有使用错误的程序集(可能是 WPF 程序集?)
-
我认为 Microsoft.Practices.ServiceLocation.dll 不断被添加,因为您引用了 Microsoft.Practices.Unity.Silverlight.dll 我感觉它们相互依赖。你在使用 Unity 吗?
标签: visual-studio-2010 silverlight-4.0 msbuild unity-container