dotnet 发布命令未为 asp.net 核心 Web 应用程序项目创建 zip 文件包 [英] dotnet publish command is not creating zip file package for asp.net core web application project

查看:15
本文介绍了dotnet 发布命令未为 asp.net 核心 Web 应用程序项目创建 zip 文件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为 asp.net 核心 Web 应用程序创建一个 Web 部署包.当我尝试使用 VS2017 将输出发布为一个包时,我在发布"文件夹中获得了所有必要的文件以及一个包含给定位置所有这些文件的 zip 文件.

I am trying to create a web deployment package for asp.net core web application. When I tried to publish the output as a package using VS2017, I got all the necessary files in "Publish" folder as well a zip file containing all those files in given location.

但是我想使用命令行也有同样的效果.我可以获取发布"文件夹,但不能获取 zip 文件.我究竟做错了什么?有人可以纠正我的命令吗?

However I want to have the same using command line. I am able to get "Publish" folder, but not a zip file. What am I doing wrong? Can someone correct my command?

dotnet publish /p:target=package /p:WebPublishMethod=Package /p:LastUsedBuildConfiguration=Release /p:LastUsedPlatform="Any CPU" /p:LaunchSiteAfterPublish=True /p:ExcludeApp_Data=False /p:PublishFramework=netcoreapp1.0 /p:UsePowerShell=True /p:DesktopBuildPackageLocation=C:KannanTemppackage.zip /p:PackageLocation="C:kannan	emppackage.zip" /p:PackageFileName=C:kannan	emppackage.zip /p:PackageAsSingleFile=true

推荐答案

我做错了什么?有人可以纠正我的命令吗?

What am I doing wrong? Can someone correct my command?

这取决于您的 cli 版本.

It`s depends on the version of your cli.

如果你使用的是 2.0 版本的 cli,那么你可以在 windows 机器上使用 dotnet publish 命令,它会工作.

If you are using the 2.0 version of cli, then you can use dotnet publish command on a windows machine and it would work.

dotnet build WebApplicationDeploy.sln /nologo /p:PublishProfile=Release /p:PackageLocation="C:SomePathpackage" /p:OutDir="C:SomePathout" /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /maxcpucount:1 /p:platform="Any CPU" /p:configuration="Release" /p:DesktopBuildPackageLocation="C:SomePathpackagepackage.zip"

但是如果您使用的是 1.0.4 版本的 cli,那么您应该使用 msbuild 版本的命令(在 2.0 cli 中添加了调用 dotnet build 的功能).

But if you are using 1.0.4 version of the cli, then you should use the msbuild version of the command (The ability to call dotnet build was added in 2.0 cli).

msbuild WebApplicationDeploy.sln /nologo /p:PublishProfile=Release /p:PackageLocation="C:SomePathpackage" /p:OutDir="C:SomePathout" /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /maxcpucount:1 /p:platform="Any CPU" /p:configuration="Release" /p:DesktopBuildPackageLocation="C:SomePathpackagepackage.zip"

有关详细信息,您可以参考 GitHub 上的相同问题.

For the detail info, you can refer to the same issue on GitHub.

这篇关于dotnet 发布命令未为 asp.net 核心 Web 应用程序项目创建 zip 文件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆