且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我可以将本机依赖项放在子文件夹中吗

更新时间:2023-10-28 10:47:46

据我所知,你有一个 Standalone (SCD) 应用程序.

As far as I can see you have a Standalone (SCD) app.

对于这种类型的部署,hostfxr.dll 应始终存在于应用程序目录中.

For that type of deployment hostfxr.dll should always exist in the app directory by convention.

对于其他 deps,您可以将它们移动到任何位置,但是您需要为每个构建编辑 [AppName].deps.json 并指定附加探测路径.此外,如果您确定不使用它们,您可以***地删除所有冗余依赖项(从 deps.json 和文件本身).

As to other deps, you are able to move them to any locations, however you'll need to edit [AppName].deps.json for every build and also specify Additional probing paths. Besides, you are free to remove all the redundant dependencies (from deps.json and the file itself) if you are sure that you don't use them.

检查这个演示,其中我已经放置了Standalone的所有依赖项> 可以移动到其他位置到 lib 子目录的应用.

Check this demo where I've put all the dependencies of a Standalone app that could be moved to other location to a lib subdirectory.

请注意以下事项:

  • 附加探测路径在 HelloWorld.runtimeconfig.json 但你也可以使用 --additionalprobingpath [path] 参数或环境变量
  • 我已经删除了 deps.json 文件中的相对路径,否则我会将文件放在这些相对路径子目录中 - 附加探测路径被认为是 NuGet 包缓存 因此在里面有一个包布局.
  • Additional probing path is set in HelloWorld.runtimeconfig.json but you can also use --additionalprobingpath [path] argument or Environment varibable
  • I've removed relative paths in deps.json file because otherwise I would have put the files to those relative paths sub directories - Additional probing path is considered to be a NuGet package cache thus have a package layout inside.

另外,考虑使用 Portable (FDD) 类型.您将有更少的占用空间和更大的灵活性来安排文件.

Also, consider having a Portable (FDD) type. You'll have a much less footprint and more flexibility arranging the files.