Assembly reference in Silverlight class library and used only in xaml is not packaged in XAP
I have a 3rd party library (A). That library is referenced in my Silverlight class library (B). That Silverlight class library is referenced in my Silverlight application (C). The 3rd party library is not explicitly referenced in the Silverlight application.
It seems that "A" is added to my XAP if "A" is used in any class in "B" because of a chain in dependencies (C -> B -> A). This is the behavior I would expect and need.
If "A" is never explicitly used in a C# class but only defined in Xaml, the assembly is not packaged to the XAP. Maybe "A" includes a control that is only used declaratively and never referenced otherwise.
Is this behavior by design? Am I missing a property somewhere that controls this? I would prefer to not explicitly refer开发者_开发问答ence the third party library in my Silverlight application. What's to best practice to ensure all necessary assemblies are packaged in the XAP?
If you want to include a file in your XAP that isn't explicitly referenced, all you do is this:
In Visual Studio/Solution Explorer 1. Right click the project that contains your website/service 2. "Add Existing" and point to the dll you want 3. Once it is in the project, Right click and open up the properties of the file 4. Set Build action to "Content" 5. Set "Copy to Output Directory" to "Copy Always"
This should include the file in your XAP
精彩评论