bloudraak
bloudraak

Reputation: 6002

ASP.NET Core 1.1 Development on RedHat Enterprise Linux 7.3

I'm have an an ASP.NET Core application that was created using Visual Studio 2017 on Windows 10. It works as expected running the following commands

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

See build.cmd in the repository for more details.

My next objective is to create a build.sh for RHEL 7, which would end up with an RPM (but that is outside the scope of this question). To prepare for that I did the following:

  1. Create an RHEL 7.3 virtual machine in VMware Workstation
  2. Followed the instructions to install dotnet core 1.1 in the VM.

I then ran the following commands on Windows 10 to create a self-contained deployment.

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

I then SFTP the output over to the VM and the application works as expected.

I then cloned the GIT repository to the RHEL VM and then ran the following commands, assuming that it would work the same way it did for Windows.

cd src  
dotnet restore  
dotnet build  

However it failed with the following errors:

[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]$  

This looks rather suspicious. So I logged out and logged back in and the ran the following commands:

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

On Windows, the version returns the following:

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

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

To validate, I ran the following as 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 

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? .

Upvotes: 1

Views: 570

Answers (1)

omajid
omajid

Reputation: 15213

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

It doesn't. The original release of .NET Core 1.0 had an RC version of CLI (or the SDK, if you will). This was packaged as rh-dotnetcore10 (and later an updated version was rh-dotnetcore11).

Due to compatibility requirements, RHEL packages can not break the command line interface and API.

The 1.0 SDK changed how the command line behaves and the project format; as such it was not suitable for inclusion into RHEL since it would break people's existing workflow and require migration from project.json to csproj.

As such, the RHEL packages contain the latest APIs (corefx and/or coreclr) but the older RC-era 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?

Unfortunately, there's no good path forward right now. Some options include:

  • Using an upstream install of dotnet, something which won't be supported by Red Hat since it's not the official Red Hat package: https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.sh
  • Use the RC version of the SDK on Windows, Visual Studio 2015 (2017 doesn't support project.json) and rh-dotnetcore11 on RHEL.
  • Wait a bit for 2.0 (hopefully releases soon) which should have the new SDK since Red Hat does not aim for compatibility between 1.0 and 2.0.

Upvotes: 1

Related Questions