skip to Main Content

In my C# project (VS 2022) I had to downgrade a nugget package (OPCLabs.EasyOPC) to an older version due to some functional problems on the new version. Therefore I have uninstalled the nugget package (V5.71) and installed the older version (V5.62).

I can also confirm from the packages under the project tree that 5.62 is installed, and 5.71 is not existing anymore.

After clean and rebuild the project without any Errors, I get when I use a function of the library the Error:
"The system cannot find the file specified.File name: ‘OpcLabs.EasyOpcClassicCore, Version=5.71.401.1, Culture=neutral, PublicKeyToken=6faddca41dacb409’ "

So it is looking for a file of the version that I have uninstalled. I think this is more a problem of Visual Studio 2022 , then a problem of the library, because I could work with the older version without problem in the past.

What can I do? Do I have to remove some rest files manualy?

My Code: (I get the Error as soon as my function is called)

    using OpcLabs.EasyOpc;
    using OpcLabs.EasyOpc.DataAccess;
    using OpcLabs.EasyOpc.OperationModel;

    private async Task Browse_OPC_Servers()
    {
        var client = new EasyDAClient();
        client.InstanceParameters.EnableNetApiClient = false;
        ServerElementCollection serverElements;
        try
        {                
            serverElements = client.BrowseServers("10.92.XXX.XXX");
        }
        catch (OpcException opcException)
        {
            Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message);
            Console.ReadLine();
            return;
        }

        foreach (ServerElement serverElement in serverElements)
        {
            Console.WriteLine($"ServerElements("{serverElement.ClsidString}").ProgId: {serverElement.ProgId}");                
            
        }
        Console.ReadLine();
    }

2

Answers


  1. From VS2022 > Tools > NuGet Package Manager > Package Manager Console > Wait until Package Manager Console visible at bottom of VS2022.

    Example:

    To Uninstall OpcLabs.QuickOpc -Version 5.71.401 (new version)

    • PM> NuGetUnInstall-Package OpcLabs.QuickOpc -Version 5.71.401

    To `Install OpcLabs.QuickOpc -Version 5.63.246 (old version)

    • PM> NuGetInstall-Package OpcLabs.QuickOpc -Version 5.63.246

    Change the Version Number according to your needs, look at here for old version

    Login or Signup to reply.
  2. Approach 1>Go in Solution Explorer –> Right click –> Manage Nuget Packages for Solutions –> See for the right version and install uninstall based on it

    Approach 2>Second is Tools–> Nuget Package Manager–> Package Manager settings–>in this Popup go to
    NugetPackage manager–> Package manager sources
    Select the right url for the package looking for this will be the lookup first the solution will check to sync for the module

    Approach 3> If this also does not work then try manual removal and additional of the package
    Hope this helps!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search