开发者

TFS build adding an unwanted code block to xap file Microsoft.Practices.ServiceLocator

Here is a list of my references in my silverlight project.

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/>

When I build the project localy the contence of my xap file looks like the following.

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

When this is checked in and the build server kicks off it creates a xap file with the following contence.

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

As y开发者_开发问答ou can see I have gained a code block in the xap file that the application does not use. However not only is this a waste of bandwidth, it actually prevents the silverlight app from doing anything, it is downloaded but does not run.

If I remove the offending Microsoft.Practices.ServiceLocator.dll from the xap file and the manifest.xml the silvlight app then functions as intended.

Has anyone got any ideas why the build server is including this library and how to prevent it from doing so...?


I think Microsoft.Practices.ServiceLocation.dll keeps getting added as you have a reference to Microsoft.Practices.Unity.Silverlight.dll I have a feeling that they are dependent on each other. Do you need to use Unity? As to why your app fails when Microsoft.Practices.ServiceLocation.dll is included in the XAP; I have a suspicion that you may be using the wrong version of the Microsoft.Practices.Servicelocation.dll (WPF version?)


Myles really got to the crucks of the matter and I just add this for more detail of my particular problem.

The problem was that the .net version of ServiceLocator was being built into the xap on the build server.

I think the reason it was not being built in locally was because it was being resolved by the GAC.

I took copies of the Microsoft.Practices.Unity.silverlight.dll and Microsoft.Practices.ServiceLocator.dll and added them to a shared binary folder which is checked into source control to which the build server can reference. I then uninstalled Unity for Silverlight 2.0 from my installed programs (I assume this de-Gaced it). I added references to the above dlls that were now in my binary folder and built my solution locally. Hay presto I now have Microsoft.Practices.ServiceLocator.dll included in my xap file.

Once all this was checked into TFS the build now picked up the right version of Microsoft.Practices.ServiceLocator.dll from the shared binarys folder and included it in the xap. Job done. I think the cause of this problem lies in the Global Assembly Cache.

Hope this helps someone equally frustrated.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜