Silverlight project will only work with Silverlight assemblies - silverlight

Now a days, I make one application in Silverlight to get Emails from MS Exchange Server online. So first i create Silverlight Application in Visual Studio 2010. Now Issue is that when i add reference Microsoft.Exchange.Webservice.dll to silverlight application so error shown below:
"You cant add a reference to Microsoft.Exchange.Webservice.dll as it was not built against the Silverlight runtime. Silverlight project will only work with Silverlight assemblies".
I have searched error but failed to solve this issue.. please help me..

Silverlight uses a different runtime and a subset of the regular .Net framework, which is why you can only reference other SIlverlight libraries.
I would also think you shouldn't be referencing the Microsoft.Exchange.Webservice.dll directly anyway, rather you should be adding a web service reference to a web service exposed by an existing installation of Exchange, and then using webservice calls to retrieve the emails.
Edit:
This excellent previous StackOverflow should be enough to get you underway: Getting started with Exchange Web Services 2010

Related

WCF Data Service reference in WPF Project in VS2017

I'm having issues adding a service reference to my WPF project in VS2017. The service itself is a WCF Data Service using EntityFramework (EntityFrameworkDataService). In VS2013 that I was using before, I didn't have any issues adding services to my WPF project. I upgraded to VS2017 last month, and recently made some changes to the WCF service and needed to refresh the reference in my WPF project. I couldn't seem to get it to refresh so I deleted the reference and started trying to re-add the reference and now I'm greeted with this error message:
The specified OData API cannot be added because OData APIs are now
only supported with Connected Services.
For more information, please see:
https://aka.ms/odatavsclientguidance
That provided link does not have any info regarding VS2017 setups. It recommends to use the 'OData Connected Service' extension but that extension does not support VS2017 (tried it but got a "not compatible" message). I also found the 'VS WCF Connected Service' extension for VS2017, but it doesn't appear to support WPF projects (or atleast I couldn't figure it out).
Has anyone ran into this issue with adding a WCF Data Service reference to a WPF project? Any other suggestions that I could try?
I typically generate my clients via the DataSvcUtil.exe which is part of the .net framework
e.g.
"%windir%\Microsoft.NET\Framework\v4.0.30319\DataSvcUtil.exe" /dataservicecollection /version:2.0 /language:CSharp /out:c:\temp\DataService.cs /uri:http://localhost:16584/DataService/
The MSDN docs:
https://msdn.microsoft.com/en-us/library/ee383989(v=vs.110).aspx
As TGRA so eloquently stated, the best bet for VS2017 at time of writing is to use the dataserviceutil.exe. To make things simpler for myself I do the following:
In File Explorer, navigate to the datasvcutil.exe using the path as follows:
%windir%\Microsoft.NET\{{YOUR_PROCESSOR_ARCHITECTURE}}\{{YOUR_FRAMEWORKVERSION}}
Hold shift and right-click. Select Open Commandwindow here (or command prompt if you prefer.
Now execute a datasvcutil.exe command like so for C#: datasvcutil /language:Csharp /out:{{PATH_TO_PROJECT}}/{{SERVICE_NAME}}.cs /uri:{{URL_TO_SERVICE}}.svc
OR execute a datasvcutil.exe command like so for Visual Basic: datasvcutil /language:VB /out:{{PATH_TO_PROJECT}}/{{SERVICE_NAME}}.VB /uri:{{URL_TO_SERVICE}}.svc
And voila, you're done.

Creating a TFS project from a silverlight application

I am developing a Silverlight application that displays a dashboard of builds from TFS and I just found out that I cant reference TFS libraries from Silverlight as they are built with different runtime. Whats the workaround? Is their a Silverlight clr version of TFS libraries I can reference?
Thanks
You might be able to accomplish this by using the TFS OData API available here: https://tfsodata.visualstudio.com/

Coded UI Testing of Silverlight in Sharepoint 2010

I am creating a Coded UI test for our system which runs on Sharepoint 2010. Part of the test sequence is creating a site; Sharepoint's UI for creating sites runs on Silverlight. Therefore, I need to create a Coded UI test for a Silverlight component which is part of out-of-the-box Sharepoint rather then part of our application. When I try to record a test, I get the following message:
No Silverlight controls where detected. Verify that the application under test is built using Silverlight assemblies with a version of 4.0 or greater and that a reference to the Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper.dll assembly has been added to the project. For more information, see http://go.microsoft.com/fwlink/?LinkId=204562
I have two questions:
1) How can I find out the Silverlight version which Sharepoint components are built against? If they are built against Silverlight version 3.5 or earlier - I suppose the problem is unresolvable?
2) Assuming the previous question is answered - how can I make Sharepoint's Silverlight components reference the SilverlightUIAutomationHelper.dll library? That seems problematic at best to me...
Silverlight version installed on the test machine is 4; Visual Studio Feature Pack 2 is installed.
Thanks.
You can't make SharePoint's Silverlight components reference the automation helper library unless you have the source code and can recompile them. So the answer to your first question doesn't really matter.
You could modify Sharepoint XAPs to simply add Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper.dll in there. You don't really need the code itself to reference it, it just has to part of the package. The XAP file is just a zip file so you should be able to modify this.
You will have to find where Sharepoint is getting the XAPs from and change the source (obviously you don't want to do this in prod boxes and there's even a license restriction for the Automation dll that prevents you from do it). You could also write a Fiddler AutoResponder to modify the XAP file and add the dll before it gets to the browser. For an example of this have a look at this AutoResponder:
https://bitbucket.org/mamadero/hackingsilverlightdemo/src/2fecb7b59dec/FiddlerAutoResponder

"Object reference not set to an instance of an object" error shows when adding a reference to a WCF service to a Silverlight 4 project

I have a Silverlight enabled WCF service, and a Silverlight 4 project that references it.
The service used to work nicely until I merged some changes another developer made into the service, since then the Silverlight project failed to call the service with "Server not found" error.
I removed the reference to the service, tried to add it again but this failed with error "Object reference not set to an instance of an object".
This is not limited to the above service anymore, this error happens every time I try to add any WCF service to the Silverlight project.
I am using Visual Studio 2010 and the .NET Framework 4.0 for all projects.
This problem has happened before and I was able to solve it be creating a new solution, creating fresh projects in it and then adding the code files to the projects one by one. However, this is a nightmare now that my solution contains dozens of projects and hundreds of code files.
anyone out there with a fix for this? I googled this a dozen times and all I got was fixes to similar problems that happened with Silverlight 2 and Visual Studio 2008, but these fixes didn't work for me.
Thanks.
Make sure your WCF service is working properly. Right click on the SVC file and select View in browser. If there is a runtime problem, that should point you in the right direction.
Have you tried switching WCF tracing on? I find it normally provides clues to the problem source. Also, have you checked your Silverlight client config? Are the end point addresses all correct?

Is the System.Web.Silverlight reference needed?

We are just getting into Silverlight development at my workplace. Somehow two of our dev machines have been configured differently. I noticed that one of them has access to System.Web.Silverlight in the reference list, and the other doesn't. Both can create and run Silverlight applications from scratch.
What does System.Web.Silverlight do? Is it a legacy reference? If we need it, where do we get it from?
This dll provided the ASP.NET Silverlight server control which was designed to make it easier to create the object tag needed to describe the silverlight plug-in.
This server-side control was removed as of Silverlight 3, you are now expected to build the object tag yourself.
So yes its legacy so you don't need it.
Anthony is correct. If you are having trouble after you upgrade your products to Silverlight 3 - or just want an example on how to insert your SL app in to a page, create a new SL3 project and check out the sample ASPX and HTML pages (which are pretty much the same as each other now...)

Resources