Search code examples
wpfc#-4.0.net-4.0wpftoolkitvisualstatemanager

VisualStateManager present both in WPF Toolkit and PresentationFramework - How to resolve


I have to use VisualStateManager class in my WPF window, but as I have referenced the assemblies of both WPF Toolkit and PresentationFramework.dll in my project, C# is not able to resolve the VisualStateManager class and gives the compile error like - "The type exists in both 'PresentationFramework.dll' and 'WPFToolkit.dll'" and I am not able to proceed.

How to tell C# compiler to use VisualStateManager class from either of the assemblies and get the project to compile successfully?


Solution

  • Since the .NET4.0, the WPF Toolkit has been included in the framework. You should be able to remove WPF Toolkit, update some namespaces and the application still compile.

    This is an approach we have taken in a project where we recently upgraded from .NET3.5 to .NET 4.0

    Best regards,