Closed
Description
I'm using Visual Studio 2022 17.3.1
And I'm getting a series of errors regarding System.Security.Cryptography.Cng when trying to add a WCF service to my WPF .NET6 project.
I'm unsure if this is a WCF error or Visual Studio error - I'm guessing the errors come from the dotnet-svcutil so therefore i report it here.
Importing web service metadata ...
Scaffolding service reference code ...
ErrorMSBuild version 17.3.0+92e077650 for .NET
C:\Users\mk\AppData\Local\Temp\WCFConnectedService\2022_Aug_22_08_15_46\svcutil_bootstrap\SvcutilBootstrapper\SvcutilBootstrapper.csproj : warning NU1605: Detected package downgrade: System.Security.Cryptography.Cng from 5.0.0 to 4.5.0. Reference the package directly from the project to select a different version.
C:\Users\mk\AppData\Local\Temp\WCFConnectedService\2022_Aug_22_08_15_46\svcutil_bootstrap\SvcutilBootstrapper\SvcutilBootstrapper.csproj : warning NU1605: SvcutilBootstrapper -> dotnet-svcutil-lib 2.0.3 -> NuGet.ProjectModel 5.10.0 -> NuGet.DependencyResolver.Core 5.10.0 -> NuGet.Protocol 5.10.0 -> NuGet.Packaging 5.10.0 -> System.Security.Cryptography.Cng (>= 5.0.0)
C:\Users\mk\AppData\Local\Temp\WCFConnectedService\2022_Aug_22_08_15_46\svcutil_bootstrap\SvcutilBootstrapper\SvcutilBootstrapper.csproj : warning NU1605: SvcutilBootstrapper -> System.Security.Cryptography.Cng (>= 4.5.0)
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.Shared.targets(250,5): error NETSDK1136: The target platform must be set to Windows (usually by including '-windows' in the TargetFramework property) when using Windows Forms or WPF, or referencing projects or packages that do so.
[C:\Users\mk\AppData\Local\Temp\WCFConnectedService\2022_Aug_22_08_15_46\svcutil_bootstrap\SvcutilBootstrapper\SvcutilBootstrapper.csproj]
Build FAILED.
C:\Users\mk\AppData\Local\Temp\WCFConnectedService\2022_Aug_22_08_15_46\svcutil_bootstrap\SvcutilBootstrapper\SvcutilBootstrapper.csproj : warning NU1605: Detected package downgrade: System.Security.Cryptography.Cng from 5.0.0 to 4.5.0. Reference the package directly from the project to select a different version.
C:\Users\mk\AppData\Local\Temp\WCFConnectedService\2022_Aug_22_08_15_46\svcutil_bootstrap\SvcutilBootstrapper\SvcutilBootstrapper.csproj : warning NU1605: SvcutilBootstrapper -> dotnet-svcutil-lib 2.0.3 -> NuGet.ProjectModel 5.10.0 -> NuGet.DependencyResolver.Core 5.10.0 -> NuGet.Protocol 5.10.0 -> NuGet.Packaging 5.10.0 -> System.Security.Cryptography.Cng (>= 5.0.0)
C:\Users\mk\AppData\Local\Temp\WCFConnectedService\2022_Aug_22_08_15_46\svcutil_bootstrap\SvcutilBootstrapper\SvcutilBootstrapper.csproj : warning NU1605: SvcutilBootstrapper -> System.Security.Cryptography.Cng (>= 4.5.0)
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.Shared.targets(250,5): error NETSDK1136: The target platform must be set to Windows (usually by including '-windows' in the TargetFramework property) when using Windows Forms or WPF, or referencing projects or packages that do so.
[C:\Users\mk\AppData\Local\Temp\WCFConnectedService\2022_Aug_22_08_15_46\svcutil_bootstrap\SvcutilBootstrapper\SvcutilBootstrapper.csproj]
1 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.45
An error occurred while bootstrapping svcutil. This usually happens when processing references. You might be able to work around this problem by not providing reference parameters, and manually removing any types redefined in the generated proxy code.
Done.
ErrorFailed adding service reference(s). Index (zero based) must be greater than or equal to zero and less than the size of the argument list.