With the availability of .Net Core RC2 and ASP.NET Core RC2 we are pleased to announce an update to the WCF Connected Service Preview for ASP.NET 5 Visual Studio extension tool for generating SOAP service references for clients built on top of WCF for .NET Core RC2. This update brings some improvements to the user experience when navigating through the Connected Service wizard UI and the ability to reuse types defined in the project to which a service reference is being added to and from the project’s references, in addition to several bug fixes.
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 version of the WCF Connected Service extension is not compatible with .NET Core RC2 and once you upgrade it cannot be reinstalled since it is being replaced with this new version of the tool. We strongly encourage you to upgrade to .NET Core RC2 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 as shown below by searching for “WCF Connected Service” for instance.
How to use the extension
The WCF Connected Service extension is applicable to any projects created with project templates under Visual C# -> .Net Core. This includes Console Application (.Net Core), Class Library (.Net Core) and ASP.NET Core Web Application (.Net Core) 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:
- In Solution Explorer, right-click on the References item of the project and then click Add Connected Service. The Add Connected Service dialog box appears as shown below.
- In this dialog, click Microsoft on the left column, then click WCF Service – Preview in the middle column, you might need to scroll down a bit, and finally click on the Configure button. This will bring up Configure WCF Service Reference dialog box.
- 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 that you want to use for the reference in the Namespace box.
Once a service has been selected you can click Next to visit the Data Type Options and the Client Options pages; alternatively you can click Finish to use default parameter values.
One of the novelties for this release is the ability to reuse types defined in the project and types from assembly and project references. This is a very popular feature in the Visual Studio Add Service Reference tool for traditional .NET Framework projects that was missing in previous releases. This is useful when types used for creating the service you are adding a reference to are available to your project, some of these types might be defined in .NET Core framework assemblies for instance, and in order to avoid type clashing it is necessary to reuse the existing types.
- Click Finish when you are done.
This will download metadata from the WCF service, generate a reference.cs file for the WCF client proxy, 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 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 to see implemented in the tool.
Thank you and happy coding!
0 comments