如何最好地处理Visual Studio中的巨大源代码文件 [英] How best to deal with gigantic source code files in Visual Studio

查看:100
本文介绍了如何最好地处理Visual Studio中的巨大源代码文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个充分利用代码生成的项目。它生成的某些文件包含超过25万行代码。 VS(2K5)的应付能力不是很差,但是R#(4.01)每两分钟左右抛出一次内存不足异常。



将它们分离出来进入局部类/单独文件并不是短期内的选择,尽管可能会晚一些。



是否有任何巧妙的IDE技巧可以处理



编辑:所以人们立即(非常明智地)说没有那么大的文件,并提出了将其分解成较小文件的方法。 / p>

很好,但是我正在执行一项有时间限制的任务,四处张望并决定要优化的内容。我的问题特别是如何轻松地在IDE中查看庞大的文件,而不是如何重构项目。出于问题的目的,请想象该文件是只读的。 :)

解决方案

似乎是这个R#工具(是Resharper吗?)。你可以禁用它吗?
否则,更改生成的代码的文件类型可能是有道理的-大概,您将不会对这些文件进行重大编辑,因此丢失语法颜色和源文件特有的其他功能将不会问题。


I'm working on a project which makes substantial use of code generation. Some of the files it generates contain >0.25 million lines of code. VS (2K5) doesn't cope too badly, but R# (4.01) throws an out of memory exception every two minutes or so.

Splitting them out into partial classes/separate files isn't an option in the immediate term, though it may be later.

Are there any clever IDE tricks to dealing with this?

EDIT: so people are immediately saying (very sensibly) 'don't have a file that big' and suggesting ways to break it out into smaller files.

That's fine, but I'm on a time-boxed task taking a look around and deciding what to optimise. My problem is very specifically 'how to view an insanely big file in an IDE without pain', not 'how to refactor the project'. For purposes of the question please imagine the file is read-only. :)

解决方案

Seems like this R# tool (is that Resharper?) is the problem. Can you disable it? Otherwise, changing the file type for the generated code might make sense - presumably, you aren't going to be doing major editing on those files, so losing syntax coloring and other features specific to source files wouldn't be an issue.

这篇关于如何最好地处理Visual Studio中的巨大源代码文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆