<p>I have a small app which references the Microsoft.SqlServer.Smo assembly (so I can display to the user a list of servers &amp; databases to which they can connect).</p>

<p>My application originally referenced Microsoft.SqlServer.Smo and Microsoft.SqlServer.ConnectionInfo. Things worked as expected on my dev box.</p>

<p>When I installed the application on a test machine, I received a <strong>System.IO.FileNotFoundException</strong>. The details of the message included the following:
<strong>Could not load file or assembly Microsoft.SqlServer.SmoEnum</strong></p>

<p>I eventually resolved the issue by referencing the following assemblies in addition to the  ones mentioned above:  </p>

<ul>
<li>Microsoft.SqlServer.SmoEnum</li>
<li>Microsoft.SqlServer.SqlEnum</li>
<li>Microsoft.SqlServer.BatchParser</li>
<li>Microsoft.SqlServer.Replication</li>
</ul>

<p>Can anyone confirm that I do indeed need to include each of these additional assemblies in my application (and therefore install them on user's machines) even though the app builds fine on my development box without them referenced?</p>

[{'answer_id': 77343, 'author': 'Omer van Kloeten', 'author_id': 4979, 'author_profile': 'https://Stackoverflow.com/users/4979', 'pm_score': 0, 'selected': False, 'text': "<p>Since JIT links to external assemblies at run-time, this question can't be answered without analyzing your code and seeing what you call and in turn, what those calls call, etc.</p>\n\n<p>If you want to analyze this yourself, your best bet would be to reference only the assembly you need and then to learn from the exceptions and inner-exceptions what happened.</p>\n\n<p>Another thing you should look into is why the four assemblies you mention aren't in the GAC. It sure seems like they should be.</p>\n"}, {'answer_id': 77366, 'author': 'David J. Sokol', 'author_id': 1390, 'author_profile': 'https://Stackoverflow.com/users/1390', 'pm_score': 3, 'selected': True, 'text': '<p>Yes, they do need to be included.  On the development machine you probably have SQL Server installed, which places those assemblies into the Global Assembly Cache.  Whenever you build, Visual Studio just pulls from them from the GAC.  It also assumes that the GAC of whatever computer it will be deployed on will also have those files.  If not, it throws the FileNotFound exception.</p>\n'}, {'answer_id': 5808451, 'author': 'ebol2000', 'author_id': 407188, 'author_profile': 'https://Stackoverflow.com/users/407188', 'pm_score': 0, 'selected': False, 'text': '<p>For me this answer turned out not to be true. I added the above references but with no resolution. Ultimately I found that I only needed the reference:</p>\n\n<p>Microsoft.SqlServer.Smo</p>\n\n<p>... and the following resolution:</p>\n\n<p><a href="https://stackoverflow.com/questions/41449/i-get-a-an-attempt-was-made-to-load-a-program-with-an-incorrect-format-error-on/2926982#2926982">I get a &quot;An attempt was made to load a program with an incorrect format&quot; error on a SQL Server replication project</a></p>\n\n<p>To summarize, I needed to enable my IIS 6 to enable 32bit application on IIS App pool.  This is because I had Win 7 x64 but a SQL x86 install.  Too bad the error message can\'t be more specific huh?</p>\n'}, {'answer_id': 23634105, 'author': 'Erti-Chris Eelmaa', 'author_id': 1936622, 'author_profile': 'https://Stackoverflow.com/users/1936622', 'pm_score': 2, 'selected': False, 'text': '<p>You need to install two MSI files on a target machine, namely:</p>\n\n<p>1) SQLSysClrTypes.msi [this one is needed for C# -> SMO GAC]</p>\n\n<p>2) SharedManagementObjects.msi</p>\n\n<p>For SQL Server 2014 you can dowload these <a href="http://www.microsoft.com/en-us/download/details.aspx?id=42295" rel="nofollow">here</a>.</p>\n\n<p>Also, you must make sure that the version is correct. These two files can be found with a little bit of googling. This way you don\'t copy anything to local &amp; they will be resolved from GAC. </p>\n\n<p>I know that this is old question, but the answers weren\'t satisfactory. </p>\n'}]
['https://Stackoverflow.com/questions/76933', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2833/']