Click here to Skip to main content
12,889,448 members (49,143 online)
Rate this:
Please Sign up or sign in to vote.
See more: XML HTML Silverlight
Hi friends,

I am trying to build an application, where i was ended up with the following 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
    d:DataContext="{d:DesignInstance Type=login:LoginInfo}">
            <RowDefinition Height="Auto"/>
<local:BusyIndicator x:Name="busyIndicator" BusyContent="{Binding Path=ApplicationStrings.BusyIndicatorLoggingIn, Source={StaticResource ResourceWrapper}}" IsBusy="{Binding IsLoggingIn}">
     <StackPanel Orientation="Vertical">
         <local:CustomDataForm x:Name="loginForm"
                                      IsEnabled="{Binding IsLoggingIn, Converter={StaticResource NotOperatorValueConverter}}" AutoEdit="True" CommandButtonsVisibility="None" HeaderVisibility="Collapsed"                                       AutoGeneratingField="LoginForm_AutoGeneratingField" Style="{StaticResource LoginDataFormStyle}" /> </StackPanel>

In the above code,

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 18-Sep-12 21:09pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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:

rk_prabakar 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.
rk_prabakar 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. In the question they talk about using drive mappings. I'm not sure if this could apply to the error you get.
rk_prabakar 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?
Martijn Kok 20-Sep-12 7:34am
I think I haven't explained it well enough. I wasn't talking about a folder in the Windows Explorer (as being part of Windows). I was talking abou the View in Visual Studio which is called Solution Explorer.

You can select it in Visual Studio through the menu: ViewSolution Explorer. It the screen that shows the projects in your solution and the files in your project. The you can find the 'Reference' folder.
rk_prabakar 20-Sep-12 8:51am
Yeah buddy, i searched there and also in folder explorer can't find a thing.
Martijn Kok 20-Sep-12 9:42am
Then the ABC.XXX.YYY.Silverlight is local and the adding of assembly=(...) won't solve it.

I'm not sure if I can be of any assistance, because I can't reproduce the error. Have you seen the link in a previous reply (the one to If I read it well there were others having the exactly the same error message with a local namespace. They describe a not so common combination which produces the error.

I hope you'll find the cause of the error.
rk_prabakar 21-Sep-12 1:44am
By colleague ask me to check for build order.
Is there something to do with it? I checked with that, but that too stucks.
Do you have any idea on that?
Martijn Kok 21-Sep-12 2:04am
Unfortunately screenshots are not supported. If your colleague is talking about a build order that would suggest that there are more than one project in your solution.

I sometimes build all the projects one by one in the right order, but I don't think it will solve the problem. But you could try.

Maybe there is one otherway. Intellisense normally puts the right namespace code in your XAML. Have you typed it manually or have you used intellisense. What you could do to test it, is defined a new namespace (for instance xmlns:test). As soon as you are starting to type "clr-namespace" intellisense will start. Select the namespace you need from that list. There are to possibilities.

1) the namespace (for instance ABC.XXX.YYY.Silverlight.Controls) is there. Select it. If it doesn't include a ;assembly= then it is not needed. If it is there, it is needed, and you should replace it with the xmlns:local
2) if you can't find the namespace in the list something else might be wrong.
rk_prabakar 21-Sep-12 6:56am
You are right, i tried it before but it didnt worked for me. That why i came to this forum
Martijn Kok 21-Sep-12 7:38am
When I google the error message (at least the first sentence) I keep finding another reason for this error.

Is your code on your local hard drive or on a network drive? If it is on the network drive you might be interested in the above link. There is a mention how you could configure Visual Studio to trust network drives.

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

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170424.1 | Last Updated 19 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100