InitializeError 2103, configuration error
Cause
Today, I tried to set the Silverlight program to App. xaml in the referenced class library. The result showed that it was not feasible and the following error occurred:
SCRIPT5022: unhandled errors in the Silverlight Application
Code 2103
Category: InitializeError
Message: The application is invalid or the format is incorrect: view the list
The so-called "program list" refers to: AppManifest. xaml. The template for this file is located in the properties folder of the project. Generally, this error occurs because Silverlight cannot find the entry point, just as C Programs cannot find the main function.
Conclusion
App. xaml can only be set as the main application, and cannot be set as a class library. To be accurate, it is not supported by VS 2010. You can only manually package XAP and put the dll that contains the App. xaml entry in the first line of <Deployment. Parts>:
The Code is as follows: |
Copy code |
<Deployment xmlns = "http://schemas.microsoft.com/client/2007/deployment" xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml" EntryPointAssembly = "SLLib" EntryPointType = "SLLib. App" RuntimeVersion = "5.0.61118.0"> <Deployment. Parts> <AssemblyPart x: Name = "SLLib" Source = "SLLib. dll"/> <AssemblyPart x: Name = "SLApp" Source = "SLApp. dll"/> </Deployment. Parts> </Deployment> |
Because Silverlight automatically finds the entry point of the First Assembly, And the xap packaged by VS sets the main application as the first by default. Manual packaging is still troublesome, so I took the initiative to bypass it, or use App. xaml under the main program!