Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi, i created a setup file for database project, and i am debugging the installer code it is thrown an error like "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.", How can reslove this, please help me and advancely thanks..

Here is my code.
C#
private void ExecuteSql(string serverName, string dbName, string Sql)
        {
            string connStr = "Data Source=" + serverName + ";Initial Catalog=" + dbName + ";Integrated Security=True";
            using (SqlConnection conn = new SqlConnection(connStr))
            {
                try
                {
                    Server server = new Server(new ServerConnection(conn));
                    server.ConnectionContext.ExecuteNonQuery(Sql); // i got an error here..
                }
                catch (Exception ex)
                {
                    Log(ex.ToString());
                }
            }
        }
Posted

1 solution

See the post with the most votes on this link[^]
There are also some alternative links at the same location
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900