如何在调试中发布Asp.Net Core 2.2应用程序?

时间:2019-04-03 15:27:59

标签: c# asp.net-core publish

我正在开发Asp.net core 2.2应用程序。我想发布一个测试版本以在本地计算机上进行测试。但是,当我单击它创建的Exe时,会出现此错误:

  

找不到任何兼容的框架版本

     

未找到指定的框架'Microsoft.AspNetCore.App'版本'2.2.0'。

但是当我为Release创建其他发布配置文件但使用相同的设置时,它就可以正常工作。

我不知道为什么会这样。

ToFolderDebug配置文件

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <PublishProvider>FileSystem</PublishProvider>
    <LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish />
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <TargetFramework>netcoreapp2.2</TargetFramework>
    <RuntimeIdentifier>win-x86</RuntimeIdentifier>
    <ProjectGuid>6fd2ee03-2f15-49f8-ad17-c40e5c264add</ProjectGuid>
    <SelfContained>true</SelfContained>
    <_IsPortable>false</_IsPortable>
    <publishUrl>bin\Release\netcoreapp2.2\publish\</publishUrl>
    <DeleteExistingFiles>True</DeleteExistingFiles>
   </PropertyGroup>
</Project>

ToFolderRelease配置文件

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.2</TargetFramework>
    <ProjectGuid>6fd2ee03-2f15-49f8-ad17-c40e5c264add</ProjectGuid>
    <SelfContained>true</SelfContained>
    <_IsPortable>true</_IsPortable>
    <publishUrl>bin\Release\netcoreapp2.2\publish\</publishUrl>
    <DeleteExistingFiles>True</DeleteExistingFiles>
    <RuntimeIdentifier>win-x86</RuntimeIdentifier>
  </PropertyGroup>
</Project>

0 个答案:

没有答案