Skip to main content

Microsoft Silverlight

Answered Question Orcas Required?RSS Feed

(0)

bryant
bryant

Star

Star

9937 points

1,629 Posts

Silverlight MVP

Orcas Required?

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

Thanks!

-- bryant

Blog | Twitter
_________________
Dont forget to click "Mark as Answer" on the post that helped you.

Scott Louvau
Scott Lo...

Member

Member

14 points

7 Posts

Re: Orcas Required?

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

This posting is provided "AS IS" with no warranties, and confers no rights.

bryant
bryant

Star

Star

9937 points

1,629 Posts

Silverlight MVP

Re: Orcas Required?

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

-- bryant

Blog | Twitter
_________________
Dont forget to click "Mark as Answer" on the post that helped you.

einarq
einarq

Member

Member

12 points

1 Posts

Answered Question

Re: Orcas Required?

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

Scott Louvau
Scott Lo...

Member

Member

14 points

7 Posts

Re: Orcas Required?

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

This posting is provided "AS IS" with no warranties, and confers no rights.

bsevo
bsevo

Member

Member

8 points

4 Posts

Re: Orcas Required?

 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. 

Blog: http://blogs.mscommunity.net/blogs/borissevo/

Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post fixed your problem.

vindicator
vindicator

Member

Member

8 points

5 Posts

Re: Orcas Required?

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

AhmedQurashi
AhmedQur...

Member

Member

2 points

1 Posts

Re: Orcas Required?

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!  

s5g
s5g

Member

Member

6 points

4 Posts

Re: Orcas Required?

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
 

haldiggs
haldiggs

Member

Member

2 points

1 Posts

Re: Orcas Required?

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

Bodom
Bodom

Member

Member

2 points

1 Posts

Re: Orcas Required?

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, 

johnyb1
johnyb1

Member

Member

2 points

1 Posts

Re: Orcas Required?

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?

jamlew
jamlew

Contributor

Contributor

2856 points

435 Posts

Microsoft

Re: Orcas Required?

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.

---------
If this post has solved your problem, please select 'Mark as answer'

- Jimmy Lewis
Microsoft SDET
Visual Web Developer Team
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities