Include Unmanaged DLL from Nuget package to web Deploy package

前端 未结 1 980
深忆病人
深忆病人 2021-01-27 20:30

I have Nuget package which contains unmanaged DLL and target to copy this DLL to output folder:


    

        
1条回答
  •  感情败类
    2021-01-27 20:50

    Include Unmanaged DLL from Nuget package to web Deploy package

    You can add another target after target AfterBuild in your NuGet package to dynamically include those unmanaged DLL files to your project file or simple add the target to the project file.

    To accomplish this, add a target with target order AfterTargets="AfterBuild" in your NuGet package:

        
        
          
        
      
    

    But this target will add all dll files, including managed dll files. To resolve this issue, we need to change previous target AfterBuild to add another copy task to copy those unmanaged dll files to a separate folder:

      
        
          
        
        
        
      
    

    After add the another copy task to copy the unmanaged dll files to the separate folder $(ProjectDir)UnmanagedDll.

    Then we could change the ItemGroup in the target AddUnmanagedDll to

    So the targets in the NuGet package should be:

      
        
          
        
        
        
      
    
        
        
          
        
      
    

    After publish the project, those unmanaged are included in the web Deploy package:

    0 讨论(0)
提交回复
热议问题