Yeah I did add the 4 dlls, found in:
C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies
Which are these:
Microsoft.SqlServer.ConnectionInfo.dll
Microsoft.SqlServer.Smo.dll
Microsoft.SqlServer.Management.Sdk.Sfc.dll
Microsoft.SqlServer.SqlEnum.dll
And modified app config so it accepted the version the dlls had:
<startup useLegacyV2RuntimeActivationPolicy="true">
</startup>
And imported from VB.NET:
Imports Microsoft.SqlServer.Management.Smo
Imports Microsoft.SqlServer.Management.Common
And the program recognizes every word except Server:
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)
It says:
'Type Server is not defined'
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.
UPDATE:
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?