VS2015 自动生成的代码格式不正确

VS2015 auto generated code is not correctly formatted

我正在使用 Visual Studio Professional 2015 with Update 3。 我有一个包含我的数据库模型的 .edmx 文件。 当我从数据库更新我的模型时,自动生成的代码格式不正确。

例如,以前我有类似下面的内容:

namespace Something
{
    using System;
    using System.Collections.Generic;

    public partial class Analysis
    {
        public Analysis()
        {
            this.QualitativeAnalysis = new HashSet<QualitativeAnalysis>();
            this.QuantitativeAnalysis = new HashSet<QuantitativeAnalysis>();
            this.ScoringAnalysis = new HashSet<ScoringAnalysis>();
            this.SumupAnalysis = new HashSet<SumupAnalysis>();
        }
    }
}

我换了机器,现在我有:

namespace Something
{

using System;
    using System.Collections.Generic;

    public partial class Analysis
    {

        public Analysis()
        {

            this.QualitativeAnalysis = new HashSet<QualitativeAnalysis>();

            this.QuantitativeAnalysis = new HashSet<QuantitativeAnalysis>();

            this.ScoringAnalysis = new HashSet<ScoringAnalysis>();

            this.SumupAnalysis = new HashSet<SumupAnalysis>();

        }
    }
}

我必须更改我的 VS 配置才能解决此问题?

谢谢。

根据 @Panagiotis Kanavos 评论,我发现此行为是由于行尾设置所致。 基本上,Git 使用 Unix 设置存储文件,而 Visual Studio 使用 Microsoft 设置读取文件。

我为 Windows Bash 客户端安装了 Git,在再次克隆 repo 后,它解决了问题。

此工具在结帐时将 Unix 设置转换为 Microsoft 设置,并在提交时将 Microsoft 设置转换为 Unix 设置。