2

I just came across this scenario and thought I'd share it in case it saves you some time.

I have a fairly large solution in VS2017 and have a shared project that contains some common code such as enums.

I just tried to add my shared project to another project (right click project, add reference and go to shared Projects section) and noticed that the shared projects was empty. It wasn't giving me the shared project as an option.

See my answer below...

Richard Moore
  • 1,133
  • 17
  • 25
  • **Project** code has to be homogeneous - you cant add c# to a VB project, but you dont add a project to a project anyway. Maybe it is different with VS2017 but from the **File** menu you can add a new or existing project to the current *Solution*. I am not exactly sure what you mean by "shared project" in this context. – Ňɏssa Pøngjǣrdenlarp Nov 09 '17 at 17:16
  • "Shared Projects" were introduced (AFAIK) in VS2015. They appear as a project in the solution, but do not build into assemblies but exist as source code only. You can add a shared project as a reference in another project, so in that sense you do add (or at least include) one project to another. – Richard Moore Nov 09 '17 at 20:58

1 Answers1

5

After a bit of digging it dawned on me that my shared project is C# whereas the project I was trying to add it to was VB.Net.

Obvious when you realise it, but I was still thinking of a shared project compiling to an assembly (dll) which could be referenced from VB.Net or C#. Whereas a shared project should be thought of more like a C++ include. Shared projects simply insert the source code into the recipient project and can only be used with projects of the same language.

Richard Moore
  • 1,133
  • 17
  • 25