0

i've got a .net Standard 2.0 dll with a com Interface which i am calling from VBA:

Set xExample = New Example.Example_COM

Response = MsgBox(xExample.Function01("A"))

It works, everything is fine. But now i am Adding my own nuget Package(net standard) into Example DLL and calling a function from this Nuget Package. But now i get an Error in VBA:

Could not load file or assembly "Logging, Version 0.0.0.0"......

First: I dont know why it doesn't have the proper Version number Second: the Logging.dll should be via nuget in the Example.DLL. It crashes as soon as I am calling something from the Logging Nuget....

Everything is signed and has strong names... Somebody has an Idea?

Update: The Example Config

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup Label="Globals">
    <SccProjectName>SAK</SccProjectName>
    <SccProvider>SAK</SccProvider>
    <SccAuxPath>SAK</SccAuxPath>
    <SccLocalPath>SAK</SccLocalPath>
  </PropertyGroup>

  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <Company>OwnCompany</Company>
    <Description>OwnCompany.Example - Description</Description>
    <Copyright>Copyright © 2020</Copyright>
    <PackageId>OwnCompany.Example</PackageId>
    <RootNamespace>OwnCompany.Example</RootNamespace>
    <Version>2.0.100</Version>
    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
    <SignAssembly>true</SignAssembly>
    <AssemblyOriginatorKeyFile>Example.snk</AssemblyOriginatorKeyFile>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="OwnCompany.Logging" Version="2.2.109" />
  </ItemGroup>

</Project>
S.Schmitt
  • 13
  • 6
  • https://stackoverflow.com/questions/51155274/copy-all-dependencies-from-net-standard-libraries-to-net-framework-console-app – Hans Passant Sep 14 '20 at 08:56
  • @HansPassant thanks for the input. Used it in the Example Class. sadly didn't help. Maybe to clarify: i have an Excel Sheet with VBA open to call the comClass which also calls a Method from a NugetPackage and then i get the error. – S.Schmitt Sep 14 '20 at 09:05
  • Next problem you'll have is that the runtime looks in the wrong place for the dependent assembly. It looks in the GAC first, the directory that contains the .exe (the Office directory) next. *Not* in the directory that contains the main assembly that you registered. The usual workarounds get difficult with a .netstandard assembly, AppDomain.AssemblyResolve is about all you got. – Hans Passant Sep 14 '20 at 09:39

0 Answers0