Мой проект WPF использует клиентский профиль .NET 4. Когда я добавляю
<ResourceDictionary Source="/PresentationFramework.Aero;component/themes/Aero.NormalColor.xaml" />
до <Application.Resources>
Я получаю это исключение при запуске программы в режиме отладки (в режиме выпуска программа молча вылетает):
Первое исключение типа
«System.Windows.Markup.XamlParseException» произошло в
PresentationFramework.dll
Дополнительная информация: 'Установить свойство
'System.Windows.ResourceDictionary.Source' вызвал исключение. ' Линия
номер «14» и позиция строки «14».
Когда я устанавливаю для свойства PresentationFramework.Aero свойство «Копировать локально» значение true, все работает и исключение исчезает.
«Копировать локально» помещает копию PresentationFramework.Aero в мою выходную директорию, и поэтому мне нужно включить ее в мой проект установки. Почему это необходимо? В соответствии с MSDN PresentationFramework.aero включен в клиентский профиль .NET Framework 4.0 и, следовательно, в GAC. Мне неудобно развертывать файл фреймворка вместе с моим приложением.
Udate:
Как предложил Ханс Пассант, я проверил, что каталог PresentationFramework.Aero существует в C:\windows\microsoft.net\assembly\gac_msil
. Затем я использовал fuslogvw.exe для создания следующего журнала, созданного при запуске моего приложения «SetACL Studio.exe» без присутствия PresentationFramework.Aero.dll в каталоге приложения. Интересно, что загрузчик даже не проверяет GAC . Почему?
*** Assembly Binder Log Entry (18.11.2011 @ 17:13:27) ***
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable D:\Daten\Helge\Programmierung\SetACL Studio\Source\Bin\Debug\SetACL Studio.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = HKT520\Helge
LOG: DisplayName = PresentationFramework.Aero, Culture=neutral
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: PresentationFramework.Aero, Culture=neutral | Domain ID: 1
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///D:/Daten/Helge/Programmierung/SetACL Studio/Source/Bin/Debug/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = SetACL Studio.exe
Calling assembly : PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\Daten\Helge\Programmierung\SetACL Studio\Source\Bin\Debug\SetACL Studio.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///D:/Daten/Helge/Programmierung/SetACL Studio/Source/Bin/Debug/PresentationFramework.Aero.DLL.
LOG: Attempting download of new URL file:///D:/Daten/Helge/Programmierung/SetACL Studio/Source/Bin/Debug/PresentationFramework.Aero/PresentationFramework.Aero.DLL.
LOG: Attempting download of new URL file:///D:/Daten/Helge/Programmierung/SetACL Studio/Source/Bin/Debug/PresentationFramework.Aero.EXE.
LOG: Attempting download of new URL file:///D:/Daten/Helge/Programmierung/SetACL Studio/Source/Bin/Debug/PresentationFramework.Aero/PresentationFramework.Aero.EXE.
LOG: All probing URLs attempted and failed.
Обновление 2:
Это вывод gacutil:
C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin>gacutil.exe /l presentationframework.aero
Microsoft (R) .NET Global Assembly Cache Utility. Version 3.5.30729.1
Copyright (c) Microsoft Corporation. All rights reserved.
The Global Assembly Cache contains the following assemblies:
presentationframework.aero, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL
Number of items = 1