locked
Error 2 (GenerateResource) RRS feed

  • Question

  • Hello. What is this error (Windows Phone 8.1 app)? Help me, please.

    Error 2 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.v12.0\v4.0_12.0.0.0__b03f5f7f11d50a3a\Microsoft.Build.Tasks.v12.0.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.v12.0\v4.0_12.0.0.0__b03f5f7f11d50a3a\Microsoft.Build.Tasks.v12.0.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.<ExecuteInstantiatedTask>d__20.MoveNext()

     VK Wall Poster

    Sunday, October 19, 2014 2:39 AM

Answers

  • Finally I solved my problem. I used Pivot control in my Windows Phone 8.1 project and when I added any external reference, I got this error. After I changed the Pivot to Hub control, the error was gone. :)
    Wednesday, October 22, 2014 7:06 AM

All replies

  • Did you add a reference to a dll in a network location?  If you did I would copy the file to your hard drive and add a reference to the local dll.
    Sunday, October 19, 2014 1:20 PM
  • I have the same problem with the same dll, as you can see the dll is located in gac and it's a default .net library.

    Someone can help me?

    Monday, October 20, 2014 9:43 AM
  • I got the same problem here. I even did not make any change in the project. And now I can only rebuild my project if remove all the references.
    Tuesday, October 21, 2014 1:04 PM
  • Finally I solved my problem. I used Pivot control in my Windows Phone 8.1 project and when I added any external reference, I got this error. After I changed the Pivot to Hub control, the error was gone. :)
    Wednesday, October 22, 2014 7:06 AM
  • Same problem here, it's probably related to Windows 10 Technical Preview, I have not seen any such problems on Windows 8.1.

    So have you found any working solution?

    Sunday, October 26, 2014 6:46 PM