Click here to Skip to main content
15,566,065 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi friends,

I am trying to build an application, where i was ended up with the following error

Error:
Assembly must be specified for XAML files that are not part of a project. Reopen this XAML file after adding it to a project, close this file and reopen it using the project it is associated with, or modify the clr-namespace to include the name of the assembly.
My code snippet is
HTML
<StackPanel 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:ABC.XXX.YYY.Silverlight.Controls"
    xmlns:login="clr-namespace:ABC.XXX.YYY.Silverlight.LoginUI"
    x:Class="ABC.XXX.YYY.Silverlight.LoginUI.LoginForm"
    KeyDown="LoginForm_KeyDown"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d"
    d:DataContext="{d:DesignInstance Type=login:LoginInfo}">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
<local:BusyIndicator x:Name="busyIndicator" BusyContent="{Binding Path=ApplicationStrings.BusyIndicatorLoggingIn, Source={StaticResource ResourceWrapper}}" IsBusy="{Binding IsLoggingIn}">
     <StackPanel Orientation="Vertical">
         <local:CustomDataForm x:Name="loginForm"
                                      Padding="10,0,10,0"
                                      CurrentItem="{Binding}"
                                      IsEnabled="{Binding IsLoggingIn, Converter={StaticResource NotOperatorValueConverter}}" AutoEdit="True" CommandButtonsVisibility="None" HeaderVisibility="Collapsed"                                       AutoGeneratingField="LoginForm_AutoGeneratingField" Style="{StaticResource LoginDataFormStyle}" /> </StackPanel>

In the above code,
xmlns:local="clr-namespace:ABC.XXX.YYY.Silverlight.Controls"
xmlns:login="clr-namespace:ABC.XXX.YYY.Silverlight.LoginUI"

is showing the above mentioned error.
I googled about the error, they are asking to add a reference.
If I should, where would i get appropriate reference library in my application?
Please help me ASAP.
Any ideas will be greatly appreciated.
Posted

1 solution

If the code of the Silverlight.Controls is defined in another custom assembly you need to add an assembly token (see Mapping to custom assemblies[^]). For instance if the namespaces are defined in the AbcXxxYyySilverlight.dll:

XML
xmlns:local="clr-namespace:ABC.XXX.YYY.Silverlight.Controls;assembly=AbcXxxYyySilverlight"
xmlns:login="clr-namespace:ABC.XXX.YYY.Silverlight.LoginUI;assembly=AbcXxxYyySilverlight"
 
Share this answer
 
Comments
♥…ЯҠ…♥ 19-Sep-12 6:10am    
Here assembly = AbcXxxYyySilverlight is needs to be referenced in my application If am right means where the reference file AbcXxxYyySilverlight.dll dwell? any idea?
Martijn Kok 19-Sep-12 6:51am    
The first question is if the namespaces ABC.XXX.YYY.Silverlight.Controls and .LoginUI are in the same project file as your XAML or in another projectfile/DLL. If they are in the same project file as your XAML. Then the following text won't help and my solution won't solve the problem.

If they are in anonther project file/DLL, then you probably have a refence to it (In the solution explorer look in the folder 'Reference'). The name that shows in the 'Reference' folder is your assembly name. I guess you already have a reference. Otherwise right click on 'Reference' folder. Select 'Add reference...'. Go to the browse tab and browse to the which contains the namespace.

Normally the location of the assembly is not relevant. At least not in WPF. In WPF the DLL's are put in the same directory as your program. I'm not sure how this is in SilverLight, but if I read the documentation from microsoft in the link I provided, then it should not be necessary to include the path to the assembly (see the 2nd note in the 'Mapping to custom assemblies' link)

Hopefully this is of any use.
♥…ЯҠ…♥ 20-Sep-12 5:18am    
They have mentioned as xmlns:local="clr-namespace:ABC.XXX.YYY.Silverlight.Controls" it means that the reference library resides in the same solution uh? 'coz i dont know where the reference library is. I searched in my solution folder and in my local computer. I found nothing, if the thing is like it means i'll ask developer about the missing reference.

It seems that it is a custom reference, if they are not in solution explorer where should i search for? any idea? so that i can search there.
Martijn Kok 20-Sep-12 5:45am    
Maybe I was looking in the wrong direction. You could try to search Google for the error massage. For instance this result shows in a totally different way. Something about a protection against 'assumed' unsafe UNC paths. http://stackoverflow.com/questions/2926378/custom-wpf-namespace-mappings-failing-in-visual-studio-2010. In the question they talk about using drive mappings. I'm not sure if this could apply to the error you get.
♥…ЯҠ…♥ 20-Sep-12 7:13am    
If the namespace name is ABC.XXX.YYY.Silverlight.Controls, solution name is abc, project name is XXX.YYY.Silverlight and Controls is a subdirectory of that project. In that folder only .cs files are available.Is there anything to do with?

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