This is a very strange situation. The biml file I created worked fine when connecting to a local sql instance, but it gave me the compilation error - Incorrect syntax near ')' - after the connection string is changed to a remote one with a named instance.
The following code works fine.
string CnSrcDB = "Data Source=(local);Initial Catalog=Reporting;Provider=SQLNCLI11.1;Integrated Security=SSPI;";
The following code showed no compilation error but, as expected, did not produce any result due to the wrong connection string.
string CnSrcDB = @"Data Source=marketingsql\\sql1;Initial Catalog=Reporting;Provider=SQLNCLI11.1;Integrated Security=SSPI;";
Both the following two variations gave me the compilation error.
string CnSrcDB = "Data Source=marketingsql\\sql1;Initial Catalog=Reporting;Provider=SQLNCLI11.1;Integrated Security=SSPI;";
string CnSrcDB = @"Data Source=marketingsql\sql1;Initial Catalog=Reporting;Provider=SQLNCLI11.1;Integrated Security=SSPI;";
I am using Visual Studio 2015 with Biml Express 2017 Build 5.0.61915.0. It looks like not a C# error but a Biml error. Because no biml code is generated, except for the error - Incorrect syntax near ')' , I do not know where the issue is. I believe this line of code causing the compilation error, but still do not know why.
var sourceConnection = SchemaManager.CreateConnectionNode("SchemaProvider",CnSrcDB);