简体   繁体   中英

Add third party COM reference in nuget package

I'm relatively new that whole NuGet package stuff and currently I'm struggling a bit with including a referenced COM DLL.

I have a little Utilities library for Autodesk Inventor. So I included the COM reference.

参考文献

Now I want Visual Studio to automatically create the NuGet package

在此处输入图片说明

So every time I build my project, Visual Studio recreates the .nuspec file and generates the package but unfortunately without adding the referenced Inventor DLL to the lib folder inside the NuGet package. I read a lot about adding it manually or editing the .nuspec file, but is there a more simple solution where Visual Studio will do this part for me?

I'm working with VS2017

Thanks in advance

I read a lot about adding it manually or editing the .nuspec file, but is there a more simple solution where Visual Studio will do this part for me?

Just as Hans said, we do not recommend you build a nuget package for a library that has a dependency on COM server. But if you insist on it, I am afraid you have to do it manually or editing the .nuspec file.

That because its added with <COMReference> not <PackageReference> , we could not use Controlling dependency assets to add those dll file into the NuGet package, and there is no such option on the Visual Studio that we could include that COM dll to the nuget package.

So, to resolve this issue, we have to do it with manually or editing the .nuspec file, you can check following thread for some more details:

Create nuget package from dlls

Hope this helps.

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