I have a problem compiling SSDT SQL Server Database Project using Visual Studio 2015. I want to use the C # 6 functions inside my database project, but it looks like it is not supported. For example, I added the following class to the db project:
namespace Database1
{
class ClassFile1
{
public string Str { get; } = string.Empty;
}
}
I tried to compile this, but got an error:
CS1519: Invalid token '=' in class member declaration, structure or interface
I found out that the cause of this error is the wrong compiler version used by VS 2015. The following compilation line is generated by VS:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702,2008 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE /errorendlocation /preferreduilang:en-US /highentropyva+ /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\mscorlib.dll" /debug+ /debug:full /optimize- /out:obj\Debug\Database2.dll /subsystemversion:6.00 /target:library /warnaserror- /utf8output ClassFile1.cs
As you can see, C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Csc.exe is used, and this is incorrect.
db VS 2015, , csc.exe Roslyn (C:\Program Files (x86)\MSBuild\14.0\Bin\csc. exe), # 6. Roslyn csc.exe ?
MSBuild 14.0 .
: / , VS SSDT C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe Roslyn (C:\Program Files (x86)\MSBuild\14.0\Bin\csc.exe)?