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.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.
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
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.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

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.

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.
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=, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=x86", "x86"

(in fact, the versoon was, not

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

I attached these 3 dlls, change .txt to .dll,

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Vadim RappCommented:
(let's see if it works out)
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.