Click here to Skip to main content
15,903,523 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've created an WPF Project. Since the project has become big enough for me to maintain I wish to break its code into several Shared Projects.

So can I add/create Shared Project for C# & WPF?

I'm asking this since I cannot find any template in New Projects for creating Shared Project for C# & WPF

Thanks in Advance
Amit Saraf

What I have tried:

I tried to add Shared Project to my WPF Project but it did'nt support XAML
Posted
Updated 3-Jan-22 1:55am
Comments
Richard MacCutchan 3-Jan-22 7:07am    
You just need to create new projects in the same solution, and split the source files into the parts that you want. But you must make sure that each part contains all the relevant sources.
A N Saraf 3-Jan-22 7:32am    
as suggested by you I did and seperated a group of code along with XALM files in shared project but files in shared project cannot access custome controls in main project

1 solution

Quote:
files in shared project cannot access custome controls in main project

That's part of the idea: shared controls should be moved to a second project and then referenced from there by any project that needs them.
From what you say, the controls are still in the main project, which is the wrong place.

Additionally, in order to be accessible outside the current project / assembly, they need to be declared as public (or possibly protected / protected internal: Access Modifiers - C# Programming Guide | Microsoft Docs[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900