4

我有一個Visual Studio 2013 Update 3解決方案,其中包含一些自定義PCL庫,然後是一個UniversalApp項目,其中包括Windows 8.1,WindowsPhone 8.1和共享位。我正在嘗試編譯WindowsPhone項目。共享項目包含一些模型,視圖模型,實用程序類,圖像和一些樣式。UniversalApp錯誤「GenerateResource任務意外失敗」Microsoft.Build.Tasks.v12.0.dll

我不知道發生了什麼變化,因爲它是以前的工作,但現在我不能得到這個錯誤的坐:

Error 8 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() 

我看到帖子的類似問題,但沒有完全一樣或與修復工作。事情我已經嘗試:

  • 刪除文件名爲.suo
  • 新增<GenerateResourceNeverLockTypeAssemblies>true</GenerateResourceNeverLockTypeAssemblies>到項目文件
  • 新增<loadFromRemoteSources enabled="true" />到devenv.exe.config文件
  • 刪除了UniversalApp項目,並從頭開始重建(在複製一些文件雖然)
+0

我有同樣的問題,我想不出其他任何改變,因爲它上次工作,而不是我運行的工具,現在Windows 10 TP的操作系統。你還使用#Win10嗎? – Lucian 2014-11-10 06:52:18

+0

我也在運行Windows 10 TP,只是在想同樣的問題。嗯,我很享受#Win10,但這可能是回到8.1的理由,除非任何人都能想到解決方法。 – Cood 2014-11-13 04:08:20

+0

我剛剛嘗試的其他東西是全新的Windows 10 TP Build 9879的乾淨安裝,但同樣的問題... @Lucian – Cood 2014-11-14 05:21:57

回答

-2

有點晚,但如果運行VS2013作爲管理員,你應該沒問題(即它可以在我的機器上運行)。

0

我也有同樣的問題(對不起,無法評論 - 不夠分)具有相似的設置: Win10 + VS2015

我已經收窄我試圖將MvvmCross到我贏手機8.1項目。我正在使用nuget來引入3.2.1 mvvmcross庫。我檢查了這些dll,但沒有一個具有Unblock按鈕(就好像它已經被解除封鎖)。

如果我刪除了dll引用,然後再次正常工作。

另外,以管理員身份運行不起作用。我將在明天將我的項目拖入我的Win8.1盒子中,看看問題是否存在。

0

我有同樣的問題,WS10 + VS2013更新4

運行VS作爲管理使問題消失了我。

相關問題