SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
ASP.NET, VB.NET, Microsoft .NET Framework, Microsoft Visual Studio, Windows Forms, Controls and more Tutorials and Articles for Programmers

Unblock Assembly File in Visual Studio 2012

In this Visual Studio tutorial, I want to show how to unblock assembly file which is downloaded from web or came from an other computer. Especially if you open a Visual Studio project downloaded from web which includes assembly file referenced within Visual Studio solution, you will experience the below error during compiling your project.

I want to demonstrate this compile error Could not load the assembly file on Visual Studio 2012 occured during compiling a sample Windows Phone app project.

While studying sample app projects for Windows Phone 8, I download a project sample showing how to use local database within an app. I download sample project archive and extract code to a folder. Then I launched Visual Studio 2012 and project by double click to the solution file.

When I try to re-build Visual Studio 2012 Windows Phone 8 app sample project, I got the following error message:

Could not load the assembly file:///C:\Visual Studio 2012 samples\VB\sdkLocalDatabaseVB\Library\Microsoft.Phone.Controls.Toolkit.dll.
This assembly may have been downloaded from the Web. If an assembly has been downloaded from the Web, it is flagged by Windows as being a Web file, even if it resides on the local computer. This may prevent it from being used in your project. You can change this designation by changing the file properties. Only unblock assemblies that you trust. See http://go.microsoft.com/fwlink/?LinkId=179545 for more information.

Above Visual Studio error "Could not load the assembly file" indicates that the assembly file Microsoft.Phone.Controls.Toolkit.dll is blocked for security reasons. An as a Visual Studio developer if the assembly can be trusted, I can decide to unblock assembly file to use it in VS2012 project.

Visual Studio 2012 solution explorer and blocked assembly
Microsoft.Phone.Controls.Toolkit.dll in sample Visual Studio 2012 Windows Phone 8 app project

To unblock assembly file downloaded from web, open the folder where the .dll file is in.
Right click on the .dll file and open Properties
Before you unblock the usage of the .dll assembly file by pressing the Unblock button, please note that this assembly file came from another computer and might be blocked to help protect your computer.
Press Apply button and exit Properties screen pressing OK button.

unblock assembly file caused build error in Visual Studio 2012
Unblock assembly file which caused build error in Visual Studio 2012

After .dll file is unblocked, I can successfully rebuild Visual Studio 2012 solution without any further build errors.

Here is how easy to unblock assembly files in Visual Studio using Windows Explorer.

Visual Studio

Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.