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

查看:58
本文介绍了dotnet publish命令未为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:\Kannan\Temp\package.zip /p:PackageLocation="C:\kannan\temp\package.zip" /p:PackageFileName=C:\kannan\temp\package.zip /p:PackageAsSingleFile=true

推荐答案

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

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

这取决于您的cli版本.

It`s depends on the version of your cli.

如果您使用的是cli的2.0版本,则可以在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:\Some\Path\package" /p:OutDir="C:\Some\Path\out" /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /maxcpucount:1 /p:platform="Any CPU" /p:configuration="Release" /p:DesktopBuildPackageLocation="C:\Some\Path\package\package.zip"

但是,如果您正在使用cli的1.0.4版本,那么您应该使用命令的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:\Some\Path\package" /p:OutDir="C:\Some\Path\out" /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /maxcpucount:1 /p:platform="Any CPU" /p:configuration="Release" /p:DesktopBuildPackageLocation="C:\Some\Path\package\package.zip"

有关详细信息,可以在GitHub上参考同一期.

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

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

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