简体   繁体   中英

How to fix managed c++ assembly referencing specific NuGet package delivered dll version (VS2017)

I am building a managed c++ dll (udnet.dll) that references a Nuget package delivered dll

packages.config

<packages>
  <package id="ForeignLanguage" version="2.0.5" allowedVersions="[2,3)" />
</packages>

When consumed in the full build the actual version of ForeignLanguage.dll is 2.0.6 as this has had a small bugfix since udnet.dll was built.

However when udnet.dll is loaded is fails because it is looking for 2.0.5

在此处输入图片说明

How can I build udnet.dll so it is not so fussy about the version of ForeignLanguage? I only really want it to fail if the major version mismatches. ie (2.0.0.0)

Issue was with the ForeignLanguage.dll, I had not set the AssemblyVersion to 2.0.0.0 in AssemblyInfo.cpp

#define VER_FILE_VERSION_STR STRINGIZE(GITVERSION_Major) \
"." STRINGIZE(GITVERSION_Minor) \
"." STRINGIZE(GITVERSION_Patch) \
".0"

#define VER_VERSION_STR STRINGIZE(GITVERSION_Major) \
".0.0.0"

[assembly:AssemblyVersion(VER_VERSION_STR)];
[assembly:AssemblyFileVersion(VER_FILE_VERSION_STR)];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM