Updating assemblies without register

Hi Experts,

I have an application with a reference to Microsoft.SQLServer.BatchParser.dll
I have a problem when I install my application with batchparser (version 9 - SQL2005) and try to update it to batchparser (version 14 - SQL2017)

The assembly is in the directory of the application, but when I try to run the application I get the error message "Could not find file or assembly 'Microsoft.'SqlServer.BatchParser.dll' or one of its dependencies. The specified module could not be found".

Is it possible to update this assembly by copying it to the application directory? Because this is an update, I do not want to manually register or install anything.
I have tried building my application in x86 instead of AnyCPU, but still have the problem.
LIBRALEXAsked:
Who is Participating?
 
Vadim RappCommented:
I tried it on another machine, and indeed saw the error message, But I was able to overcome it by the following:

1. Specify target CPU as x86. This is because with "any cpu", it said "There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "Microsoft.SqlServer.BatchParser, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=x86", "x86"

(in fact, the versoon was 14.100.0.0, not 12.0.0.0)

2. Put msvcp120.dll and msvcr120.dll in the product directory. (С++ 2015 runtime).

I attached these 3 dlls, change .txt to .dll,
Microsoft.SqlServer.BatchParser.txt
msvcp120.txt
msvcr120.txt
1
 
Vadim RappCommented:
Make sure that "copy local" of this reference is set to "yes". After you build the project, verify that it's in the bin directory.
screenshot
0
 
LIBRALEXAuthor Commented:
Hi Vadim,

Thank you for your response. I did check that the Copy Local setting is set to true and that the file is located in the bin folder after building the project.

I searched around and came across this article https://feedback.azure.com/forums/908035-sql-server/suggestions/32898796-smo-nuget-packages-do-not-work-reliably-due-to-a-g#{toggle_previous_statuses}

It seems that SQLBatchParser.dll has to be registered in the GAC. Even though this is not the answer I wanted, it looks like I would need to have this assembly registered by installing SQLSysClrTypes_X86 or SQLSysClrTypes_X64 from https://www.microsoft.com/en-us/download/details.aspx?id=55992 if I want to update my clients to SQL2017
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Vadim RappCommented:
I created new solution, added Microsoft.sqlserver.batchparser 14.0.3025.34, added some trivial code creating the object from it, and it worked without any errors. I attached it, renamed to .txt.
Microsoft.SqlServer.BatchParser.txt
0
 
LIBRALEXAuthor Commented:
Hi Vadim,

Thank you for your effort, but let me explain where I am having an issue. It works perfectly on the development machine, but when I create a clean virtual machine instance and install the application on it, I get the error message that it cannot find Microsoft.SqlServer.BatchParser.

Would you be able to test your application on a machine where no SQL Server or Visual Studio has been installed? I'd like to hear your feedback.

Regards,
Stefan
0
 
Vadim RappCommented:
Sure, for more realism, can you give some piece of code involving this object, so I make it do something more real? I'm not familiar with what it does.
0
 
Vadim RappCommented:
(let's see if it works out)
0
 
LIBRALEXAuthor Commented:
Thanks for the help Vadim, it seems I only needed msvp120.dll and msvr120.dll to exist in the installation directory for it to pick up the batchparser.dll
0
All Courses

From novice to tech pro — start learning today.