我一直在尝试遵循多个(example)教程,以了解如何将asp.net Web API放置到Docker镜像上。并且几乎所有人都使用docker文件,在其中执行以下命令dotnet [csproj name] -c Release -o out
,然后最终将信息从该文件复制到另一个文件夹。但是,我一直遇到找不到该文件夹的问题。因此,我决定在本地使用此命令,令我惊讶的是,从未生产出out文件夹,也未构建任何东西。
当我们查看it上dotnet publish
的文档时,我们可以看到它显示以下内容:
Packs the application and its dependencies into a folder for deployment to a hosting system.
和
-o|--output <OUTPUT_DIRECTORY>
Specifies the path for the output directory. If not specified, it defaults to ./bin/[configuration]/[framework]/publish/ for a framework-dependent deployment or ./bin/[configuration]/[framework]/[runtime]/publish/ for a self-contained deployment. If the path is relative, the output directory generated is relative to the project file location, not to the current working directory.
是的,我已经尝试了here的几乎所有解决方案。
在我看来,该命令应该创建一个新文件夹,所有发布的文件都放入其中。所以我的问题是:我错了吗,或者这里有问题吗?该问题的解决方案是什么?
最佳答案
是的,它将创建输出文件夹,但是在.NET Core 3.0工具发布之前,所有非绝对路径都将相对于项目目录进行解释。
因此,直到3.0,dotnet publish subdir(project.csproj -o otherdir
将创建一个subdir/otherdir
目录。
另请注意,dotnet publish
将在其输出中打印发布至的路径。
关于c# - 发布Web API时Dotnet发布不会创建文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52893528/