Programming with .NET - Generalhttp://forums.silverlight.net//17.aspx/1?Programming+with+NET+GeneralGeneral discussions around authoring Silverlight .NET applications.Mon, 01 Jan 0001 00:00:00 -05001713304http://forums.silverlight.net//p/4495/13304.aspx/1?Silverlight+project+quot+add+reference+quot+Silverlight project &quot;add reference&quot; <p>Hello:</p> <p>&nbsp;I was trying to add a reference to my non-silverlight Class Library and the VS 2008 IDE told me &quot;You can only add project references to other Silverlight projects in the solution&quot;.&nbsp; Essentially I want to use some of my business objects in the silverlight project I created, but don't really see a way to do this?&nbsp; Does this mean that you can never use any regular class libraries in your silverlight project?&nbsp; Is this because of the sandbox it runs in?&nbsp; What are some ways to get around this?&nbsp; Do you have to copy all of the code from your class library to your silverlight class library?&nbsp; That seems pretty ridiculous.&nbsp; If anything the sandbox should do reference checking to make sure that everything will run safely in the sandbox.&nbsp; My BusObjects are just container objects, so they don't open any database connections and are really just used to hold data.&nbsp;</p> <p>My overall goal was to add this reference and use svcutil.exe to create my proxy class with references to my BusObject class library, so when I make my service calls, the proxy lets me return my real business objects, rather than proxy generated ones.&nbsp; This all ties into how well silverlight will utilize the WCF I guess and I haven't really seen anyone discussing this yet.&nbsp;</p> <p>&nbsp;This is one of the things that will make silverlight a really handy tool to port over existing data systems to rich GUIs on the web.&nbsp; Any thoughts?<br> <br> &nbsp;</p> 2007-09-07T03:32:15-04:0013305http://forums.silverlight.net//p/4495/13305.aspx/1?Re+Silverlight+project+quot+add+reference+quot+Re: Silverlight project &quot;add reference&quot; <p>I guess I should clarify that I am using VS 2008 Beta2 with silverlight 1.1 alpha refresh so everything should be the latest &amp; greatest..</p> <p>&nbsp;If nobody has any direct answers to that, my follow up question would be how much does MS plan on supporting WCF in Silverlight?<br> &nbsp;</p> 2007-09-07T03:37:28-04:0013672http://forums.silverlight.net//p/4495/13672.aspx/1?Re+Re+Silverlight+project+amp+quot+add+reference+amp+quot+Re: Re: Silverlight project &amp;quot;add reference&amp;quot; <p>I'm looking for a way as well to share a Class Library with both a Silverlight project as well as a Windows Forms application. I tried creating a Silverlight class library, because I thought that,&nbsp;since Silverlight uses a subset of the full .NET framework, a Windows Forms application should be able to use this Silverlight Class Library. But that doesn't quite work.<br> <br> I guess we could share the C# source files between the Silverlight project and the Full .NET project using the Link to file option when adding a C# file to the project...</p> <p>&nbsp;</p> 2007-09-10T19:44:49-04:0013677http://forums.silverlight.net//p/4495/13677.aspx/1?Re+Re+Re+Silverlight+project+amp+amp+quot+add+reference+amp+amp+quot+Re: Re: Re: Silverlight project &amp;amp;quot;add reference&amp;amp;quot; <p>Yep that works. It's not as neat as sharing a class library, but at least we don't have to copy the C# source from one project to another.</p> 2007-09-10T19:51:29-04:0014215http://forums.silverlight.net//p/4495/14215.aspx/1?Re+Re+Re+Silverlight+project+amp+amp+quot+add+reference+amp+amp+quot+Re: Re: Re: Silverlight project &amp;amp;quot;add reference&amp;amp;quot; <p>You can't share assemblies between silverlight and the desktop clr as they are subtley different runtimes. Even if you use intrinsic types such as string, that is actually a binding to the system.string class in the respective runtime. Due to the string typing of .net, it doesn't like trying to use one in the other.</p> <p>Your solution of having 2 projects and sharing source between them is probably the cleanest.</p> <p>The goal is to move from the hacked up json stack and support WCF as the web references stack for silverlight.</p> 2007-09-14T18:12:21-04:0016112http://forums.silverlight.net//p/4495/16112.aspx/1?Re+Re+Silverlight+project+amp+quot+add+reference+amp+quot+Re: Re: Silverlight project &amp;quot;add reference&amp;quot; <p>I am trying to do the same (add a C# class library reference to a silverlight project) where can I find this Link to File option?&nbsp;</p> <p></p> <blockquote><span class="icon-blockquote"></span> <h4>dsdsico</h4> <p></p> <p>I'm looking for a way as well to share a Class Library with both a Silverlight project as well as a Windows Forms application. I tried creating a Silverlight class library, because I thought that,&nbsp;since Silverlight uses a subset of the full .NET framework, a Windows Forms application should be able to use this Silverlight Class Library. But that doesn't quite work.<br> <br> I guess we could share the C# source files between the Silverlight project and the Full .NET project using the Link to file option when adding a C# file to the project...</p> <p>&nbsp;</p> </blockquote> &nbsp; 2007-09-30T22:37:13-04:0017691http://forums.silverlight.net//p/4495/17691.aspx/1?Re+Re+Silverlight+project+amp+quot+add+reference+amp+quot+Re: Re: Silverlight project &amp;quot;add reference&amp;quot; <p></p> <blockquote><span class="icon-blockquote"></span> <h4>Abbas1982</h4> <p></p> <p>I am trying to do the same (add a C# class library reference to a silverlight project) where can I find this Link to File option? </p> <p></p> </blockquote> &nbsp; <p></p> <p>Provided that you have defined business object classes in another project in the solution; in your silverlight project, do this (file for file):</p> <ul> <li>Right click on the silverlight project root</li><li>Choose Add-&gt;Existing Item</li><li>Navigate to your source code file and select it<br> </li><li>Click on the little arrow on the right-hand side of the Add button and select Add as link.</li><li>Repeat for all files you wish to add to your silverlight project.</li></ul> <p>Hope this helps,</p> <p>/Thomas L<br> &nbsp;</p> 2007-10-17T11:04:46-04:00154871http://forums.silverlight.net//p/4495/154871.aspx/1?Re+Re+Silverlight+project+amp+quot+add+reference+amp+quot+Re: Re: Silverlight project &amp;quot;add reference&amp;quot; <p>&nbsp;Hi all,</p> <p>I have the same problem.</p> <p>Earlier i was using ASP.net and i have added my DashboardLibarary.dll ( contain both my business as well as DAL) and it was working fine.</p> <p>Now i am traying to use silverlight in my web application, but getting the same error mentioned in first post while adding my .dll to silverlight project.</p> <p>I have tried Thomas steps, and added my all bussiness classes (7 class) as link to silverlight project but after adding again those classes refere to other namespace like System.Data giving error.There are other namespace giving the same problem. However it was working fine if i exclude my silverlight project from my Applicatation solution.<br> </p> <p><b>Error&nbsp;&nbsp;&nbsp; 37&nbsp;&nbsp;&nbsp; The type or namespace name 'Data' does not exist in the namespace 'System' (are you missing an assembly reference?)&nbsp;&nbsp;&nbsp; C:\..\DashboardLibrary\Business\ComponentHelper.cs&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp; 14&nbsp;&nbsp;&nbsp; SilverlightApplication1</b></p> <p>Hope you understand my problem,</p> <p>Waiting for your reply.</p> <p>Thanks and Regards,</p> <p>Avtar Sohi. <br> </p> <p>&nbsp;</p> 2009-01-02T08:16:14-05:00171025http://forums.silverlight.net//p/4495/171025.aspx/1?Re+Re+Re+Silverlight+project+amp+quot+add+reference+amp+quot+Re: Re: Re: Silverlight project &amp;quot;add reference&amp;quot; <p>I am having this issue too. I tried to Link to File option and of course I can add as many files as links and use their source code, but when I have a regular .NET&nbsp;library that is referencing 10 other libraries (including the vital Enterprise Library), how can I&nbsp; bring the source code along with all the references into my Silverlight applicaiton so I can just reuse what I have out there? This whole thing is radiculous. I know what causes the limitations, but I still don't see what the use of Silverlight is when you can't reuse anything that you've done previously...</p> 2009-02-06T14:09:40-05:00171051http://forums.silverlight.net//p/4495/171051.aspx/1?Re+Silverlight+project+quot+add+reference+quot+Re: Silverlight project &quot;add reference&quot; <p>This is currently a big limitation, however Microsoft is working on a flow-down business entity framework (code name Alexandria) that will allows the business objects defined against the .NET runtime to be referenced from Silverlight.</p> <p>This was presented at the PDC &amp; various MDCs across the country last fall, but unfortunately there is no timeline announced for when it will be released.</p> <p>The way I have handled this limitation is, I perform the majority of my business logic on the server (using the .NET objects) based on WCF service calls.&nbsp; The data resulting from this logic is returned using DataContract classes which I can then use to populate local Silverlight business objects, which duplicate only that business logic that the UI itself needs to know about but have the same &quot;shape&quot; as the DataContract class.</p> <p>It's not ideal, certainly, but it is working.&nbsp; I look forward to the flowdown business objects though too because duplicated code is never ideal. <br> </p> 2009-02-06T15:17:54-05:00171796http://forums.silverlight.net//p/4495/171796.aspx/1?Re+Silverlight+project+quot+add+reference+quot+Re: Silverlight project &quot;add reference&quot; <p>anyeone,</p> <p>Thanks a lot for the useful information. I did suspect that WCF service calls will be the solution to my problem. I sure am looking forward to the Alexandria framework which seems that it will have the ability to make up for a lot of those limitations. Again, thanks a lot!</p> 2009-02-09T12:59:30-05:00