Where to place dlls for unmanaged libraries?

前端 未结 5 534
生来不讨喜
生来不讨喜 2020-12-30 22:52

I am trying to create a Nuget package for a library that depends on ghostscript and therefore references gsdll32.dll - an unmanaged library. I can\'t just included that a st

5条回答
  •  -上瘾入骨i
    2020-12-30 23:08

    Add a build folder to the package and, if the package for example has the id MyPackage, add a MSBuild target file called MyPackage.targets to this folder. It is important that the .targets file has the same name as the .nuspec file. In the .nuspec file you must have a section like this:

    
        
        
    
    

    This will add an MSBuild element in the project file pointing to the .targets file.

    Furthermore, to only register the managed dlls, add a section like this:

    
        
    
    

    The .targets file should look something like this:

     
     
       
         
           
         
         
         
       
    
    

    Now, all files - including unmanaged files - will be copied to the project output folder (e.g. \bin\debug) after the build.

提交回复
热议问题