In my current personal project, I have a Core project, a DependencyResolution project, and a UI project (WPF application). In the UI project, I’ve tried to make a call to the DependencyRegistrar class that’s in DependencyResolution in both MainWindow.xaml.cs and App.xaml.cs. There seems to be an issue with the UI project referencing the DependencyResolution project, as this compiler error always occurs:
The type or namespace name 'DependencyResolution' does not exist in the namespace
'DMTools.InitiativeTracker' (are you missing an assembly reference?)
D:\Dev\InitiativeTracker\src\UI\App.xaml.cs 2 33 UI
Just including the using statement anywhere in the UI yields that error.
using System.Windows;
using DMTools.InitiativeTracker.DependencyResolution;
namespace DMTools.InitiativeTracker.UI
{
public partial class App : Application
{ }
}
I can reference the Core project (using DMTools.InitiativeTracker.Core) and everything compiles okay. Furthermore, I can make references to DependencyRegistrar in the IntegrationTests project (another Class Library) and it compiles okay.
You can find the complete source here. Feel free to request specific snippets if you need more info.
EDIT:
I have added an assembly reference to DependencyRegistrar both via ReSharper and the typical Visual Studio way. Both cases did not resolve the issue. To the other comment: When I add a reference to a Core static class (IoC), the XAML remains unchanged but it compiles fine.
Tigran’s comment figured out the mystery. In the UI project, I changed
Target frameworkfrom “.NET Framework 4 Client Profile” to “.NET Framework 4” and it all works correctly.The only thing I can think of as to why this was an issue with DependencyResolution and not Core is that the former makes references to third party utilities (i.e. Ninject) which has issues with Client Profile, but I’m only guessing here.