Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

Hosting silverlight 2.0 without .dll file RSS

1 reply

Last post Nov 18, 2008 10:17 AM by ken tucker

(0)
  • henriindonsilverlight

    henriindonsi...

    Member

    1 Points

    1 Post

    Hosting silverlight 2.0 without .dll file

    Nov 18, 2008 08:50 AM | LINK

    Hi,

     

    I try to host a simple silverlight 2.0 application without bin folder.

    I just wonder if it's possible to be done. I've remove away the <%@ Register %> in my aspx page and i add in the following on my <assemblies> and <pages>

    <add assembly="System.Web.Silverlight, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    <add tagPrefix="asp" namespace="System.Web.UI.SilverlightControls" assembly="System.Web.Silverlight, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

      It works fine with the bin folder but when it was removed it throws:

    Could not load file or assembly 'System.Web.Silverlight, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

     I have Silverlight 2.0 SDK and 3.5 .Net installed. So is there any way to deploy it without copying the dll? because the web hosting doesn't allow us to copy "dll" files over.

     Thanks in advance

  • Ken Tucker

    Ken Tucker

    All-Star

    23250 Points

    3534 Posts

    Re: Hosting silverlight 2.0 without .dll file

    Nov 18, 2008 10:17 AM | LINK

    You could always use an object tag and javascript to create the silverlight app on your webpage if the silverlight control is not available

     

     

        <script type="text/javascript" src="Silverlight.js"></script>
        <script type="text/javascript">
            function onSilverlightError(sender, args) {
            
                var appSource = "";
                if (sender != null && sender != 0) {
                    appSource = sender.getHost().Source;
                } 
                var errorType = args.ErrorType;
                var iErrorCode = args.ErrorCode;
                
                var errMsg = "Unhandled Error in Silverlight 2 Application " +  appSource + "\n" ;
    
                errMsg += "Code: "+ iErrorCode + "    \n";
                errMsg += "Category: " + errorType + "       \n";
                errMsg += "Message: " + args.ErrorMessage + "     \n";
    
                if (errorType == "ParserError")
                {
                    errMsg += "File: " + args.xamlFile + "     \n";
                    errMsg += "Line: " + args.lineNumber + "     \n";
                    errMsg += "Position: " + args.charPosition + "     \n";
                }
                else if (errorType == "RuntimeError")
                {           
                    if (args.lineNumber != 0)
                    {
                        errMsg += "Line: " + args.lineNumber + "     \n";
                        errMsg += "Position: " +  args.charPosition + "     \n";
                    }
                    errMsg += "MethodName: " + args.methodName + "     \n";
                }
    
                throw new Error(errMsg);
            }
        </script>
    </head>
    
    <body>
        <!-- Runtime errors from Silverlight will be displayed here.
    	This will contain debugging information and should be removed or hidden when debugging is completed -->
    	<div id='errorLocation' style="font-size: small;color: Gray;"></div>
    
        <div id="silverlightControlHost">
    		<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
    			<param name="source" value="ClientBin/SilverlightMD.xap"/>
    			<param name="onerror" value="onSilverlightError" />
    			<param name="background" value="white" />
    			<param name="minRuntimeVersion" value="2.0.31005.0" />
    			<param name="autoUpgrade" value="true" />
    			<a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">
         			<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>
    			</a>
    		</object>
    		<iframe style='visibility:hidden;height:0;width:0;border:0px'></iframe>
        </div>
    </body>