Every time I add the reference to System.Windows.Interactivity I get the following error. I have completely uninstalled and reinstalled Silverlight 3 to include the sdk, the tools, the toolkit(july 2009) and expression suite 3 a number of times and nothing seems to help. I have looked for this error and can find several references to beta 2 for which the resolutions do not work. Is anyone else seeing this or have any idea on how to fix it. If i remove the reference the problem goes away but I need to use it for some animations. Any help would be greatly appreciated.
Error 1 The "ValidateXaml" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'System.Windows, Version=22.214.171.124, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Windows, Version=126.96.36.199, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'
at System.ModuleHandle.ResolveType(Int32 typeToken, RuntimeTypeHandle* typeInstArgs, Int32 typeInstCount, RuntimeTypeHandle* methodInstArgs, Int32 methodInstCount)
at System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle typeInstantiationContext, RuntimeTypeHandle methodInstantiationContext)
at System.Reflection.Module.ResolveType(Int32 metadataToken, Type genericTypeArguments, Type genericMethodArguments)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, Module decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object attributes, IList derivedAttributes, RuntimeType& attributeType, RuntimeMethodHandle& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.GetCustomAttributes(Module decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes)
at System.Reflection.CustomAttribute.GetCustomAttributes(Assembly assembly, RuntimeType caType)
at System.Reflection.Assembly.GetCustomAttributes(Type attributeType, Boolean inherit)
at System.Attribute.GetCustomAttributes(Assembly element, Type attributeType, Boolean inherit)
at MS.Internal.Xaml.MS.Impl.XamlSystemBinding.AddPairsFromAssembly(XamlSchemaContext schemaContext, Assembly asm, String uri, List`1 pairs)
at MS.Internal.Xaml.MS.Impl.XamlSystemBinding.SearchForXamlNamespace(XamlSchemaContext schemaContext, String uriString, IEnumerable`1 referenceAssemblies)
at MS.Internal.Xaml.XamlSchemaContext.GetXamlNamespace(String xmlns, Assembly localAssembly)
at MS.Internal.Xaml.XamlSchemaContext.GetXamlNamespace(String xmlns)
at MS.MarkupCompiler.ValidationPass.ValidateXaml(String fileName, Assembly assemblies, Assembly callingAssembly, TaskLoggingHelper log, Boolean shouldThrow)
at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult)
It's important to reference it in any project that may be using it. For example, if you define your behavior in:
And then reference it in:
You should add the reference to System.Windows.Interactivity in Project.Main as well.
Sometimes the issue can be with the build box or target system. For things like this, sometimes it's easier to use a local reference you know will get compiled into the XAP. For example, you can create a folder in the project called LIB, drop the DLL in there, and reference it as a relative reference (using the Browse option) rather than referencing it from the GAC.
Let me know if this helps!
Thanks for the reply. To be more clear all i have to do to get the error is add the reference to Interactivity to the Silverlight Application project. Not even use it in code yet. I have tried adding the reference by browsing to it locally as well as using the one in the GAC with no effect. Further more I added the reference to the web project that loads the silverlight control and I still get the error.
Mike - I am getting the exact same thing. The funny thing is that ot works on my development machine but our TFS build server gets the error. Whether I run an automated build or just load it in the IDE on the machine. Literally, all I have to do is reference that assembly and it causes this error. When I remove the reference, it works. Please advise if you are able to resolve this. I will do the same.
I was able to resolve this issue. That System.Windows.Interactivity dll has 5 dependent assemblies:
from the location: C:\Program Files\Reference Assemblies\Microsoft\Framework\Silverlight\v3.0 I had to add these to the GAC using the gacutil -i utility. Once I did that, the compile worked. For some reason, they are not gac'd by default.
The error message you provided says project missing assembly reference to System.Windows dll
Please check if your project referenced System.Windows, and its version is 188.8.131.52. If your version isn't 184.108.40.206, it means you installed old silverlight sdk.
The latest silverlight tool can be downloaded from here