Question

Every once in a while I get compiler exceptions in Blend for Visual Studio. Everything is compiling and working wonderfully, then suddenly BAM! I get compiler errors telling me that objects don't exist in a specific namespace WHEN THEY DO. I have to play with cleaning and rebuilding and closing and reopening Blend for a bout an hour before they go away. My libraries are all up to date and everything is otherwise fine. Does no one else have this happen to them? Please, I want it to stop it is an enormous time killer.

I get the compiler errors in Visual Studio as well.

Thanks.

Updates

For instance,

Error 5 The property 'DesignWidth' does not exist in XML namespace 'http://schemas.microsoft.com/expression/blend/2008'. Line 15 Position 5. C:\MyPath\MyControl.xaml 15 5 EasyBuilder

As far as I know, DesignWidth is does very much exist in that namespace.

The XAML (Not that it will help you any)

<UserControl x:Name="UserControl" x:Class="EasyBuilder.MainControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:ignore="http://www.ignore.com"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" 
             xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" 
             xmlns:surface="http://schemas.microsoft.com/surface/2008" 
             xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
             xmlns:gif="http://wpfanimatedgif.codeplex.com"
             xmlns:local="clr-namespace:EasyBuilder"
             xmlns:res="clr-namespace:EasyBuilder.Infrastructure.Resources"
             xmlns:system="clr-namespace:System;assembly=mscorlib"
             d:DesignWidth="640" d:DesignHeight="480">
    <UserControl.Resources>
        <res:MainViewStrings x:Key="LocalStrings" />
    </UserControl.Resources>

    <UserControl.DataContext>
        <Binding Path="Main" Source="{StaticResource Locator}"/>
    </UserControl.DataContext>

    <Grid x:Name="LayoutRoot" Background="{DynamicResource PageBackgroundBrush}">
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="OpenSelectionStateGroup">
                <VisualStateGroup.Transitions>
                    <VisualTransition GeneratedDuration="0:0:0.15">
                        <VisualTransition.GeneratedEasingFunction>
                            <CircleEase EasingMode="EaseOut"/>
                        </VisualTransition.GeneratedEasingFunction>
                    </VisualTransition>
                </VisualStateGroup.Transitions>
                <VisualState x:Name="SelectionClosedState"/>
                <VisualState x:Name="SelectionOpenedState">
                    <Storyboard>
                        <BooleanAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.IsHitTestVisible)" Storyboard.TargetName="OpenFileSelection">
                            <DiscreteBooleanKeyFrame KeyTime="0" Value="False"/>
                        </BooleanAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="CloseFileSelection">
                            <EasingDoubleKeyFrame KeyTime="0" Value="1"/>
                        </DoubleAnimationUsingKeyFrames>
                        <BooleanAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.IsHitTestVisible)" Storyboard.TargetName="CloseFileSelection">
                            <DiscreteBooleanKeyFrame KeyTime="0" Value="True"/>
                        </BooleanAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="OpenFileSelection">
                            <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="FileSelectionShadow">
                            <EasingDoubleKeyFrame KeyTime="0" Value="12.5"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="FileSelection">
                            <EasingDoubleKeyFrame KeyTime="0" Value="450"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="FileSelectionControl">
                            <EasingDoubleKeyFrame KeyTime="0" Value="1"/>
                        </DoubleAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <Frame x:Name="ContentFrame" Margin="0,0,100,0" Grid.ColumnSpan="2" NavigationUIVisibility="Hidden"/>
        <Grid x:Name="FileSelection" Grid.Column="1" Width="100" Background="{DynamicResource AsideSectionBackgroundBrush}">
            <Border x:Name="FileSelectionShadow" Width="12.5" HorizontalAlignment="Left">
                <Border.Background>
                    <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                        <GradientStop Color="#3F000000" Offset="0"/>
                        <GradientStop Color="#00000000" Offset="1"/>
                    </LinearGradientBrush>
                </Border.Background>
            </Border>
            <Button x:Name="OpenFileSelection" Template="{DynamicResource InvisibleButtonTemplate}" HorizontalContentAlignment="Right" Panel.ZIndex="1" Margin="0">
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="Click">
                        <ei:GoToStateAction StateName="SelectionOpenedState"/>
                    </i:EventTrigger>
                </i:Interaction.Triggers>
                <TextBlock TextWrapping="Wrap" Text="{Binding OpenActionText, Mode=OneWay, Source={StaticResource LocalStrings}}"  Margin="0,0,23,0" Style="{DynamicResource AsideSectionLabel}"/>
            </Button>
            <local:FileSelectionView x:Name="FileSelectionControl" d:LayoutOverrides="Width" Opacity="0" DataContext="{Binding Files, Mode=OneWay}"/>
        </Grid>
        <Button x:Name="CloseFileSelection" Template="{DynamicResource InvisibleButtonTemplate}" IsHitTestVisible="False" Opacity="0" Margin="0" d:IsHidden="True">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="MouseEnter">
                    <ei:GoToStateAction StateName="SelectionClosedState"/>
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </Button>
        <Border x:Name="UserMessage" Background="#BF000000" Visibility="{Binding UserMessenger.IsShowingMessage, Converter={StaticResource BooleanToVisibilityConverter}, Mode=OneWay}" Grid.ColumnSpan="2">
            <Border VerticalAlignment="Center" Style="{DynamicResource UserMessageStyle}" Background="#FFE2E2E2" BorderBrush="{x:Null}" BorderThickness="0" MaxWidth="800" HorizontalAlignment="Center" MinWidth="400">
                <Border.Effect>
                    <DropShadowEffect Opacity="0.5" ShadowDepth="10"/>
                </Border.Effect>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <TextBlock TextWrapping="Wrap" Text="{Binding UserMessenger.MessageText, Mode=OneWay}" Margin="0,0,0,10" HorizontalAlignment="Center" MinHeight="58" Style="{DynamicResource TextBlockBase}"/>
                    <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
                        <Border x:Name="OKAction" Style="{DynamicResource ButtonBorderStyle}" Margin="15,0,0,0" Height="50" VerticalAlignment="Top" HorizontalAlignment="Right" Visibility="{Binding UserMessenger.ShowOkButton, Converter={StaticResource BooleanToVisibilityConverter}, Mode=OneWay}">
                            <Border.Effect>
                                <DropShadowEffect Opacity="0.33"/>
                            </Border.Effect>
                            <Button Template="{DynamicResource FlatButtonTemplate}" Command="{Binding UserMessenger.CloseCommand, Mode=OneWay}" Margin="0">
                                <Button.CommandParameter>
                                    <system:String>OK</system:String>
                                </Button.CommandParameter>
                                <Image Height="44" Source="Skins/Images/OK.png"/>
                            </Button>
                        </Border>
                        <Border x:Name="CancelAction" Style="{DynamicResource ButtonBorderStyle}" Margin="15,0,0,0" Height="50" VerticalAlignment="Top" HorizontalAlignment="Right" Visibility="{Binding UserMessenger.ShowCancelButton, Converter={StaticResource BooleanToVisibilityConverter}, Mode=OneWay}">
                            <Border.Effect>
                                <DropShadowEffect Opacity="0.33"/>
                            </Border.Effect>
                            <Button Template="{DynamicResource FlatButtonTemplate}" Command="{Binding UserMessenger.CloseCommand, Mode=OneWay}" Margin="0">
                                <Button.CommandParameter>Cancel</Button.CommandParameter>
                                <Image Height="44" Source="Skins/Images/Cancel.png"/>
                            </Button>
                        </Border>
                    </StackPanel>
                </Grid>
            </Border>
        </Border>
    </Grid>
</UserControl>
Was it helpful?

Solution

You need to mark the blend design time namespace as Ignorable or switching between blend and visual studio will not work.

See Getting an error switching back and forth between Blend and VS

Make sure the following is in your XAML namespace declarations

xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top