VS 2010: Exceptions when a project XAML file that includes System.Windows.Interactivity opens

My problem is this: I added a reference to the "System.Windows.Interactivity" assembly to my WPF project (.NET 4, VS2010) to implement the behavior. The whole solution is built and works. The desired functionality that was implemented as behavior works great.

But as soon as I open the XAML file (only the XAML code is displayed, the designer is not displayed), I get two exceptions in the error window:

First exception: "Fixed System.IO.FileLoadException on" SomeFile.xaml ": failed to load file or assembly" System.Windows.Interactivity, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35 "or one of its dependencies not supported. (Exception from HRESULT: 0x80131515).

The second exception: "Failed to load the file or assembly" System.Windows.Interactivity, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35 "or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

Exceptions occur even if I open a XAML file that does not contain new behavior. Despite these exceptions, the solution is built and launched. If I close the XAML file, the exceptions will disappear.

A similar problem is described at http://connect.microsoft.com/VisualStudio/feedback/details/648819/visual-studio-2010-silverlight-designer-crash . But this is for SL4.

How to remove these exceptions? What is wrong here?

Thanks Florian

+4
source share
2 answers

I know this is a pretty old post, but I spent several hours struggling with this same mistake tonight. What drove me crazy was that the same solution worked very well for me about 6 months ago, then I passed it to my client and they checked it in VSS. They returned to me the (slightly modified) codebase that they secured, and this really manifested itself in the fact that Intellisense stopped working inside the XAML file.

After all, this trick for me was something I had never encountered before. I went to the physical location of the System.Windows.Interactivity.dll file, and on the General tab at the bottom in the Security section was this little nugget:

"This file comes from another computer and may be locked to protect this computer."

Next to this message was the "Unblock" button. I clicked on this button, reloaded my project, and the error immediately disappeared, and Intellisense immediately started working in my XAML file.

+3
source

There was the same problem. After the date, she stopped working. When I checked system.windows.interactivity.dll with the file properties, I found open with NUnit. Then I remembered that I recently installed NUnit. I just changed openwith using the VS selector (also set as always) and restarted VS. Hooray. The exception is gone ....

I do not know how openwith affects the VS IDE. but earned again ... return to track: D

+1
source

Source: https://habr.com/ru/post/1387049/


All Articles