ASP.NET RedHat Enterprise 上的核心 1.1 开发 Linux 7.3

ASP.NET Core 1.1 Development on RedHat Enterprise Linux 7.3

我有一个 an ASP.NET Core application 是在 Windows 10 上使用 Visual Studio 2017 创建的。它按预期工作 运行 以下命令

cd src  
dotnet restore  
dotnet build 
cd Hello.Portal
dotnet run

有关详细信息,请参阅存储库中的 build.cmd。

我的下一个 objective 是为 RHEL 7 创建一个 build.sh,它将以 RPM 结束(但这超出了这个问题的范围)。为此,我做了以下工作:

  1. 在 VMware Workstation 中创建 RHEL 7.3 虚拟机
  2. 按照instructions在VM中安装dotnet core 1.1。

然后我 运行 在 Windows 10 上执行以下命令以创建独立部署。

dotnet restore --runtime rhel.7-x64  
dotnet publish --framework netcoreapp1.1 --runtime rhel.7-x64  

然后我将输出通过 SFTP 传输到虚拟机,应用程序按预期工作。

然后我将 GIT 存储库克隆到 RHEL VM,然后 运行 以下命令,假设它的工作方式与 Windows 相同。

cd src  
dotnet restore  
dotnet build  

但是失败并出现以下错误:

[werners@localhost src]$ dotnet restore  
warn : The folder '/home/werners/development/hello/src' does not contain a project to restore.  
[werners@localhost src]$ dotnet build  
Couldn't find 'project.json' in current directory  
[werners@localhost src]$  

这看起来很可疑。所以我注销并重新登录并 运行 以下命令:

[werners@localhost ~]$ scl enable rh-dotnetcore11 bash  
[werners@localhost ~]$ dotnet --version  
1.0.0-preview2-1-003176  

在 Windows 上,版本 returns 如下:

S:\hello\src>dotnet --version  
1.0.3  

看来 rh-dotnetcore11 没有最新发布的 .NET core 命令行版本。

为了验证,我 运行 以 root 身份执行以下操作。

[root@localhost ~]# yum install rh-dotnetcore11  
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager  
Package rh-dotnetcore11-1.0-1.el7.x86_64 already installed and latest version  
Nothing to do 

使用 Red Hat Enterprise Linux 7.3 构建、测试、运行 和发布 ASP.NET 使用 Visual Studio 2017 创建的核心应用程序需要遵循哪些说明? .

So it looks like rh-dotnetcore11 doesn't have the latest released version of .NET core command line.

没有。 .NET Core 1.0 的原始版本有一个 RC 版本的 CLI(或者 SDK,如果你愿意的话)。它被打包为 rh-dotnetcore10(后来的更新版本是 rh-dotnetcore11)。

由于兼容性要求,RHEL 包不能破坏命令行界面和API。

1.0 SDK 改变了命令行的行为方式和项目格式;因此它不适合包含在 RHEL 中,因为它会破坏人们现有的工作流程并需要从 project.json 迁移到 csproj。

因此,RHEL 软件包包含最新的 APIs (corefx and/or coreclr) 但较旧的 RC 时代 SDK。

What instructions does one follow to use Red Hat Enterprise Linux 7.3 to build, test, run and publish ASP.NET Core application that was created with Visual Studio 2017?

不幸的是,目前没有好的前进方向。一些选项包括: