Problem using System.Windows.Interactivity


  • 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.

    Mike Wasmer

     Error 1 The "ValidateXaml" task failed unexpectedly.
    System.IO.FileNotFoundException: Could not load file or assembly 'System.Windows, Version=, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified.
    File name: 'System.Windows, Version=, 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.Silverlight.Build.Tasks.ValidateXaml.XamlValidator.Execute()
       at Microsoft.Silverlight.Build.Tasks.ValidateXaml.XamlValidator.Execute()
       at Microsoft.Silverlight.Build.Tasks.ValidateXaml.Execute()
       at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult)




    Thursday, October 15, 2009 2:33 PM


All replies

  • 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!

    Thursday, October 15, 2009 3:10 PM
  • Jeremy,

    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.



    Thursday, October 15, 2009 4:52 PM
  • 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. 

    Friday, October 16, 2009 10:36 AM
  • 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. 


    Friday, October 16, 2009 11:11 AM
  • Thanks. I tried that and I still have the same issue.

    Tuesday, October 20, 2009 12:56 PM
  • Hi,

    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 If your version isn't, it means you installed old silverlight sdk.

    The latest silverlight tool can be downloaded from here


    Wednesday, October 21, 2009 10:38 PM
  • Thanks I had checked that first thing based on the error and it is correct.

    Thursday, October 22, 2009 9:52 AM
  • Update I was finally able to get this to work by registering the mscorlib dll in the GAC.

    Thursday, October 22, 2009 10:05 AM
  • You can also install Expression Blend and reference the library at C:\Program Files\Microsoft SDKs\Expression\Blend 3\Interactivity\Libraries\Silverlight\System.Windows.Interactivity.dll

    Thursday, December 24, 2009 5:55 PM
  • I was also having this problem and was also able to solve it by installing  mscorlib dll version in the GAC

    Tuesday, January 26, 2010 9:29 AM
  • i am having similar problem like

    Could not load type 'System.Action' from assembly 'mscorlib, Version=, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.

    Please help me how can i register mscorlib in GAC??? I am using Silverlight 4 RC2

    Thursday, April 22, 2010 1:22 AM
  • Ups. wrong place to post...

    Friday, June 22, 2012 3:22 AM