I have a Silverlight 3 project which compiles and runs fine when compiled on a development machine. On our TFS environment with Silverlight 3 and the Silverlight 3 SDK installed, I get the following error:
C:\Users\tfsservice\AppData\Local\Temp\\Release\Sources\Source\Trunk\Themes\
UserDatesStyles.xaml(63,47,63,47):
error : The property ‘Command’ does
not exist on the type ‘Button’ in the
XML namespace
‘clr-namespace:Mvvm.Input;assembly=Mvvm’.
More information: Command is an attached property on Button that is part of the Mvvm assembly in the Mvvm.Input namespace.
Am I missing something on my TFS server? I would have thought that all I would require is the SDK. If I edit this project and change the ValidateXAML element to false, the TFS server does compile properly. However, this is obviously not the ideal situation.
Here is the XAML that causes it:
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:commands="clr-namespace:MvvmFramework.Input;assembly=MvvmFramework"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Style x:Key="UserDatesStyle" TargetType="controls:UserDates">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:UserDates">
<Grid Height="600" Width="800" d:DesignWidth="800" d:DesignHeight="600">
<Button Content="Previous"
commands:CommandBinder.Command="{Binding PreviousPageCommand}"
Margin="0,0,10,0"
Style="{StaticResource PrevBtn}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
I managed to fix it on our solution… drove me nuts, we could get away with disabling xaml validation on the build server by passing /property:ValidateXaml=false to our build script. However it became a showstopper when we couldn’t build the project in blend. Blend doesn’t follow the same build process as VS, perhaps it just shells out to msbuild.
I added this to Microsoft.Silverlight.Common.targets just above the call to ValidateXaml:
… it looked like the ReferenceAssemblies were not correctly pulling in the correct references to the other silverlight projects, ValidateXaml seems to create an app domain and load in all those references to check if the types exist…. Anyway cut a long story short ValidateXaml wasnt getting passed the correct references as noted in visual studio thus we suspect it failed.
We believed it to be something corrupt in our configuration, we fixed it in the end by simply removing all offending projects getting the build to run from the cmd line (i.e. msbuild.exe) and VS, then adding each project back. After it was all done we noticed some differences in the .sln, the problem code had a strange ‘postProject’ ProjectSection under one of our Silverlight projects…. but its largely one of those ‘you’ll never really know’, the .csproj’s seemed to be the same.
Remove the projects and add them back, worked for us. We suspect a corrupt solution file.