Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8163649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:06:41+00:00 2026-06-06T19:06:41+00:00

I am building an application in C# visual studio 2012 RC. I have to

  • 0

I am building an application in C# visual studio 2012 RC.

I have to run the scripts within the application. for this i am using.
These two libraries.
My application’s target .net framework is 4.5.

using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Management.Common;

I wrote the code to run the scripts after checking weather database exists or not.

When i run the code an unexpected exception pops up. i really know what does it mean. Could you please help me in order to get rid of this exception.

I am attaching the my code and exception preview also.

Please HELP ME… I have googled too much already.

enter image description here

**Here are the Exception Details.**

System.IO.FileLoadException was unhandled
HResult=-2146232799
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.
Source=mscorlib
StackTrace:
at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type)
at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
at System.Reflection.Assembly.GetType(String name, Boolean throwOnError)
at Microsoft.SqlServer.Management.Common.ServerConnection.GetStatements(String query, ExecutionTypes executionType, Int32& statementsToReverse)
at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand)
at McFarlaneIndustriesPOSnamespace.SplashScreen.CreateDatabase() in e:\Works\McFarlane Industries\McFarlane Industries Point of Sale Source Code\McFarlaneIndustries\SplashScreen.cs:line 139
at McFarlaneIndustriesPOSnamespace.SplashScreen.splashScreenTimer_Tick(Object sender, EventArgs e) in e:\Works\McFarlane Industries\McFarlane Industries Point of Sale Source Code\McFarlaneIndustries\SplashScreen.cs:line 159
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at McFarlaneIndustriesPOSnamespace.Program.Main() in e:\Works\McFarlane Industries\McFarlane Industries Point of Sale Source Code\McFarlaneIndustries\Program.cs:line 19
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
at System.Activator.CreateInstance(ActivationContext activationContext)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T19:06:43+00:00Added an answer on June 6, 2026 at 7:06 pm

    It looks like you’re trying to load .net 2 version of Microsoft.SqlServer.xxxx.dll. Update your references to a .net4 version (preferable), or add the following mantra to your app.config under the <configuration> node

    <startup useLegacyV2RuntimeActivationPolicy="true">
      <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
      <requiredRuntime version="v4.0" />
    </startup>
    

    to allow loading of .net 2 assemblies. See here for details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Unlike this question: Linker Error while building application using Boost Asio in Visual Studio
I'm building an ASP.net application using Visual Studio Web Developer 2010 Express and have
I'm building an application using Visual Studio 2010 in which I have to use
I have a Visual Studio 2010 MVC2 web application that I'm building via the
I am building a Qt 4.5 application on Windows using Visual Studio 2008. Whenever
I am building a Windows Application using Visual Studio 2008. For the forms (2
I'm building WinForms application using Visual Studio 2010. Every time I make a change
I have this C# Visual Studio solution that implements a plugin architecture. When building
I'm Using Visual Studio 2008. At http://gotspeech.net/elearning/ Building Voice Workflows Create Voice Response Application
When building a C# application with Visual Studio 2008, is it possible to set

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.