.Net Core 1.0 andASP.NET Core 1.0 are finally here, and with them we are pleased to announce an updated version of the WCF Connected Service – Preview compatible with these products.
This is a Visual Studio extension for generating SOAP service references for clients built on top of WCF for .NET Core 1.0 . This update replaces all previews releases of the extension and it comes with some UI improvements, like visual warnings when a form page in the configuration wizard needs user attention, in addition to several bug fixes. It is still in preview mode as the foundational Visual Studio tooling components are not yet finalized.
How to Install the extension
The WCF Connected Service extension can be installed on Visual Studio 2015 and it has the following prerequisites. Please make sure you have prerequisites installed before installing the extension.
Notice that the previous versions of the WCF Connected Service extension are not compatible with .NET Core 1.0.0 and once upgraded they cannot be reinstalled since they are being replaced with this new version of the tool. We strongly encourage you to upgrade to .NET Core 1.0.0 and get this new and improved version of the extension installed.
As with previous versions of the extension, it is published into the Visual Studio Extensions Gallery and can be downloaded either from the official Visual Studio Extensions Gallery download page or directly from Visual Studio via the “Extensions and Updates” dialog box as shown below by searching for “WCF Connected Service” for instance:
How to use the extension
The WCF Connected Service extension is applicable to projects created using the templates under Visual C# -> .Net Core. This includes Console Application (.Net Core), Class Library (.Net Core) and ASP.NET Core Web Application (.Net Core) projects as shown in the image below.
Using the ASP.NET Core Web Application project template as an example, I will walk you through the steps to add a reference to a WCF service to the project:
1. In Solution Explorer, right-click on the References project item and then click on the Add Connected Service option. The Add Connected Service dialog box appears as shown below.
2. In this dialog, click Microsoft on the left column if not selected, and WCF Service – Preview in the middle column if visible, you might need to scroll down a bit depending on the number of extensions installed in your system, and finally click on the Configure button. This will bring up the Configure WCF Service Reference wizard.
3. You can either click the Discover button to initiate a search for services that are contained in the current solution or enter a service URL in the Address box and then click Go to search for services hosted at the address. The services that are found will be displayed in the Services box and you can select the one you want to use. You can also enter the namespace for the generated code in the Namespace box.
Once a service has been selected you can click Next to visit the Data Type Options and the Client Options form pages. Alternatively you can click Finish to use default parameter values if all the wizard forms are filled correctly.
The Data Type Options form offers a few settings for further refining the configuration for the generated service reference, and of particular interest is the option to reuse types in reference assemblies. This is useful when types needed for generating the service reference code are available to your project, some of these types might be defined in .NET Core framework assemblies for instance, and in order to avoid compile-time type clashing it is necessary to reuse the existing types.
Depending on the number of project dependencies as well as other system performance factors, it may take some time for type information to be loaded into this form, the Finish button will be disabled during this time unless the option to reuse types in reference assemblies is unchecked.
4. Click Finish when you are done.
This will download metadata from the WCF service, generate the service reference code into a file named reference.cs, and add it to your project under the Service References folder. The project’s project.json file will also be updated with the NuGet package references required for your project to compile and run on the target platform.
You can then create instances of the WCF client types generated by the tool and communicate with your web service as desired.
What’s next and feedback request
This is a preview version of the tool. We are working to improve it and potentially bring in more features in the future. In the meanwhile, we would love to hear about your experience using this tool and any feedback you can provide, including issues you may find, as well as features you would like the tool to provide.
Thank you and happy coding!