问题
I'm trying to use System.ServiceModel
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.PeerResolvers;
in C# winform desktop application, but I can't find it in Visual Studio 2015 to add it to the project References, which must be System.SeviceModel in Framework I guess, not sure
Any advice would be useful
回答1:
Update your project target framework to .NET 4.5 by Right clicking your project, going to properties, then application, then target framework. Change the target framework to .NET Framework 4.5.
In my VS2015 instance, when I go to Add References-> Assemblies, System.ServiceModel is there, and it looks to be in the C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5 folder.
If System.ServiceModel is not in the list, you can attempt to get it via the Right Click-> Manage NuGet packages-> Browse, and search for ServiceModel, get the one from Microsoft.
来源:https://stackoverflow.com/questions/43873476/system-servicemodel-references