7 out of 27 rated this helpful - Rate this topic

How to: Use an Assembly from the Web in Visual Studio

Visual Studio 2010

Updated: July 2010

This topic shows how to use an assembly that you download from the Web in Visual Studio. For security reasons, Visual Studio blocks you from loading a Web assembly in the Choose Items and Add Reference dialog boxes.

Caution noteCaution

Unblocking an assembly that is downloaded from the Web gives it Full Trust. Only unblock assemblies that you trust.

To unblock a Web assembly

  1. Close Visual Studio.

  2. Using Windows Explorer, browse to the assembly that you downloaded from the Web.

  3. Right-click the assembly, and from the shortcut menu, select Properties.

    The Properties dialog box opens.

  4. On the General tab, click the Unblock button to indicate that this assembly is trusted

    Note Note

    The Unblock button will not appear if the assembly is already unblocked and available.

  5. Click OK to close the Properties dialog box.

  6. Restart Visual Studio and open your project.

    You should now be able to browse to the assembly in the Choose Items or Add Reference dialog boxes.

Date

History

Reason

July 2010

Added note about missing Unblock button.

Customer feedback.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Editing devenv.exe.config file works
My machine configuration is Windows 7 Service Pack 1.  As suggested in this thread, I opened the file
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.config" and added the following lines
<runtime>
  <loadFromRemoteSources enabled="true" />
  ....
</runtime>
 and it resolved the issue for me. All other options - "unlock button", "Moving the assembly to different folder" -- did not work

Jagan
Move files from Documents folder
I had the problems other describe, and I also didn't see the unblock button on the offending dll. Moving my project to a folder outside my Documents folder resolved the issue for me. I use c:\myprojects\ instead of c:\users\<user>\Documents\Visual Studio 2010\Projects
kmb

I receive this error in the xaml designer for a assembly not loaded from the web....

The assembly is a project reference and it used to run until ...(what?)

(I'm working on a server terminal and our admins made some changes on the dns server, maybe that's the reason?)

The project can be built and runs properly. Designing the gui is no more possible... :-(

Read-only files
This solution won't work if the file is read-only. You have to make it writable to change this proerty even if the binary won't be altered by this operation.
Run Streams to Unblock Directory Tree
Many solutions here: http://superuser.com/questions/38476/this-file-came-from-another-computer-how-can-i-unblock-all-the-files-in-a
Admin rights required?
I was able to add a reference to the project, but when I try to add the XAML namespace I get an error: 

Error 1 Unable to load the metadata for assembly 'WPFToolkit.Extended'. This assembly may have been downloaded from the web.  See http://go.microsoft.com/fwlink/?LinkId=179545.  The following error was encountered during load: Could not load file or assembly 'WPFToolkit.Extended, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) 

The link points to this article. The "Unblock" button is not present on the Properties dialog.
This worked for me
I have to create this key to disable strong name verification because the assembly I was trying to load also was not strong name signed. To disable strong name verification, create the following registry keys: HKLM\Software\Wow6432Node\Microsoft\StrongName\Verification\*,*

as well as this one: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\StrongName\Verification\*,*

Note that you are totally opening up your system by doing this, so be WARNED that any assembly is get loaded and you will not be warned if it is evil or not!!
unable to set reference to network drive
My intended reference is put on a network drive, where SourceSafe points at. It it not possible to use this reference and the error message leads to this page. But this is not the right solution for my problem! Silverlight 4, Windows 7/64, VS 2010.

Peter
no unblock button
This fixed my issue as someone posted above

Open devenv.exe.config (in C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE on my machine), and add this
<runtime>
  <loadFromRemoteSources enabled="true" />
  ....
</runtime>
Restart Visual Studio and it should work.


My zip had no unblock button and neither did the assembly's I was trying to load.

Silverlight under network drive
this fixed it for me:
Open devenv.exe.config (in C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE on my machine), and add this
<runtime>
  <loadFromRemoteSources enabled="true" />
  ....
</runtime>
Restart Visual Studio and it should work.
Try this to resolve the error
One other thing to look into if you are having this problem is to make sure Visual Studio is not building your solution in your My Documents area.  If so, try moving it to another directory on your computer (e.g. C:\Dev) and rebuild. 
Trying to use UNC references - this is not cool
The UNC is a trusted Local Intranet path. There is no "Unlock" button because the file wasn't downloaded from the web. I don't want to use a local reference because then the build server will not be able to find the reference. This only seems to be a problem for the Silverlight project.
'Unblocking' files downloaded from internet
For Windows 7, 
1. Right click on the zip file
2. Click on 'Properties'
3. Choose 'Unblock' in the 'Attributes' section
4. Extract file

Note: If you unzip the file before unblocking, all files in the extracted folder are flagged as unsafe.
no Unblock button
Not seeing an Unblock button in Windows 7 64-bit.  Trying to do this for the Ribbon library for WPF.
Possible solutions to the problem
There are two problems both show you this error message.

First)
If your project files reside on a network drive, then move it to a local drive.
You can vote for a solution here: https://connect.microsoft.com/VisualStudio/feedback/details/568464/wpf-project-on-a-network-share-with-clr-namespace?wa=wsignin1.0
I think Kellen run into this problem

Second)
If you download a zip file with source code, then don't open the file directly! First save it on a local drive, then open the folder of the file and there you have to unblock the zip file. Otherwise all the files inside the zip file get the unsafe attribute and need to be unblocked when you extract them!
Unblocking an assembly
Could you possibly make protecting us any more painful -- I'm only groaning aloud at this point? There is no one thing marked "assembly". The unblock button is found on the properties page for each individual item, not on a directory.  It's not clear from the write-up if I download an author's code samples for a 1200 page book I purchased from Amazon, do I have to do this for each item in each subdirectory as well (bin -> release, bin -> debug, obj, etc.)? What an enchanting way to learn a new language.
No unblock button here either
Windows 7.   It's been very difficult getting any Silverlight examples working.
This one is Microsoft.Maps.MapControl.Common.dll.   Worked great when the guy
demoed it at codecamp.  Sure wish I could get it working!
I even downloaded the .msi and installed it local.  No luck.
What unblock button?
There is no 'unblock' button that I've seen.  I've run into this problem multiple times, typically from Microsoft sample applications.  Is there a command line utility or something similar that we could use to 'unblock' this assembly?  This is on windows server 2008 r2.