dotnet publish profile CLI vs Visual Studio behave different
我有一个dotnet core 2.1 Web API项目,该项目的发布配置文件到一个文件夹,最近我打算像dotnet publish文档中一样复制到IIS。
我用VS创建了发布配置文件,结果文件为
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | <?xml version="1.0" encoding="utf-8"?> <!-- This file is used by the publish/package process of your Web project. You can customize the behavior of this process by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121. --> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <WebPublishMethod>FileSystem</WebPublishMethod> <PublishProvider>FileSystem</PublishProvider> <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration> <LastUsedPlatform>Any CPU</LastUsedPlatform> <SiteUrlToLaunchAfterPublish /> <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish> <ExcludeApp_Data>False</ExcludeApp_Data> <TargetFramework>netcoreapp2.1</TargetFramework> <RuntimeIdentifier>win-x64</RuntimeIdentifier> <ProjectGuid>b3155c62-817f-4eba-8856-e5941137f4ed</ProjectGuid> <SelfContained>true</SelfContained> <_IsPortable>false</_IsPortable> <publishUrl>bin\\publish\\</publishUrl> <DeleteExistingFiles>True</DeleteExistingFiles> </PropertyGroup> </Project> |
如果我从VS运行配置文件,它将创建一个
如果在更新到最新的VS之后对
epos\\ASG.DHW.HealthCheck\\ASG.DHW.HealthCheck.API\\ASG.DHW.HealthCheck.API.csproj]
我可以在cmd中实现类似的操作
这是怎么回事,为什么从CLI调用时配置文件的行为不相同?
我认为您(已更新)问题的关键可能在错误消息的此部分中:
Self-contained applications are required to use the application host. Either set SelfContained to false or set UseAppHost to true.
行为上的差异可以很容易地用许多事情来解释,例如,各种VS条件带来的MSBuild目标文件。
由于您不想使用AppHost,因此需要将
打开/打开MSBuild详细信息是获取更多数据的好方法,以帮助您了解操作为何具有可观察到的结果。