Type of a project that contains only interfaces?

761 views Asked by At

I am planning to use interfaces in my .NET project. I would like to add a new project "MyInterfaces" in my existing solution. "MyInterfaces" will contain all interfaces required by the solution.

But I am somewhat confused about the project type. What project type should "MyInterfaces" have? Class Library, or something else?

Then, what type of item would I add into that project to declare an interface? Interface or class?

3

There are 3 answers

1
Jon Skeet On BEST ANSWER

Yes, it should be a class library. You'd then add an interface to the project - if you added a class, you'd have... well, a class! (Of course, you can add a class and then just change it to an interface declaration - as far as Visual Studio is concerned it's just a C# file; the "Add new item" part is just changing the initial template in this case.)

If the problem is the name of the project type being "class library" rather than "interface library", ignore that - it's really just an assembly which doesn't include an entry point.

0
Jose Marcos On

Project Type = Class Library . After create your project you can add a new Interface or class to the project. Both Interfaces and Classes Items are just templates files and you can edit them later.

1
sternr On

The project type should be Class-Library, and to add a new interface to the project you should Add=>New Item=> Interface