I have a .NET app which works well with .NET 4.0 – I don’t have its source though the app exposes its app.config
But.
I have installed the Visual Studio 2012 with .NET 4.5. Suddenly, the .NET 4.0 application is throwing exceptions at some places – I analyzed with Reflector that the exceptions are thrown in InitializeComponent() in the WPF part of the application.
Uri resourceLocator = new Uri("/Some.Assembly;someuri/someuri/somefile.xaml", UriKind.Relative);
And the exception is:
The invocation of the constructor on type 'DevExpress.Xpf.Grid.GridControl' that matches the specified binding constraints threw an exception.
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
Unfortunately I’m unable to tell if there’s any inner exception.
If I uninstall .NET 4.5 and install .NET 4.0, the exceptions are not thrown but I can’t work with VS 2012.
I’ve tried to add these lines into the app.config but without success.
<startup useLegacyV2RuntimeActivationPolicy="true" >
<supportedRuntime version="v4.0.30319" sku=".NETFramework,Version=v4.0" />
<requiredRuntime version="v4.0.30319" />
</startup>
How does one force an app to use 4.0 and 4.0 only? Is it even possible? Is the .NET 4.5 somehow mingling with the 4.0 assemblies?
Take a look at this article. http://www.west-wind.com/weblog/posts/2012/Mar/13/NET-45-is-an-inplace-replacement-for-NET-40. It describes what is actually happening when you install .net 4.5
You may ask the vendor of the program to recompile it using the latest version of DevExpress controls.