title: Microsoft.SqlServer.Management.Smo can't find Server class
body: <p>Yeah I did add the 4 dlls, found in:</p>
  
  <pre><code>C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies
  </code></pre>
  
  <p>Which are these:</p>
  
  <pre><code>Microsoft.SqlServer.ConnectionInfo.dll
  Microsoft.SqlServer.Smo.dll
  Microsoft.SqlServer.Management.Sdk.Sfc.dll
  Microsoft.SqlServer.SqlEnum.dll
  </code></pre>
  
  <p>And modified app config so it accepted the version the dlls had:</p>
  
  <pre><code>&lt;startup useLegacyV2RuntimeActivationPolicy="true"&gt;
  &lt;/startup&gt;
  </code></pre>
  
  <p>And imported from VB.NET:</p>
  
  <pre><code>Imports Microsoft.SqlServer.Management.Smo
  Imports Microsoft.SqlServer.Management.Common
  </code></pre>
  
  <p>And the program recognizes every word except Server:</p>
  
  <pre><code>Dim fileInfo As New FileInfo(fi.FullName)
  Dim script As String = fileInfo.OpenText().ReadToEnd()
  Dim connection As New SqlConnection(sqlConnectionString)
  Dim server As New Server(New ServerConnection(connection))
  server.ConnectionContext.ExecuteNonQuery(script)
  </code></pre>
  
  <p>It says:</p>
  
  <pre><code>'Type Server is not defined'
  </code></pre>
  
  <p>Thus the program fails. Any ideas of what is going on? I'm pretty sure an identical scenario is working on a test project on another computer, I don't know why this isn't working. Thanks.</p>
  
  <p>UPDATE:</p>
  
  <p>I tried bringing the dlls from the computer that has this program working to here, and Smo contained Server, so there were no errors. But when I built the program it's like the dlls changed during runtime or something, because suddenly Server is marked as an error again and Smo doesn't contain it anymore, why is this happening?</p>