none
Orcas Required?

    Question

  • Is there a way to build the .NET dlls for Silverlight without VS Orcas?

    Thanks!

    Monday, April 30, 2007 6:30 PM

Answers

  • I am trying to get this example to work, but I get the following error message:

    Silverlight error message
    ErrorCode: 2252
    ErrorType: ParserError
    Message: AG_E_RUNTIME_MANAGED_ASSEMBLY_DOWNLAOD
    XamlFile: Page.xaml
    Line: 7
    Position: 9

    Probably related to the client not being allowed to download the HelloSilverlight.dll. Any idea how this should be set up?

    Einar

    Monday, May 07, 2007 7:00 AM

All replies

  • Well, in VS2005 you can create a class library which will build against the Silverlight runtime, but it's a little work.

    1. Create a Class Library.
    2. Remove all references from it.
    3. Right-click on the Project and pick Properties.
    4. On the Build tab, click Advanced and check 'Do not reference mscorlib.dll'
    5. Manually add references to mscorlib, agclr, System, System.Core, System.Silverlight, and System.Xml.Core from the Silverlight install folder (\Program Files\Microsoft Silverlight\)

    At this point your build outputs should be Silverlight consumable binaries. It looks like the equivalent command line call to csc.exe (the C# compiler) should include the references to the mentioned binaries and the /nostdlib option but may require others as well.

     -Scott

    Tuesday, May 01, 2007 7:18 PM
  • Thanks Scott!

    It works great. I uploaded my sample project if anyone wants to try this out.

    http://blogs.sqlxml.org/bryantlikes/archive/2007/05/02/silverlight-hello-world-in-c-from-vs-2005.aspx

    Wednesday, May 02, 2007 10:46 AM
  • I am trying to get this example to work, but I get the following error message:

    Silverlight error message
    ErrorCode: 2252
    ErrorType: ParserError
    Message: AG_E_RUNTIME_MANAGED_ASSEMBLY_DOWNLAOD
    XamlFile: Page.xaml
    Line: 7
    Position: 9

    Probably related to the client not being allowed to download the HelloSilverlight.dll. Any idea how this should be set up?

    Einar

    Monday, May 07, 2007 7:00 AM
  • That's a common error message whenever the Silverlight runtime can't get to the assembly. Usually either IIS isn't serving the DLL to browsers or the path in the Xaml file to the assembly is not the right path relative to the HTML page or Web Form consuming the Silverlight content.

    Issue 1: IIS not serving the DLL to browsers.
    The easiest way to check this is to manually give the browse the URL to the DLL itself and see if you get the Open/Save dialog from IE. If you do, the assembly is being served correctly. If you don't, IIS isn't configured to serve the assembly. For us, this usually happened for Virtual Directories which were configured with 'Execute Permissions' set to 'Scripts and Executables'. Run the inetmgr tool, right-click on your Virtual Directory, and look at the value for Execute Permissions on the Directory tab. It should be 'Scripts Only' so that IIS tries to serve the assembly as a file rather than looking for an entry point to execute it.

    Issue 2: Assembly path isn't relative to the web page consuming the Silverlight content
    Currently the Xaml files need a path to the assembly (like ClientBin/SilverlightProject1.dll) and while the path is in the Xaml file, it's evaluated relative to the HTML page or Web Form using the Xaml. So, if your Web Form is http://myserver/mysite/TestPage.html and your Xaml file says to look for ClientBin/SilverlightProject1.dll, the runtime will look at http://myserver/mysite/ClientBin/SilverlightProject1.dll. Make sure the Xaml file and consuming page are in the same folder, or modify the path in the Xaml file so that it's relative to where the consuming web page will really be located. We're working on a better solution to this problem so that the Xaml file doesn't need to know about the consuming page, but for now the easiest solution is to put them in the same location.

    Hopefully it's one of these two issues. =)
    -Scott

    Monday, May 07, 2007 1:44 PM
  •  Thank you Scott!
     

    In my Page.xaml file I changed the assembly=silverlight1.dll to assemby=bin/Debug/silverlight1.dll and finally everything started to work. 

    Monday, May 07, 2007 5:38 PM
  • What about using the Express editions or command line compilation via vbc or csc? I hadn't found the option to "not reference mscorlib.dll" in Express.

    I tried using vbc with /nostdlib, but will err because, in the .vb, I reference controls in the xaml such as Me.ControlName.Text="Something". I'm assuming I'm missing a dependency deal because in the .vbproj, I'll see the tags DependsUpon and can't find the related syntax for vbc.
    On the opposite end of it, I don't know what tags, in the .vbproj, would be the equivalent to /nostdlib.

    I'd prefer to find the equivalent /nostdlib tag so I can do my work in VB Express for the use of intellisense.

    Nathan

    Wednesday, May 09, 2007 1:53 PM
  • Also another issue that will raise the parse error is the location of the compiled Class Library *.dll file.

    The Silverlight 1.1 runtime requires the dll to be downloaded to the client. Some web server configurations won't allow dll's to be downloaded from the standard Bin or Cgi-bin folders which is where one typically sticks compiled dll libraries. The easiest way is to just place it alongside your other xaml assets while keeping in mind the above caveat of remembering the path is relative to the page calling the xaml object.

    Otherwise, it works swimmingly!  

    Wednesday, May 16, 2007 7:12 PM
  • I found another situation where the ClientBin path gets messed up. Create a project with a name of the form A-B, the namespace

    becomes A_B, the xaml file has assembly=ClientBin/A_B.dll, but the dll is built as ClientBin/A-B.dll

    - Simon
     

    Friday, June 08, 2007 11:24 AM
  • hey Bryant, I think I have it all together but I keep getting "Predefined type 'System.Object' is not defined or imported" did you get this error, if so how'd you get around it?Stick out tongue

    Monday, August 27, 2007 6:46 PM
  • hi, I got this error mess after setting up IIS to allow DLL downloaded. I need your help Smile

     ErrorCode: 2211

     ErrorType: ParseError

     Message: AG_E_RUNTIME_HTTP_ACCESS_RESTRICTED

     

    Thanks, 

    Friday, September 28, 2007 4:41 AM
  • Does this work for Beta 2 of Silverlight? I know the files are slightly different (references). Can you provide same solution for VS 2005, but with Silverlight 2 Beta files?

    Friday, August 15, 2008 4:24 PM
  • Unfortunately, this doesn't work for Silverlight 2 beta 2.  The Silverlight Tools package now depends on various changes that were made during Orcas, so porting everything to VS2005 is simply not feasible.  We will, however, be providing support for VWD Express in a few months.

    Monday, August 18, 2008 12:41 PM