Dhiraj's Blogs Born to code

24Dec/101

Silverlight unhandled error application code 2105

Most of time when we create Silverlight project and use published code to deploy it on server and land up with this error

Error: Unhandled Error in Silverlight 2 application
Code: 2105

The point is that when ever you create a Silverlight application with visual studio, it creates XAP package in "ClientBin" folder. You can either rename the .XAP to .ZIP and unzip the file to look at AppManifest.xaml OR if you have code with you then just access to source code and directly open "AppManifest.xaml" file from bin/ folder.

And make sure these entries are correct

<Deployment
    EntryPointAssembly=”SilverlightApplication1”
    EntryPointType=”SilverlightApplication1.App”
    <!--this should be same as your “Namespace.Application” class-->
    RuntimeVersion=”2.0.31005.0″>
    <Deployment.Parts>
    <AssemblyPart x:Name=”SilverlightApplication1″ Source=”SilverlightApplication1.dll” (make sure that, this is the output dll you have in your project configuration)/>
    </Deployment.Parts>
</Deployment>

By default, app.xaml will contain the application class as "App", but over here I have changed it to my control or my page ("MyClass") as shown below. In same ways if you guys are using visual studio and you have renamed your project or App class then make sure that you also make the corresponding changes in Project Configuration (like assembly name, startup project, etc.).

public class MyControl: Application
{
    public App()
    {
        this.RootVisual = new Page();
    }
}

Other alternative

Most simple thing that one can do is re-build your entire project or solution and use that .XAP package for deployment.