c# - VS 2017,直接 CSharpCodeProvider 使用 C#7
问题描述
在我的 xcript 中实现 C#7 功能($
- 字符串插值)并调用CSharpCodeProvider.CompileAssemblyFromSource()
时,我收到以下错误:
E:\src\*****\****\bin\Debug> "C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe"
/t:library /utf8output /R:"E:\***\***\Main\ConsoleApp1\bin\Debug\***.dll"
/R:"Microsoft.CSharp.dll" /R:"System.Core.dll"
/R:"System.Data.DataSetExtensions.dll" /R:"System.Data.dll"
/R:"System.Data.Linq.dll"
/R:"System.dll"
/R:"System.Xml.dll"
/R:"System.Xml.Linq.dll"
/R:"EntityFramework.dll"
/out:"E:\***\***\Main\***RuleEngine\_DynamicDll\***RuleEngine.dll"
/D:DEBUG /debug+
/optimize- "E:\***\***\Main\***RuleEngine\_DynamicDll\TempFiles\5jdr2zw0.0.cs"
Microsoft (R) Visual C# Compiler version 4.7.2558.0 for C# 5
Copyright (C) Microsoft Corporation. All rights reserved.
This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to C# 5, which is no longer the latest version. For compilers that support newer versions of the C# programming language, see http://go.microsoft.com/fwlink/?LinkID=533240
E:\***\***\Main\***RuleEngine\_DynamicDll\TempFiles\5jdr2zw0.0.cs(549,35): error CS1056: Unexpected character '$'
0) E:\***\***\Main\***RuleEngine\_DynamicDll\TempFiles\5jdr2zw0.0.cs(549,35)
: error CS1056: Unexpected character '$'
建造:
_csc = new CSharpCodeProvider(new Dictionary<string, string>() { {
"CompilerVersion", "v4.0" } });
知道如何解决这个问题吗?
谢谢!
解决方案
推荐阅读
- jquery - 为什么在 jquery 滑块的开头显示空白图像
- ios - 在 Swift App 中使用 pipe() 将 stdout 重定向到 textView (仅在模拟器中运行,而不是本机)
- ionic-framework - 离子4中未显示模态框
- assembly - 如何访问程序集 x86 中的结构字段?
- java - 如何使用spring和mockito获取被测对象的字段
- javascript - 聚焦任何类型元素的最佳方式
- ruby-on-rails - Docker 中的 Rails 长时间等待
- c++ - 模板参数的显式指定参数无效,即 constexpr
- android - 自定义视图在使用时产生数据绑定错误
- python - 如何从 API 调用访问数字数据?