The "GenerateResource" task failed unexpetedly Error in a Windows Universal project

2

I'm getting the following error when building my app. Any idea what's causing it or how to fix it?

Error The "GenerateResource" task failed unexpectedly.

System.IO.FileLoadException: Could not load file or assembly 'file:///C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Build.Tasks.Core\v4.0_14.0.0.0__b03f5f7f11d50a3a\Microsoft.Build.Tasks.Core.dll' or one of its dependencies.Operation is not supported. (Exception from HRESULT: 0x80131515)

File name: 'file:///C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Build.Tasks.Core\v4.0_14.0.0.0__b03f5f7f11d50a3a\Microsoft.Build.Tasks.Core.dll' ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the.NET Framework.This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.

at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)

at System.Reflection.Assembly.LoadFrom(String assemblyFile, Evidence securityEvidence)

at System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)

at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName)

at System.AppDomain.CreateInstanceFromAndUnwrap(String assemblyName, String typeName)

at System.AppDomain.CreateInstanceFromAndUnwrap(String assemblyName, String typeName)

at Microsoft.Build.Tasks.GenerateResource.Execute()

at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()

at Microsoft.Build.BackEnd.TaskBuilder.d__1.MoveNext() Nestle.WindowsPhone

.net
visual-studio-2013
win-universal-app
asked on Stack Overflow Jan 16, 2015 by Rohit Rajendran

1 Answer

2

It's a bug with the 9879 build of Windows 10. A workaround found at, https://gist.github.com/davkean/2714b93d202b9875bbe1, is to manually modify C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.config and add the following section:

<configuration>
   <runtime>
      <loadFromRemoteSources enabled="true"/>
   </runtime>
</configuration>
answered on Stack Overflow Jan 16, 2015 by Rohit Rajendran • edited May 23, 2016 by Rohit Rajendran

User contributions licensed under CC BY-SA 3.0