I have a VS2022
class library project that looks strange in a number of ways:
- Cannot add a service reference (see screenshot)
- There is no References node (for assembly references) - see screenshot
- The project properties UI looks very different
When I right-click on my class library project -> Add
-> Service Reference
, I'm taken to this screen that has only Connected Services
and not Service References
:
When I click Add a service dependency
, I'm presented with all these options that are not what I need:
I need to add a service reference like this (only exists in my winforms project):
Notice 2 things in the screenshot below: (1) Dependencies
instead of References
?? Also, note that I have a reference to System.ServiceModel
, so I see no reason why I cannot add a service reference.
This Project Properties UI looks very different:
Compare the above against my more traditional-looking Project Properties UI for a winforms project in the same solution (we're still in VS2022):
What is going on? I can't add a Service Reference
, I don't have a References
node (it's a Dependencies
node instead), and the project properties UI is quite different.
CodePudding user response:
This looks like you've created a project based on the .NET SDK (not .NET Framework), and so VS offers a different experience for it - notably some features are new (like the look and functionality of the property pages) and some are missing (like support for .NET Framework specific tooling such as Service References).
When the project was created, it was probably created from the red template, but you're expecting the blue one:
The simplest solution is to stash your source files, create the project from scratch with the correct template, then retrieve your stashed files into the new project.