1

Recently I learned about shared projects and how I can separate large chunks of my code (ie: all my UI controls) into another area to clean my up main code without adding a dll to my execution path. AMAZING, except it only partially works.

If I move code from my main project into the shared and change the namespace (to the shared one), things still work. But when I create a new file directly in the shared project, ONLY that file is able to see itself.

It's only after closing VS multiple times, re-compiling, removing the shared project, sacrificing a chicken then maybe class is finally seen. MAJOR waste of time with not lessons learned.

What is the fast route to getting my new file seen while still using shared projects?

== Steps to reproduce

  1. Create a new project (WinForms, in this case)

  2. Create a shared project in the main project + add reference in main project

    • Note, the shared project is in a sub-folder of the parent project, to keep things organized
  3. Create a class in shared project and try to use it in the min project

Screenshot

Adam
  • 19
  • 1
  • Have you verified this is continuing to happen for you in another solution? Also, does this happen *always*? I have noticed issues with visual studio sometimes are resolved by a simple close and reopening of visual studio (make sure to close _all_ instances of visual studio). – Chris Thompson Oct 28 '17 at 03:44
  • I closed all instances and made this project from scratch (thus the lame default names). As for plugins/ extensions, I have: code maid, power productivity tools, and code alignment something (doing a repair, so I can't see the names). Nothing which would have broken shared project actions. – Adam Oct 28 '17 at 03:51

2 Answers2

0

It works for me (VS2017), when I add the shared project next to the main project in the same solution and add reference to the shared project as well as the proper using directives in the main project.

However I came across the limitation that it will not let you share WinForms stuff. Maybe that is what you're up against. This seems to be by design

wecky
  • 754
  • 9
  • 17
0

I think the class library and other project have different target framework. Why dont you try to just set them to a particular.Net Framework.

It should really solve the problem.

Check this

DeshDeep Singh
  • 1,817
  • 2
  • 23
  • 43