11

Create a new WPF project called: xmlnsError

Add a reference to PresentationFramework.Aero

Add this ResourceDictionary to App.xaml:

<ResourceDictionary Source="/PresentationFramework.Aero,Version=4.0.0.0,Culture=Neutral,PublicKeyToken=31bf3856ad364e35,processorArchitecture=MSIL;component/themes/Aero.NormalColor.xaml"/>

Doing so shows a warning of

Assembly 'PresentationFramework.Aero,Version=4.0.0.0,Culture=Neutral,PublicKeyToken=31bf3856ad364e35,processorArchitecture=MSIL' is not referenced by this project

I've double-checked to make sure that the version is actually 4.0.0.0 and the PublicKeyToken is actually 31bf3856ad364e35 by navigating to C:\Windows\Microsoft.NET\assembly\GAC_MSIL\PresentationFramework.Aero as well as checking the GAC at runtime by looking at the AssemblyInfo from AppDomain.CurrentDomain.GetAssemblies();

Is there any way to fix this warning? This a follow-up question to WPF Windows 8 Compatability Issue

Community
  • 1
  • 1
Shaku
  • 670
  • 1
  • 8
  • 19
  • Have you added a reference to the project? A common location for this DLL would be: C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF – Xcalibur37 Mar 25 '14 at 00:24
  • Yes. That was the second step I mentioned in the question -- adding it manually or adding it from the assemblies is the same thing. – Shaku Mar 25 '14 at 02:08
  • I've had similar problem, solved it by adding the assembly to another project and then building it. After that problem disappeared. HTH – XAMlMAX Mar 25 '14 at 08:03
  • Didn't do anything either, sadly. – Shaku Mar 25 '14 at 09:55
  • As I was writing in other question of yours, I truly think this is a designer analysis limitation and you can ignore this particular warning as long as it actually works fine. I've also uploaded proof of concept in your original question (though would love to see if anybody can actually get rid of this warning properly) – Maverik Mar 25 '14 at 12:44
  • Are all your projects using the same .NET versions? Are they using the same build configurations (x86/x64/etc)? – Tim Hansson May 22 '15 at 20:33

3 Answers3

2

Normally, you do not need to specify the assembly version, culture, and key when using resources from an assembly. The following example compiles without any warnings:

<ResourceDictionary Source="/PresentationFramework.Aero;component/themes/Aero.NormalColor.xaml"/>
MattCat
  • 44
  • 1
  • 3
    It does compile, true. But it does change something, in my particular case the resulting WPF-Application even crashed on startup on other systems. – Simon D. Sep 22 '14 at 09:17
  • Great solution, worked great. Thanks a bunch MattCat! – TripleAntigen Jan 29 '16 at 05:22
  • This probably will only work if you have 'copy local' set on the PresentationFramework.Aero refernce - and doing that is generally not correct, as you shouldn't distribute parts of the framework with your application. A better explanation is here: https://stackoverflow.com/a/8185946/3195477 – StayOnTarget Jan 13 '22 at 21:22
0

Apparently (MSDN Forums), there's a metadata-only version of Aero and the right one is in C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF. I don't have any way of checking if there's been a similar problem/solution for any of the .NET 4.5 versions, at the moment.

John C
  • 1,931
  • 1
  • 22
  • 34
0

I had a very similar problem when trying to use PresentationFramework.Classic. I got the same warning even after triple checking all the assembly details were correct (which were copy/pasted from dotPeek anyway).

However, it seems that this warning may be spurious because the compiled application works just fine. I was testing on a "clean" virtual machine image where I am confident that nothing has polluted the environment e.g. an unwanted local copy of PresentationFramework.Classic.dll is not in the application folder.


Also, as noted by @Maverik in a comment:

I truly think this is a designer analysis limitation and you can ignore this particular warning as long as it actually works fine.

which seems to be the same conclusion.

https://stackoverflow.com/a/8185946/3195477

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81