J’ai écrit une extension pour Visual Studio 2013. À cause du bogue sanglant de ComboBox , j’ai dû inclure System.Windows.Interactivity à mon projet. Pour append plus de détails:
Effet: Lorsqu’une partie de l’éditeur contenant les affichages mentionnés de ComboBox
, j’obtiens immédiatement une exception:
Une exception de première chance du type ‘System.Windows.Markup.XamlParseException’ s’est produite dans PresentationFramework.dll
Informations complémentaires: Impossible de charger le fichier ou l’assembly ‘System.Windows.Interactivity, PublicKeyToken = 31bf3856ad364e35’ ou l’une de ses dépendances. Le système ne peut pas trouver le fichier spécifié.
- Une méthode void async crée-t-elle un nouveau thread à chaque appel?
- Quelle est la bonne façon d’append dynamicment un nombre indéterminé de clauses à une requête Linq 2 Sql?
- Comment annuler un téléchargement de fichier WCF à partir de la méthode côté serveur
- Qu’est-ce que la version 255.255.255.255 pour les fichiers winmd indique?
- LINQ to Entities ne reconnaît pas la méthode ‘System.Ssortingng ToSsortingng (Int32)’
J’utilise l’extension dans l’instance expérimentale et le dossier:
C:\Users\\AppData\Local\Microsoft\VisualStudio\12.0Exp\Extensions\\\1.0
contient System.Windows.Interactivity.dll, mais pour une raison quelconque, il semble ne pas être vu par l’EDI.
Ce qui est encore plus étrange, c’est que j’utilise d’autres paquets supplémentaires, comme IronPython, et ils ne m’ont jamais causé de tels problèmes.
Comment puis-je résoudre ce problème?
Edit: En réponse aux commentaires
En fait, l’ FusionLog
InnerException contient un champ appelé FusionLog
, qui contient les éléments suivants:
=== Pre-bind state information === LOG: DisplayName = System.Windows.Interactivity, PublicKeyToken=31bf3856ad364e35 (Partial) WRN: Partial binding information was supplied for an assembly: WRN: Assembly Name: System.Windows.Interactivity, PublicKeyToken=31bf3856ad364e35 | 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:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/ LOG: Initial PrivatePath = NULL Calling assembly : (Unknown). === LOG: This bind starts in default load context. LOG: Using application configuration file: C:\Users\\AppData\Local\Temp\devE4FC.tmp LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\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:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/System.Windows.Interactivity.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/System.Windows.Interactivity/System.Windows.Interactivity.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/PublicAssemblies/System.Windows.Interactivity.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/PublicAssemblies/System.Windows.Interactivity/System.Windows.Interactivity.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/PrivateAssemblies/System.Windows.Interactivity.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/PrivateAssemblies/System.Windows.Interactivity/System.Windows.Interactivity.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/System.Windows.Interactivity.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/System.Windows.Interactivity/System.Windows.Interactivity.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/CommonExtensions/Platform/Debugger/System.Windows.Interactivity.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/CommonExtensions/Platform/Debugger/System.Windows.Interactivity/System.Windows.Interactivity.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/PrivateAssemblies/DataCollectors/System.Windows.Interactivity.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/PrivateAssemblies/DataCollectors/System.Windows.Interactivity/System.Windows.Interactivity.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/PrivateAssemblies/DataCollectors/x86/System.Windows.Interactivity.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/PrivateAssemblies/DataCollectors/x86/System.Windows.Interactivity/System.Windows.Interactivity.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/System.Windows.Interactivity.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/System.Windows.Interactivity/System.Windows.Interactivity.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/PublicAssemblies/System.Windows.Interactivity.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/PublicAssemblies/System.Windows.Interactivity/System.Windows.Interactivity.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/PrivateAssemblies/System.Windows.Interactivity.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/PrivateAssemblies/System.Windows.Interactivity/System.Windows.Interactivity.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/System.Windows.Interactivity.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/System.Windows.Interactivity/System.Windows.Interactivity.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/CommonExtensions/Platform/Debugger/System.Windows.Interactivity.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/CommonExtensions/Platform/Debugger/System.Windows.Interactivity/System.Windows.Interactivity.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/PrivateAssemblies/DataCollectors/System.Windows.Interactivity.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/PrivateAssemblies/DataCollectors/System.Windows.Interactivity/System.Windows.Interactivity.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/PrivateAssemblies/DataCollectors/x86/System.Windows.Interactivity.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/PrivateAssemblies/DataCollectors/x86/System.Windows.Interactivity/System.Windows.Interactivity.EXE.
Mais il y a plus. J’ai utilisé ProcMon pour vérifier, où Visual Studio cherche cette DLL et remarqué à la fin:
08:46:46,7508050 devenv.exe 7544 CreateFile C:\Users\\AppData\Local\Microsoft\VisualStudio\12.0Exp\Extensions\\\1.0\Lib\System.Windows.Interactivity NAME NOT FOUND Desired Access: Read Atsortingbutes, Disposition: Open, Options: Open Reparse Point, Atsortingbutes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a 08:46:46,7509231 devenv.exe 7544 CreateFile C:\Users\\AppData\Local\Microsoft\VisualStudio\12.0Exp\Extensions\\\1.0\Lib\System.Windows.Interactivity.EXE NAME NOT FOUND Desired Access: Read Atsortingbutes, Disposition: Open, Options: Open Reparse Point, Atsortingbutes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a 08:46:46,7510379 devenv.exe 7544 CreateFile C:\Users\\AppData\Local\Microsoft\VisualStudio\12.0Exp\Extensions\\\1.0\Lib\System.Windows.Interactivity.DLL NAME NOT FOUND Desired Access: Read Atsortingbutes, Disposition: Open, Options: Open Reparse Point, Atsortingbutes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
Le dossier Lib contient quelques modules Python que j’utilise (à des fins de script, car j’utilise IronPython). Et, ironiquement, l’assemblée est dans le
C:\Users\\AppData\Local\Microsoft\VisualStudio\12.0Exp\Extensions\\\1.0\
dossier (sans Lib). Mais Visual Studio omet dans sa recherche malgré le fait, c’est l’endroit le plus naturel pour effectuer une recherche (car la demande de assembly réside également dans cet ensemble).
Ceci est une solution de contournement pour ce problème. Je n’aime pas ça, mais ça marche 🙂
La solution consiste à charger de force l’assembly à partir du code source, de sorte que PresentationFramework n’aura pas à le rechercher lors de l’parsing du fichier XAML. Par exemple:
private static void LoadSystemWindowsInteractivity() { // HACK: Force load System.Windows.Interactivity.dll from plugin's // directory typeof(System.Windows.Interactivity.Behavior).ToSsortingng(); } static MyEditorFactory() { LoadSystemWindowsInteractivity(); }
J’ai eu le même problème. La solution ci-dessous fonctionne pour moi.
[$ RootKey $ \ BindingPaths {un_guid}]
“$ PackageFolder $” = “”