Click here to Skip to main content
15,906,574 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I noticed I can reference namespaces in another project (the view folder in mvvm) but the namespaces and classes in the sibling view model and model folders are inaccessible, even if I enter it manually, it claims it doesn't exist.

I believe this is not standard behavior because those view models were accessible in the same file until I refactored the codebase and split each module into it's own project.

What I have tried:

I've added all 3 current projects in the projects reference. How can I access those folders? What could the problem be? Many thanks.

The project files may be found here Dirkstar99.7z - Google Drive[^]
Updated 20-Jul-18 23:25pm

Can you show some sample code?

More likely than not you are missing an assembly reference like this:


as shown here:
MRULib/MainWindow.xaml at master · Dirkster99/MRULib · GitHub[^]

But I cannot tell since you post no sample code :-(
Share this answer
nmeri17 19-Jul-18 10:41am    
Hi. So sorry for my late reply. I found a reference to the assembly reference of the project itself clr-namespace:Solution.Project;assembly=Project so I tried using it thus DataType="{x:Type myns:TargetNs.TargetClass}" but it says nested types are not supported for this attribute, so I tried using it as a standalone resource i.e <myns:TargetNs.TargetClass x:Key="foo"></myns:TargetNs.TargetClass > yet it says the name TargetNs does not exist in that namespace :'(
Dirk Bahle 19-Jul-18 17:40pm    
Sorry, but I need more complete XAML sample code that what you are showing. I cannot tell what you are trying to do nor how to fix it based on XML snippets only - please list a more complete XAML listing.

The problem of non-existant reference can be due to a number of things - it starts with a male-formed reference and ends with an internal class deifnition any many other problems in between - you need to list more code (a complete project/solution would be best) to expect helpt on this on I am afraid...
nmeri17 20-Jul-18 9:22am    
"ends with an internal class deifnition", yes, I've just realized the classes weren't marked as public (thus internal). Setting their access level to public solved it, thanks!
nmeri17 20-Jul-18 4:10am    
How do I upload the solution as a zip file? I'm asking because it's a composite mvvm solution so there are a number of files, I don't know which ones will be relevant to you. That's why I refrained from posting any code. The only difference between the visible assembly/namespace and the "nonexistent"/inaccessible is that the visible namespace contains a user control. Their definitions are both the same
nmeri17 20-Jul-18 5:20am    
I've just discovered that the App.xaml has this to say about the resources file "An error occurred while finding the resource dictionary StringResx.xaml" even though they're both in the same location. Could this be the cause?
I am glad you made your code downloadable - it contains multiple problems that you need to fix to get it compiled:

Replace the following XAML in StringRes.xaml



This is actually what I tried to suggest in Solution 1 without seeing your code...

Make the classes
public since they will otherwise be invisible outside of their assembly.

I can compile and start your code when I make these changes. But then I get an unrelated PRISM Exception:
$exception	{"Directory ../../SchoolPrismInfrastructure/Modules was not found."}	System.InvalidOperationException
which I fixed further below for you.

Based on the questions you asked and the simplicity of the problems you cannot seem to recognize and fix I recommend you build your project without PRISM first - and then introduce PRISM when you have a working application - otherwise, you'll be trying to juggle more than one completely new topic at a time and some balls will smash into the ground (I am afraid)...

I hope this was helpful, though...

public class TopicSchema
        public string Name {
            get; set;

        public int Week
            get; set;

        public Uri VidLink { get; set; }

        public List<string> Instructions
            get; set;

        public string Code
            get; set;
        public string VidString
            get { return VidString; }
            set {
                VidLink = new Uri("../../Topics/View/Assets/" + value, UriKind.Relative); // relative paths read from debug folder

public class TopicsViewModel
        public TopicSchema currentTopic
            get; set;

        public ObservableCollection<TopicSchema> getAllWeeks
            get { return TopicsModel.GetAllWeeks(); }

            set { }

        public DelegateCommand<string> displayTopic
            get { return new DelegateCommand<string>(DisplayTopic); }

            set { }

        public void DisplayTopic (string week) {

            var query = from topic in getAllWeeks where topic.Week== int.Parse(week) select topic;

            currentTopic = query.First();

            IModule allModules = ServiceLocator.Current.GetInstance<ModuleCatalog>().Modules.Where((ModuleInfo m) => m.ModuleName.Equals("TopicsModule")).Cast<IModule>().First(); //.ShowSandbox();

I played a little more with it and found a simple solution for the additional exception. Go into the Solution Exporer and:

1) add a Modules folder to the
project and
2) add a ReadMe.txt file into the modules folder
3) Right-Click on the ReadMe.txt file and select properties - select Build Action=Content and Copy to OutputDirectory = Always

Go into
class and edit the following lines:
protected override IModuleCatalog CreateModuleCatalog ( ) {

            return new DirectoryModuleCatalog() {
                ModulePath = @".\Modules\" // executing path is debug/bin

this should make sure that you always have a Modules directory and PRISM won't throw the above exception... The application starts up for me when I do this... don't forget to give the solution stars...
Share this answer
nmeri17 21-Jul-18 10:28am    
Hi Dirk. How is one account able to post two solutions to one question? I already accepted the previous answer and starred it yesterday. In the comments I thanked you for being so helpful. Did you not see?
Dirk Bahle 21-Jul-18 10:57am    
I guess one can post as many solutions as one can - I saw the first solution - but do your really think this long winded support is worth three stars only? Anyway, it does not matter - I hope you get to implement something cool now :-)
nmeri17 21-Jul-18 13:48pm    
Well, 3+3 adds up to 6, which is more than the stipulated amount for one solution. Also I fixed it from a hint in your conjecture so I probably deserve to share 2 from the available 10 points. See? Fair distribution.

So to business, the modules were in the main project initially but I relocated them to a central location so they'll be accessible to each other without fear of circular dependency. I intend to call a method in the infrastructure assembly that will set the directory path for the catalog. But this invocation will be made from CreateModuleCatalog in the bootstrapper. When that didn't work, I commented out the method altogether and the application still compiled fine. I've created another question about this, which brings me to your suggestion

<quote>recommend you build your project without PRISM first </quote>
Since I'm going to use the industry standard for implementing mvvm anyway, why postpone working with it?

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