nuspec contentFiles Example

前端 未结 4 755
囚心锁ツ
囚心锁ツ 2021-01-18 02:05

Yesterday NuGet 3.3 was released (release notes) and there is a new contentFiles element supported (docs). However, I can\'t seem to get this working.

I\'m using th

4条回答
  •  广开言路
    2021-01-18 02:24

    @Timothy,

    You were right. It is a combination having a metadata/contentFiles element as well as a definition in the files element. I have a C# test utility library that needs to include PowerShell files in a projects output/bin folder when it is referenced using a PackageReference. I will include the XML below for you. I think you will be able to derive what you need from it.

    Special Note: Be sure to get your language and framework values right in the path (i.e. yours will something like cs/net45/YourFile.cs). I'm using any/any/MyFile.psm1 because I want the file to be treated as language and platform agnostic. If I don't, I get code analysis errors on build.

    Additionally, placing the files in a 'contentFiles' directory is important.

    (language and framework options defined in the .nuspec reference documentation) https://docs.microsoft.com/en-us/nuget/reference/nuspec#including-content-files

    
      
        SomeLibrary
        $version$
        SomeLibrary
        Somebody
        Somebody
        false
        Some library that does things I enjoy.
        
        Copyright 2017
        PowerShell Testing
        
          
          
        
      
      
        
        
        
        
      
    
    

提交回复
热议问题