Error Creating Visual Studio 2010 Silverlight Phone Application on Shared Drive

We have been experiencing issues creating projects within Visual Studio 2010 for Silverlight for Windows Phones where the project location is on a shared drive / resource.

During the build, this error is displayed;
C:\Program Files (x86)\MSBuild\Microsoft\Silverlight for Phone\v4.0\Microsoft.Silverlight.Common.targets(249,9): error : Could not load the assembly file:///p:\visual studio 2010\Projects\PhoneApp5\PhoneApp5\obj\Debug\PhoneApp5.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.
It is possible to get this working by creating a new environment variable, system or user with the following data;
COMPLUS_LoadFromRemoteSources=1
You can do the above by typing the below in command prompt (for system, not just user);
setx COMPLUS_LoadFromRemoteSources 1 /m
If that still does not work; try adjusting the Microsoft.Net V4.0 Security Policy using CASPOL from command prompt. Add in your network drive or share and try again. The command line is provided below;
C:\Windows\Microsoft.NET\Framework\v4.0.30319\caspol -q -machine -addgroup 1 -url file://p:/* FullTrust -name "P Drive"
 Using both command lines above solved all of my problems with regards to running projects from untrusted locations. Just adjust the drive location and create a batch file with the following lines and away you go.
setx COMPLUS_LoadFromRemoteSources 1 /m
C:\Windows\Microsoft.NET\Framework\v4.0.30319\caspol -q -machine -addgroup 1 -url file://p:/* FullTrust -name "P Drive" 

Pause
 Hope this helps you out there!

Comments

Popular posts from this blog

Create bootable CUC CUCM CUP Image / ISO

Configuring Oracle 12c backups on Veritas Backup Exec 16.

CUCM 11.5 - Esxi 6.5 - unable to create VM