如何在 VS2022 中将 C# 的 gcAllowVeryLargeObjects 设置为 true **而不**使用 App.config 文件?
我希望能够通过编程(或至少使用项目属性)设置gcalloverylargeobjects
true。我知道我可以使用app.config文件,但这非常丑陋,因为它需要为主可执行文件创建一个单独的文件,然后需要使用可执行文件将其传递。
我已经尝试了两个环境。getEnvironMentVariable(“ gcallowverylargeobjects”)
和emoverition.getenvironmentvariable(“ complus_gcallow verylylargeobjects”)
,即使我没有打印出任何东西,使用配置文件将gcolalyverylargeobject设置为true。
如果那不起作用,我不希望emoverunt.setenvironmentvariable()
也可以使用,并且可以肯定的是。
我对VS2022的项目属性有很好的了解,那里也没有什么可见的。
I want to be able to programmatically (or at least using the Project properties) set gcAllowVeryLargeObjects
to true. I know I can use the App.config file, but this is quite ugly as it needs to create a separate file to the main executable which then needs to be passed around with the executable.
I've experimented with both Environment.GetEnvironmentVariable("gcAllowVeryLargeObjects")
and Environment.GetEnvironmentVariable("COMPlus_gcAllowVeryLargeObjects")
, but it doesn't print out anything, even if I set gcAllowVeryLargeObjects to true using a config file.
If that doesn't work, I don't expect Environment.SetEnvironmentVariable()
to work either, and sure enough, it doesn't.
I've had a good look in the Project properties of VS2022, and there's nothing to be seen there either.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

它
但您可以解决它:
It isn't possible.
But you can workaround it: