当前位置:  开发笔记 > 开发工具 > 正文

Visual Studio错误:"GenerateResource"任务意外失败

如何解决《VisualStudio错误:"GenerateResource"任务意外失败》经验,为你挑选了1个好方法。

在构建包含19个项目的VS 2008解决方案时,我有时会得到:

The "GenerateResource" task failed unexpectedly.
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at System.IO.MemoryStream.set_Capacity(Int32 value)
   at System.IO.MemoryStream.EnsureCapacity(Int32 value)
   at System.IO.MemoryStream.WriteByte(Byte value)
   at System.IO.BinaryWriter.Write(Byte value)
   at System.Resources.ResourceWriter.Write7BitEncodedInt(BinaryWriter store, Int32 value)
   at System.Resources.ResourceWriter.Generate()
   at System.Resources.ResourceWriter.Dispose(Boolean disposing)
   at System.Resources.ResourceWriter.Close()
   at Microsoft.Build.Tasks.ProcessResourceFiles.WriteResources(IResourceWriter writer)
   at Microsoft.Build.Tasks.ProcessResourceFiles.WriteResources(String filename)
   at Microsoft.Build.Tasks.ProcessResourceFiles.ProcessFile(String inFile, String outFile)
   at Microsoft.Build.Tasks.ProcessResourceFiles.Run(TaskLoggingHelper log, ITaskItem[] assemblyFilesList, ArrayList inputs, ArrayList outputs, Boolean sourcePath, String language, String namespacename, String resourcesNamespace, String filename, String classname, Boolean publicClass)
   at Microsoft.Build.Tasks.GenerateResource.Execute()
   at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult)   C:\Windows\Microsoft.NET\Framework\v3.5

通常在VS运行约4小时后发生; 让VS正确编译的唯一方法是关闭VS,然后重新启动它.

我在一台3GB Ram的机器上.TaskManager显示devenv.exe工作集为578060K,并且该机器的整个内存分配为1.78GB.它应该有足够的ram来生成资源.



1> Stu..:

来自https://social.msdn.microsoft.com/Forums/vstudio/en-US/5154ef26-ccfe-44d5-a322-6804b61ac774/systemoutofmemoryexception?forum=clr:

尝试删除.suo文件并重新打开解决方案.

推荐阅读
pan2502851807
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有