WPF自定义控件构造函数仅在clean - rebuild - run之后抛出异常

时间:2014-10-07 11:46:47

标签: c# .net wpf visual-studio-2012

我们在.NET 4.5版本的WPF中使用了一些自定义控件。

只有在我们清理,重建和运行应用程序时才会出现此问题。如果我们只是清理并运行应用程序,它可以正常工作。控件与主应用程序位于同一项目中。

我们在控件的InitializeComponent方法中得到以下io异常:

"Cannot locate resource 'controls/customcontrol.xaml'"

堆栈追踪:

at MS.Internal.AppModel.ResourcePart.GetStreamCore(FileMode mode, FileAccess access)
at System.IO.Packaging.PackagePart.GetStream(FileMode mode, FileAccess access)
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at namespace.controls.customcontrol.InitializeComponent()
at namespace.controls.customcontrol..ctor() 

2012年和2013年版本的Visual Studio都出现了这个问题。

0 个答案:

没有答案