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.
Related
A few days ago I updated a wpf program from .net4.8 to .net5. Some users now get an error message that can be seen in the picture.
These users have .NET Desktop Runtime 5.0.x installed. Apparently that is not enough. The program will not work until the SDK is installed.
My question now is, is there any way I can quickly tell whether I'm using classes or methods that need an SDK?
Do I have to adjust the publish config?
I would not like to deliver the whole framework with the program together.
Appearantly your app has a dependency on the ASP.NET runtime as well.
You will either have to download and install this one separately or remove any references to it from your app.
Check for any framework reference to Microsoft.AspNetCore.App in your project files (Project Sdk="Microsoft.NET.Sdk.Web">) or under Dependencies->Frameworks in Visual Studio.
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
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
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?
In a Windows Phone 7 Silverlight project, I had a service reference to a WCF service. This morning when I opened up the project, suddenly the namespaces for my WCF service were unknown. The option for "Update Service Reference" in Solution Explorer was not there, so I deleted the Service Reference with the intent of re-adding it. But the option for "Add Service Reference" is also not there. Gone. Disappeared.
Closed and re-opened the solution. Restarted VS2010 Ultimate. No dice. Anyone run across this?
I don't know how this happends in the first place, so we don't know the cause yet, but I found a solution to the problem.
Open your *.csproj file in Notepad or Textpad or something like that. Find where it has the tag. Replace that tag with this:
<ProjectTypeGuids>{14822709-B5A1-4724-98CA-57A101D1B079};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
Close and re-open the project and the option to add service references will be usable.
In my case,
I changed my target framework from .Net Framework 2 to .Net Framework 4. The "Add Service Reference" appears immediately
Change Project Properties
I had the exact same problem with the missing "Add Service Reference" context menu option in Visual Studio 2017 with a regular C# desktop app project.
For me, the problem could be fixed by simply re-creating the entire project solution from scratch within Visual Studio. It turned out that the original project solution file had been created by an earlier version of Visual Studio, and this seems to have caused the problem.