网站建设需要提供的资料,物流企业网站建设与管理规划书,石家庄网站制作设计,网站没有流量怎么回事ASP.NET Core 发布的具体操作 下面使用C# 编写的ASP.NET Core Web项目示例说明发布的全过程。 1、创建项目 选择“文件” “新建” “项目”。 在“添加新项目”对话框中#xff0c;在“已安装” “Visaul C#” “Web” 项目类型窗格中选择“ASP.NET Core Web 应用…ASP.NET Core 发布的具体操作 下面使用C# 编写的ASP.NET Core Web项目示例说明发布的全过程。 1、创建项目 选择“文件” “新建” “项目”。 在“添加新项目”对话框中在“已安装” “Visaul C#” “Web” 项目类型窗格中选择“ASP.NET Core Web 应用程序”在“名称”文本框中输入项目名称如“MmPS”点击 确定如下图1然后在中心窗格中选择“Web应用程序(模型视图控制器)”模板 然后选择“确定”按钮如下图2。 图1 图2 2、添加Web项目应用程序的源代码的各种逻辑 本项目是已经建好的无需创建。此步骤省略。 3、发布Web项目 发布已经完善的Web项目应用程序首先是定义应用的目标平台。 1、编辑项目资源 在“解决方案资源管理器”中右键单击项目而非解决方案然后选择“编辑 MmPS.csproj”。在MmPS.csproj文件该文件用于定义应用的目 PropertyGroup 部分中添加RuntimeIdentifiers 标记然后指定每个目标平台的运行时标识符 (RID)。 请注意如果是多个系统还需要添加分号来分隔 RID。 不同系统的RID会不同具体请查看运行时标识符目录获取运行时标识符列表。例如以下示例表明应用在 64 位 Windows 10 操作系统和 64 位 OS X 10.11 版本的操作系统上运行。 在MmPS.csproj文件中添加 PropertyGroup RuntimeIdentifiersubuntun.16.04-x64;osx.10.11-x64 /RuntimeIdentifiers /PropertyGroup 2、发布应用 调试并测试程序后为应用的每个目标平台创建要与应用一起发布的文件。从Visual Studio发布应用执行以下操作 l 在“解决方案资源管理器”中右键单击项目而非解决方案然后选择“发布”如下图3。 l 在“发布”选项卡上选择“发布”。 Visual Studio将包含应用程序的文件写入本地文件系统。“发布”选项卡现在显示单个配置文件 FolderProfile。 该配置文件的配置设置显示在选项卡的“摘要”部分。目标运行时用于标识已发布的运行时目标位置用于标识独立部署文件的写入位置。 l 默认情况下Visual Studio 将所有已发布文件写入单个目录。 为了方便起见最好为每个目标运行时创建单个配置文件并将已发布文件置于特定于平台的目录中。 这包括为每个目标平台创建单独的发布配置文件。 l 根据平台单独发布应用程序 现在执行下列操作为每个平台重新生成应用程序 1、在“发布”对话框中选择“创建新配置文件”。 在“选取发布目标”对话框中将“选择文件夹”位置更改为 bin\Release\PublishOutput\ubuntun.16.04-x64。 选择“确定”。 在配置文件列表中选择新配置文件 (FolderProfile1) 并确保“目标运行时”为 ubuntun.16.04-x64。 如果不是请选择“设置”。 在“配置文件设置”对话框中将“目标运行时”更改为 ubuntun.16.04-x64然后选择“保存”。 否则选择“取消”。 2、选择“发布”发布 64 位 ubuntun.16.04平台的应用。 3、其他平台类似操作即可 再次按照上述步骤创建 osx.10.11-x64 平台的配置文件。 “目标位置”为 bin\Release\PublishOutput\osx.10.11-x64“目标运行时”为 osx.10.11-x64。Visual Studio 分配给此配置文件的名称是 FolderProfile2。 请注意每个目标位置中都包含启动应用所需的完整文件集既包含应用文件又包含所有 .NET Core 文件。同时与应用程序的文件一起发布过程将发出包含应用调试信息的程序数据库 (.pdb) 文件。 该文件主要用于调试异常。 可以选择不使用应用程序文件打包该文件。 但是如果要调试应用的发布版本则应保存该文件。 4、可以把已经发布的文件部署到其他系统中了 例如可以使用简单的 copy 命令将其打包为 Zip 文件或者使用选择的安装包进行部署下面会把发布的文件部署到ubuntun.16.04-x64。 下面是本项目完整的 MmPS.csproj 文件。 Project SdkMicrosoft.NET.Sdk.Web PropertyGroup LabelGlobals SccProjectNameSAK/SccProjectName SccProviderSAK/SccProvider SccAuxPathSAK/SccAuxPath SccLocalPathSAK/SccLocalPath /PropertyGroup PropertyGroup TargetFrameworknetcoreapp2.0/TargetFramework RuntimeIdentifiersubuntun.16.04-x64;osx.10.11-x64/RuntimeIdentifiers /PropertyGroup ItemGroup Compile RemoveModels\authority.cs / Compile RemoveModels\log.cs / Compile RemoveModels\menu.cs / Compile RemoveModels\module.cs / Compile RemoveModels\nodes.cs / Compile RemoveModels\roles.cs / Compile RemoveModels\source.cs / Compile RemoveModels\TestUser.cs / Compile RemoveModels\user.cs / Compile RemoveModels\userinrole.cs / /ItemGroup ItemGroup Content Removeappsettings.Development.json / Content RemoveViews\Index.cshtml / /ItemGroup ItemGroup None RemoveModels\MMPS.txt / None RemoveProperties\PublishProfiles\CustomProfile.pubxml / None RemoveViews\Log.js / None RemoveViews\Log\Log.js / None RemoveViews\OrganizationInfo\OrganizationInfo.js / None RemoveViews\Update\UpdateUpload.js / /ItemGroup ItemGroup Content IncludeViews\Device\Device.js / Content IncludeViews\Log\Log.js / Content IncludeViews\Menu\Menu.js / Content IncludeViews\OrganizationInfo\OrganizationInfo.js / Content IncludeViews\Roles\Roles.js / Content IncludeViews\Source\Source.js CopyToOutputDirectoryNever/CopyToOutputDirectory /Content Content IncludeViews\Update\UpdateUpload.js / Content IncludeViews\UserInfo\UserInfo.js CopyToOutputDirectoryNever/CopyToOutputDirectory /Content /ItemGroup ItemGroup PackageReference IncludeAutoMapper Version6.1.1 / PackageReference IncludeDapper Version1.50.2 / PackageReference IncludeMicrosoft.AspNetCore.All Version2.0.0 / PackageReference IncludeMicrosoft.AspNetCore.Session Version2.0.0 / PackageReference IncludeMicrosoft.EntityFrameworkCore Version2.0.0 / PackageReference IncludeMicrosoft.EntityFrameworkCore.Design Version2.0.0 / PackageReference IncludeMicrosoft.EntityFrameworkCore.Tools Version2.0.0 / PackageReference IncludeMicrosoft.Extensions.Configuration Version2.0.0 / PackageReference IncludeMicrosoft.Extensions.Configuration.FileExtensions Version2.0.0 / PackageReference IncludeMicrosoft.Extensions.Configuration.Json Version2.0.0 / PackageReference IncludeMicrosoft.VisualStudio.Web.CodeGeneration.Design Version2.0.0 / PackageReference IncludeMySql.Data.EntityFrameworkCore.Design Version8.0.8-dmr / PackageReference IncludeNETStandard.Library Version2.0.0 / PackageReference Includenewtonsoft.json Version10.0.3 / PackageReference IncludePomelo.EntityFrameworkCore.MySql Version2.0.0-rtm-10062 / PackageReference IncludeSystem.ComponentModel Version4.3.0 / /ItemGroup ItemGroup DotNetCliToolReference IncludeMicrosoft.VisualStudio.Web.CodeGeneration.Tools Version2.0.0 / /ItemGroup ItemGroup None Includewwwroot\js\kindeditor\kindeditor-all-min.js / None Includewwwroot\js\kindeditor\kindeditor-all.js / None Includewwwroot\js\kindeditor\lang\ar.js / None Includewwwroot\js\kindeditor\lang\en.js / None Includewwwroot\js\kindeditor\lang\ko.js / None Includewwwroot\js\kindeditor\lang\ru.js / None Includewwwroot\js\kindeditor\lang\zh-CN.js / None Includewwwroot\js\kindeditor\lang\zh-TW.js / None Includewwwroot\js\kindeditor\plugins\anchor\anchor.js / None Includewwwroot\js\kindeditor\plugins\autoheight\autoheight.js / None Includewwwroot\js\kindeditor\plugins\baidumap\baidumap.js / None Includewwwroot\js\kindeditor\plugins\clearhtml\clearhtml.js / None Includewwwroot\js\kindeditor\plugins\code\code.js / None Includewwwroot\js\kindeditor\plugins\code\prettify.js / None Includewwwroot\js\kindeditor\plugins\emoticons\emoticons.js / None Includewwwroot\js\kindeditor\plugins\filemanager\filemanager.js / None Includewwwroot\js\kindeditor\plugins\fixtoolbar\fixtoolbar.js / None Includewwwroot\js\kindeditor\plugins\flash\flash.js / None Includewwwroot\js\kindeditor\plugins\image\image.js / None Includewwwroot\js\kindeditor\plugins\insertfile\insertfile.js / None Includewwwroot\js\kindeditor\plugins\lineheight\lineheight.js / None Includewwwroot\js\kindeditor\plugins\link\link.js / None Includewwwroot\js\kindeditor\plugins\map\map.js / None Includewwwroot\js\kindeditor\plugins\media\media.js / None Includewwwroot\js\kindeditor\plugins\multiimage\images\swfupload.swf / None Includewwwroot\js\kindeditor\plugins\multiimage\multiimage.js / None Includewwwroot\js\kindeditor\plugins\pagebreak\pagebreak.js / None Includewwwroot\js\kindeditor\plugins\plainpaste\plainpaste.js / None Includewwwroot\js\kindeditor\plugins\preview\preview.js / None Includewwwroot\js\kindeditor\plugins\quickformat\quickformat.js / None Includewwwroot\js\kindeditor\plugins\table\table.js / None Includewwwroot\js\kindeditor\plugins\template\template.js / None Includewwwroot\js\kindeditor\plugins\wordpaste\wordpaste.js / /ItemGroup ItemGroup ProjectReference Include..\DownloadHelper\DownloadHelper.csproj / ProjectReference Include..\MmPS.Application\MmPS.Application.csproj / ProjectReference Include..\MmPS.Common.Data\MmPS.Common.Data.csproj / ProjectReference Include..\MmPS.EntityFrameworkCore\MmPS.EntityFrameworkCore.csproj / /ItemGroup ItemGroup Folder IncludeProperties\PublishProfiles\ / /ItemGroup ItemGroup Content Updatewwwroot\js\views\source.js CopyToOutputDirectoryNever/CopyToOutputDirectory /Content Content Updatewwwroot\js\views\userInfo.js CopyToOutputDirectoryNever/CopyToOutputDirectory /Content /ItemGroup ProjectExtensionsVisualStudioUserProperties bower_1json__JSONSchema //VisualStudio/ProjectExtensions /Project 转载于:https://www.cnblogs.com/1175429393wljblog/p/8329707.html