Reputation: 103
I need to use a WCF service from WPF developed in .NET Core 3.0 preview 5. In Visual Studio I cannot use Add -> Service reference because VS doesn't support this option now.
My first option is write in .csproj all components I need to running my project, but It doesn't work.
This is my .csproj.
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<None Include="Connected Services\ServiceTime\Time.wsdl" />
<None Include="Connected Services\ServiceTime\Time.xsd">
<SubType>Designer</SubType>
</None>
<None Include="Connected Services\ServiceTime\Time1.xsd">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<ItemGroup>
<WCFMetadataStorage Include="Connected Services\ServiceTime\" />
</ItemGroup>
<ItemGroup>
<None Include="Connected Services\ServiceTime\Time.disco" />
</ItemGroup>
<ItemGroup>
<None Include="Connected Services\ServiceTime\configuration91.svcinfo" />
</ItemGroup>
<ItemGroup>
<None Include="Connected Services\ServiceTime\configuration.svcinfo" />
</ItemGroup>
<ItemGroup>
<None Include="Connected Services\ServiceTime\Reference.svcmap">
<Generator>WCF Proxy Generator</Generator>
<LastGenOutput>Reference.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Windows.Compatibility" Version="2.1.1" />
</ItemGroup>
<ItemGroup>
<Reference Include="TimeService">
<HintPath>..\..\TimeService\TimeService\bin\TimeService.dll</HintPath>
</Reference>
</ItemGroup>
</Project>
TimeService is working correctly.
If anyone knows a guide about use WCF service in WPF use .NET Core 3.0 let me know please.
Upvotes: 0
Views: 3808
Reputation: 27214
I need to use a WCF service from WPF developed in .NET Core 3.0 preview 5. In Visual Studio I cannot use Add -> Service reference because VS doesn't support this option now.
For .NET Core you add it as a Connected Service.
Use the WCF Web Service Reference Provider Tool
...
The WCF Web Service Reference option is applicable to projects created using the following project templates:
- Visual C# > .NET Core
- Visual C# > .NET Standard
- Visual C# > Web > ASP.NET Core Web Application
...
Upvotes: 4
Reputation: 273169
I cannot use Add -> Service reference because VS doesn't support this option now.
Yes it does. It's under "Add Connected Services".
It seems you want to add a WCF client, but do be clear about that. WCF services are not supported on Core.
Upvotes: 2