如何在Visual Studio 2015 Enterprise

时间:2017-08-16 11:16:55

标签: c# visual-studio visual-studio-2015 c#-7.0

我正在使用Visual Studio 2015 Enterprise(试用版),而且我很难启用C#7语言功能。

我知道我需要在项目中安装一些软件包以启用它,但我仍然无法正常工作。

这是我的packages.config:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="ManagedEsent" version="1.9.4" targetFramework="net461" />
  <package id="Microsoft.Azure.DocumentDB" version="1.17.0" targetFramework="net461" />
  <package id="Microsoft.CodeAnalysis" version="2.3.1" targetFramework="net461" />
  <package id="Microsoft.CodeAnalysis.Analyzers" version="1.1.0" targetFramework="net461" />
  <package id="Microsoft.CodeAnalysis.Common" version="2.3.1" targetFramework="net461" />
  <package id="Microsoft.CodeAnalysis.CSharp" version="2.3.1" targetFramework="net461" />
  <package id="Microsoft.CodeAnalysis.CSharp.Workspaces" version="2.3.1" targetFramework="net461" />
  <package id="Microsoft.CodeAnalysis.VisualBasic" version="2.3.1" targetFramework="net461" />
  <package id="Microsoft.CodeAnalysis.VisualBasic.Workspaces" version="2.3.1" targetFramework="net461" />
  <package id="Microsoft.CodeAnalysis.Workspaces.Common" version="2.3.1" targetFramework="net461" />
  <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.6" targetFramework="net461" />
  <package id="Microsoft.Net.Compilers" version="2.3.1" targetFramework="net461" developmentDependency="true" />
  <package id="Microsoft.Net.Compilers.netcore" version="1.3.2" targetFramework="net461" />
  <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net461" />
  <package id="System.AppContext" version="4.3.0" targetFramework="net461" />
  <package id="System.Collections" version="4.3.0" targetFramework="net461" />
  <package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net461" />
  <package id="System.Collections.Immutable" version="1.4.0" targetFramework="net461" />
  <package id="System.Composition" version="1.1.0" targetFramework="net461" />
  <package id="System.Composition.AttributedModel" version="1.1.0" targetFramework="net461" />
  <package id="System.Composition.Convention" version="1.1.0" targetFramework="net461" />
  <package id="System.Composition.Hosting" version="1.1.0" targetFramework="net461" />
  <package id="System.Composition.Runtime" version="1.1.0" targetFramework="net461" />
  <package id="System.Composition.TypedParts" version="1.1.0" targetFramework="net461" />
  <package id="System.Console" version="4.3.0" targetFramework="net461" />
  <package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net461" />
  <package id="System.Diagnostics.FileVersionInfo" version="4.3.0" targetFramework="net461" />
  <package id="System.Diagnostics.StackTrace" version="4.3.0" targetFramework="net461" />
  <package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net461" />
  <package id="System.Dynamic.Runtime" version="4.3.0" targetFramework="net461" />
  <package id="System.Globalization" version="4.3.0" targetFramework="net461" />
  <package id="System.IO.Compression" version="4.3.0" targetFramework="net461" />
  <package id="System.IO.FileSystem" version="4.3.0" targetFramework="net461" />
  <package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net461" />
  <package id="System.Linq" version="4.3.0" targetFramework="net461" />
  <package id="System.Linq.Expressions" version="4.3.0" targetFramework="net461" />
  <package id="System.Reflection" version="4.3.0" targetFramework="net461" />
  <package id="System.Reflection.Metadata" version="1.5.0" targetFramework="net461" />
  <package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net461" />
  <package id="System.Runtime" version="4.3.0" targetFramework="net461" />
  <package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net461" />
  <package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net461" />
  <package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net461" />
  <package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net461" />
  <package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" />
  <package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" />
  <package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net461" />
  <package id="System.Text.Encoding" version="4.3.0" targetFramework="net461" />
  <package id="System.Text.Encoding.CodePages" version="4.4.0" targetFramework="net461" />
  <package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net461" />
  <package id="System.Threading" version="4.3.0" targetFramework="net461" />
  <package id="System.Threading.Tasks" version="4.3.0" targetFramework="net461" />
  <package id="System.Threading.Tasks.Parallel" version="4.3.0" targetFramework="net461" />
  <package id="System.Threading.Thread" version="4.3.0" targetFramework="net461" />
  <package id="System.ValueTuple" version="4.4.0" targetFramework="net461" />
  <package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net461" />
  <package id="System.Xml.XDocument" version="4.3.0" targetFramework="net461" />
  <package id="System.Xml.XmlDocument" version="4.3.0" targetFramework="net461" />
  <package id="System.Xml.XPath" version="4.3.0" targetFramework="net461" />
  <package id="System.Xml.XPath.XDocument" version="4.3.0" targetFramework="net461" />
</packages>

我也知道在安装这些软件包后,我需要导航到:Project - &gt;属性 - &gt;高级并设置C#版本;我有,但那里列出的最新版本是版本6.

以下是我获得构建和IntelliSense错误的代码示例:

public override T this[int x, int y]
{
    get => Data[x, y]; 
}

构建输出:

  

严重级代码描述项目文件行抑制状态   错误CS8059功能'表达式主体属性访问器'不是   可在C#6中使用。请使用语言版本7或   更大。一般C:\ Users \ Mladen \ Projekti \ tetris-cs \ General \ Matrix.cs 23 Active

这个问题不重复,因为引用问题的答案并没有回答我的问题。我已经安装了该问题中建议的软件包,我仍然遇到这些错误。

不知道为什么没有项目引用列表Microsoft.Net.Compilers包,我已经安装了它。

0 个答案:

没有答案