如何使Visual Studio自动生成具有扩展路径长度支持的App.config文件 [英] How to make Visual Studio auto-generate App.config files with extend path length support

查看:114
本文介绍了如何使Visual Studio自动生成具有扩展路径长度支持的App.config文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个新项目,但我要保存它的区域的路径长度超过260个字符。 

I am trying to make a new project, but the area where I want to save it has a path length greater than 260 characters. 

经过一些搜索我发现这可以在App.config中更改:  https://blogs.msdn.microsoft.com/dotnet/2016/08/02/announcing-net-framework-4-6-2/

After some searching I found that this can be changed in the App.config: https://blogs.msdn.microsoft.com/dotnet/2016/08/02/announcing-net-framework-4-6-2/

您似乎要做的就是在App.config或Web.config中添加以下内容:

It seems all you have to do is add the following in your App.config or Web.config:

<runtime>    
    <AppContextSwitchOverrides value="Switch.System.IO.UseLegacyPathHandling=false" />  
</runtime>

到目前为止,我只能在创建项目后进行更改;但是,对于我想要创建新项目的情况,这是不方便的。

So far I've only be able to make the change after I've created the project; however, this is inconvenient for situations where I want to create a new project.

那么我如何在App.config中创建一个自动拥有它的新项目?

So how would I create a new project that automatically has this in the App.config?

推荐答案

您好Tyler,

Hi Tyler,

感谢您在MSDN论坛上发帖。

Thank you for posting in MSDN forum.

>>那么我如何在App.config中创建一个自动拥有它的新项目?

我们知道,app.config是一个XML文件,其中包含许多预定义的配置节,并支持自定义配置节。 "配置部分"是指"配置部分"。是一个XML片段,其架构旨在存储某种类型的信息。

As we know, the app.config is an XML file with many predefined configuration sections available and support for custom configuration sections. A "configuration section" is a snippet of XML with a schema meant to store some type of information.

概述(MSDN)

连接字符串配置(MSDN)

可以使用内置配置节配置设置例如
connectionStrings
appSettings 。您可以手动添加自己的自定义配置部分,但目前在VS中没有可以在创建新项目之前更改配置的设置。

Settings can be configured using built-in configuration sections such as connectionStrings or appSettings. You can add your own custom configuration sections manually, but currently in VS there not a setting that could change the config before a new project is created.

最好的问候,


这篇关于如何使Visual Studio自动生成具有扩展路径长度支持的App.config文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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