I'm currently working in the Visual Studio 2012 RC with a test project. I have included the following assemblies:
- Microsoft.SqlServer.Smo
- Microsoft.SqlServer.SmoExtend
- Microsoft.SqlServer.ConnectionInfo
- Microsoft.SqlServer.Management.Sdk.Sfc
These assemblies are build in version 2.0.50727 and I have a test project in .NET 4.0. So based on this information I have added an app.config file into the project with the following lines:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
</configuration>
When I'm going to run this I receive all the time the following message:
Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.
Is this a bug in a Visual Studio 2012 RC Test Project that it ignore's the app.config file or am I doing something completely wrong?
For additional information I have included also my test code:
var connectionString = new SqlConnectionStringBuilder()
{
DataSource = @"(local)",
IntegratedSecurity = true
}.ConnectionString;
var sql = "alter database [Test] set single_user with rollback immediate go ";
sql += "drop database [Test] go ";
sql += "create database [Test] go ";
sql += Properties.Resources.Test;
var connection = new SqlConnection(connectionString);
var server = new Server(new ServerConnection(connection));
server.ConnectionContext.ExecuteNonQuery(sql);