SQLite.Interop.dll files does not copy to project output path when required by referenced project

前端 未结 2 1044
再見小時候
再見小時候 2020-12-03 13:48

I am using the System.Data.SQLite Core Version: 1.0.98.1 nuget package with Visual Studio 2015. When I build my project that references my System.Data.SQLite package, it cop

2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-03 14:24

    The recomended solution as doumented here is to create a System.Data.SQLite.Core.targets.user in your packages\System.Data.SQLite.Core.1.0.98.1\build\[your framework version here] folder containing

    
         
            true
            false
            false
            false
        
    
    

    But if you don't want to add anything in your packages folder to your source control, you can just add the following directly to your project file

     
        true
        false
        false
        false
    
    

    Update for SDK style projects

    In the new SDK project style, there is a change in how dependencies are resolved across nested projects and packages. In the build process, assets are resolved and a obj\project.assets.json file is generated listing the assets from all the various dependencies. The project assets file is then used to determine what targets need to be imported and what files need to be copied to the output directory. There is, however a difference in how assets are included from non-direct dependencies. Target files from the build folder of non-direct dependencies are not imported. The old workaround depends on System.Data.SQLite.Core.targets getting imported into the parent project. Projects that directly depend on System.Data.Sqlite can override this behavior by adding PrivateAssets="none" to the PackageImport. You will also need to add this to each PackageImport or ProjectReference` in your dependency chain. However, you won't need to combine this with the prior workaround.

    TLDR

    In the project that directly references System.Data.Sqlite add PrivateAssets="none" to your PackageImport

    
    

    For each project in your dependency chain up to your root project also addPrivateAssets="none"

    
    

提交回复
热议问题