I am trying to do something simple, just add a new namespace to my XAML in the window definition. My main class is MainWindow.xaml and is in the "WealthmarginAnalyser" namespace. All I need is to be able to access "WealthMarginAnalyser.ViewModel" namespace.
<Window x:Class="WealthMarginAnalyser.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="clr-namespace:WealthMarginAnalyser.ViewModel"
Title="{Binding TitleText}" Height="569" Width="700">
Surely this is simple, without the xmlns:vm line, the code compiles and runs fine. As soon as that line is put in, the designer fails to load with error
Error 3 Unable to load the metadata for assembly 'WealthMarginAnalyser'. This assembly may have been downloaded from the web. See http://go.microsoft.com/fwlink/?LinkId=179545. The following error was encountered during load: Could not load file or assembly 'WealthMarginAnalyser' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) F:\JK\Wealth\WealthMarginAnalyser\WealthMarginAnalyser\MainWindow.xaml 1 1 WealthMarginAnalyser
Update : even after specifying the assembly WealthMarginAnalyser in the XMLNS declaration the same error occurs. It seems I can't add any XMLNS declarations in the XAML that reference other namespaces in the same Assembyly.
Ie I have one assembly only, called WealthMarginAnalyser. Within this I have a few folders and each folder comprises a different namespace, so I have namespaces
WealthMarginAnalyser WealthMarginAnalyser.ViewModel WealthMarginAnalyser.Model WealthMarginAnalyser.Helpers
The main XAML file is in namespace WealthMarginAnalyser
I want to be able to declare namespaces for the other ones, such as WealthMarginAnalyser.ViewModel - and I thought it was as simple as putting a single line in the XAML to declare that as a CLR namespace, but apparently not.
Given that they are all in the same assembly solution, there are no compiled DLLs to right click and change properties on, it is a single file WPF application, all namespaces within the same solution/assembly.
Any thoughts?
Sounds like it got tagged as being from the evil Internets.
Find the assembly in Windows Explorer:
FYI I found the problem.
In WPF project to allow the project to load from remote source you have to enable it in the configuration file devenv.exe.config.
Step 1: Search the configuration file devenv.exe.config in your system. Usually it is located at C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.config
Step 2: Edit the configuration file. Add following line in the <runtime>
tag
<loadFromRemoteSources enabled="true" />
Step3: Restart your visual studio.
User contributions licensed under CC BY-SA 3.0