繁体   English   中英

exe文件在nuget package中的位置和nuspec中的匹配文件标签

[英]location of exe file in nuget package and matching file tag in nuspec

目前我正在手动创建一个 nuget 目录结构,nuspec 并用命令行(nuget.exe)打包它。

我的问题是一个 exe 文件,该文件旨在添加到引用它的项目的 output 目录中。 exe是插件加载器,引用项目是插件。 当插件被定义为启动项目时,应该启动 exe。

我只是无法将 nuget 中的 exe 放入 output 目录中。

exe放在contentFiles/any/net5.0/the.exe下

nuspec 包含以下标签

<contentFiles>
  <files include="any/net5.0/the.exe" buildAction="None" copyToOutput="true" />
</contentFiles>

如果我将 BuildAction 定义为 Content 编译器会抱怨它是二进制文件而不是文本文件(CS2015)

知道什么会起作用吗?

对于那些偶然发现需要通过 nuget package 打包和分发 an.exe(这不是工具)的人。

nuget 中的结构需要是:

  • the.dll需要在lib/net5.0 (或等效的,取决于您的代码)

  • 以下文件需要放在contentcontentFiles/any/any目录下

    • the.exe
    • the.pdb
    • the.xml
    • the.runtimeconfig.json (不确定,但没有它,exe不会启动)

在生成的 nuget 中,nuspec 如下所示:

<metadata>
   <contentFiles>
      <files include="any/any/the.exe" buildAction="None" copyToOutput="true" />
      <files include="any/any/the.pdb" buildAction="None" copyToOutput="true" />
      <files include="any/any/the.xml" buildAction="None" copyToOutput="true" />
      <files include="any/any/the.runtimeconfig.json" buildAction="None" copyToOutput="true" />
    </contentFiles>
  </metadata>

内容文件将显示在项目根目录下的 Visual Studio 中(dll 除外)。

本问题所示,可以启动分布式 exe。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM