Why does my .NET Standard NuGet package trigger so many dependencies?

前端 未结 4 961
不思量自难忘°
不思量自难忘° 2020-11-29 01:30

I\'ve been mucking about with a .NET Standard project and NuGet. I\'ve got a working project and have uploaded it to NuGet.org. My project targets .NET Standard 1.3, which s

4条回答
  •  隐瞒了意图╮
    2020-11-29 02:08

    If you're on .NET 4.6 and you're trying to figure out which ones you need to deploy, search your CSPROJ file for \System. (not a regex) - they are the ones in packages that need to be copied with your app, the rest should be framework DLLs.

    To test this theory get rid of them in your local build and run that to make sure the deployed version won't break...

    • In the bin folder, do dir /b System*.dll > textfile.txt to get a list of the DLLs.
    • inserted "DEL " in front of all the names,
    • I also found Microsoft.Win32.Primitives.dll & netstandard.dll which weren't needed in 4.6 either.
    • and save it as a .CMD file - uh, not in the bin folder ok?
    • add it as a post-build process. $(ProjectDir)DeleteSuperfluousSystemDlls.cmd

    I'd love to get off .NET 4.6 but AutoCAD breaks badly when the framework is too modern for it.

    edit...

    Here is some copy-paste ...

    Step 1 - in your CSPROJ file ...

    
      
      
        
          
          
          
          
        
        
          
        
      
      
        
      
    

    Step 2. The batch file ...

    Edit the list created by dir /b System*.dll > textfile.txt to look a lot like

    del %1Microsoft.Win32.Primitives.dll
    del %1netstandard.dll
    del %1System.AppContext.dll
    del %1System.Collections.Concurrent.dll
    del %1System.Collections.dll
    del %1System.Collections.NonGeneric.dll
    del %1System.Collections.Specialized.dll
    del %1System.ComponentModel.dll
    

    but don't forget to remove the ones actually need so they don't get deleted.

提交回复
热议问题