首页 文章

.NET 4.5打破了一个应用程序

提问于
浏览
1

我有一个适用于.NET 4.0的.NET应用程序 - 虽然该应用程序公开了它的app.config但我没有它的源代码

但 .

我已经安装了Visual Studio 2012和.NET 4.5 . 突然,.NET 4.0应用程序在某些地方抛出了异常 - 我用Reflector分析了在应用程序的WPF部分中的InitializeComponent()中抛出了异常 .

Uri resourceLocator = new Uri("/Some.Assembly;someuri/someuri/somefile.xaml", UriKind.Relative);

例外是:

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)

不幸的是,我无法判断是否有任何内部异常 .

如果我卸载.NET 4.5并安装.NET 4.0,则不会抛出异常,但我无法使用VS 2012 .

我试图将这些行添加到app.config中,但没有成功 .

<startup useLegacyV2RuntimeActivationPolicy="true" >
    <supportedRuntime version="v4.0.30319" sku=".NETFramework,Version=v4.0" />
    <requiredRuntime version="v4.0.30319" />
</startup>

如何强制应用程序仅使用4.0和4.0?它甚至可能吗? .NET 4.5与4.0程序集混合在一起吗?

3 回答

相关问题