开发者

Second WPF project in one solution gives log4Net error

开发者 https://www.devze.com 2022-12-28 02:59 出处:网络
I am totally confused with the following error. I have my application which works perfectly fine and uses log4net for logging.

I am totally confused with the following error.

I have my application which works perfectly fine and uses log4net for logging.

I will now be implementing my own updater system. And I want it to be part of my solution.

I have added a new WPF Application to my Solution and when I try to edit the main window or any other window in that project I get the following error message:

/Microsoft.VisualStudio.Xaml;Component/MS/Internal/Designer/PropertyEditing/Resources/StylesCore.Constants.xaml' value cannot be assigned to property 'Source' of object 'System.Windows.ResourceDictionary'. 
Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821' or one of its dependencies. 
The system cannot find the file specified.  Error at object 'ResourceDictionary_2' in markup file 'Microsoft.VisualStudio.Xaml;componen开发者_开发百科t/MS/Internal/Designer/PropertyEditing/Resources/StylesCore.xaml.

Anyone have any suggestions?

EDIT: The designer works when i reference log4net.dll in the new project, but why do i need to reference it in every project?


I am not exactly sure why this happens, but changing the TargetFramework of the WPF project to ".NET Framework 4" from ".NET Framework 4 Client Profile"(which is the default in the VS2010 WPF project template) fixed the same problem for me. I guess this happens because the dll signing(strong naming) of Log4Net dll.


If you aren't using the log4net library in the new project, simply edit the ResourceDictionary and remove the reference to the log4net library. It sounds like you are using one library for both WPF projects and the library has some reference to log4net. That is where the crossover seems to be coming from.

0

精彩评论

暂无评论...
验证码 换一张
取 消