使用 VVBig XAML 文件
您是否尝试过使用包含数千行代码的 XAML 文件。 (更具体地说,在我的例子中是整个应用程序的绘图画笔)。该文件大小为 20+ MB。每当我尝试添加/编辑其中的任何内容时,Visual Studio 2008 都会崩溃(7/10 次)。 然后,如果我能够进行更改并尝试保存更改,那么 VS 就会崩溃(大多数情况下)。 在 VS 中处理这么大的文件非常困难(在 Blend 中也发生同样的情况,但很少发生)
我知道这么大的文件不符合良好编码标准。但是如果我们遇到这样的情况该怎么办???
我最终找到的唯一东西是 KXAML :事实证明它非常好。还有其他建议吗??
已更新我不想更改该文件的结构或采用任何其他方法。我很想知道如何使用这样的文件。 (其他编辑可能是)
ADD看到答案 - 我想说我现在没有被困住,我想知道如果有人被困住了,那么编辑这样的东西是更好的方法吗? (分离这个文件将是第一个想到避免这个问题而不是解决方案)
ADD1 好吧!我的错,我对这个想法过于乐观了。考虑到调查,我会要求最佳实践来分割这个巨大的文件。
Have you ever tried working with a XAML file which contains thousand tons of line of code. (More specifically Drawing Brushes for whole application in my case). This file is of 20+ MB size. Whenever i try to add/edit anything in this, Visual Studio 2008 crashes (7/10 times).
Then if i'm able to do my changes and try to save change then VS crashes (most of the times).
It is so difficult to work with such a big file in VS (same happens in Blend too but with few occurences)
I know having such a big file doesn't come under Good Coding standards. But what should we do if somehow we come in such scenario???
The only thing I finally found was KXAML : which proved quite good. Any other suggestions ??
UPDATED I dont want to change structure of that file or go for any other approach. I'm curious to know how to work / with such file. (other editors may be)
ADD seeing the answers - I would say i'm not stuck at this point i want to know if someone got stuck then is it better way to edit such thing ?? (separating this file would be the v.first thought to avoid this problem not solution)
ADD1 Alright !! My bad, i got too optimistic regarding this thought. Considering canvass, I would ask for the best practice to split this huge file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我可能建议您采取积极主动的方法,看看是否无法适当地进行细分。
定义单独的ResourceDictionary文件来封装重用的资源等;同样,对文件的其他部分执行此操作,可以将其删除并简单地引用。
这样,您就可以拥有一个包含
Brush
的文件、每个Style
和/或ControlTemplate
的文件,等等。编辑:
根据您的更新明确指出您不想实际更改文件,那么我只能用这些回答“如何处理这么大的文件?”的问题话:
非常困难,感官刺激的痛苦和大量浪费的时间。
I might suggest you take the pro-active approach and see if you can't segment it appropriately.
Define separate
ResourceDictionary
files to encapsulate reused resources and suchlike; similarly, do this for other sections of the file which can be stripped out and simply referenced.This way you can have a file containing your
Brush
es, a file perStyle
and/orControlTemplate
, and so on and so forth.EDIT:
As per your update stating quite definitively that you don't want to actually change the file, then I can only reply to the question of 'How to work with such a large file?' with these words:
With great difficulty, pangs of irritated senses and a lot of wasted time.
我在 VS2010 中遇到了同样的问题,一些老同事的一些巨大的 xaml 文件并没有真正听说过编码标准。我可以向你保证,VS2010 也很强大。我最终所做的是将 xaml 文件拆分为多个文件,然后将它们添加为资源或 合并字典。
PS您的意思是Kaxaml吗?
I 've had the same problem in VS2010 with some huge xaml files of some old colleagues that hadn't really heard about coding standards. I can assure you that VS2010 crushes a lot too. What I ended up doing was to split the xaml files into several files and then adding them as resources or as merged dictionaries.
P.S. did you mean Kaxaml?
您是否考虑过将文件拆分为单独的资源字典文件并合并它们放入一个字典中?
Have you thought about splitting the file into separate resource dictionaries files and merging them into a single dictionary?
为什么这么大?? Infragistics 控件的所有样式(画笔、控件样式等)均小于 10 Mb。
您应该考虑尽可能频繁地使用样式继承。
另外,您应该将此文件拆分为几个较小的文件。处理这么大的文件是一种折磨。尝试让所有文件小于 1000 行。
Why it is so large?? All styles for Infragistics controls (brushes, controls styles etc) are less than 10 Mb.
You should to consider to use styles inheritance as frequently as possible.
Also you should split this file to few smaller files. It is torture to work with so large file. Try to have all files smaller than for example 1000 lines.