CORECRM Development Record--travis-ci achieve. NET Core level Build and test on MacOS [anhydrous dry]

Source: Internet
Author: User
Tags dotnet install openssl stack trace xunit

Ape Tutorial _-webapi Tutorial-webapi Tutorial

Ape Tutorial _-webapi Tutorial-web API Overview

Ape Tutorial _-webapi Tutorial-new Web API project

Ape Tutorial _-webapi Tutorial-Test web API

Ape Tutorial _-webapi Tutorial-web API Controller

Ape Tutorial _-webapi Tutorial-Configuring the Web API

Ape Tutorial _-webapi tutorial-web API Routing

Ape Tutorial _-webapi Tutorial-parameter binding

Ape Tutorial _-webapi Tutorial-action method return type

Ape Tutorial _-webapi Tutorial-web API request/response data format

Ape Tutorial _-webapi Tutorial-Media Formatter

Ape Tutorial _-webapi Tutorial-web API Filter

Ape Tutorial _-webapi Tutorial-Create a Web API interface with CRUD operations-Part One

Ape Tutorial _-webapi Tutorial-Creating a Web API interface with CRUD Operations 2: Implementing the Get Method

Ape Tutorial _-webapi Tutorial-Creating a Web API interface with CRUD Operations 3: Implementing the Post method

Ape Tutorial _-webapi Tutorial-Creating a Web API interface with CRUD Operations 4: Implementing the Put method

Ape Tutorial _-webapi Tutorial-Creating a Web API interface with CRUD Operations 5: Implementing the Delete method

The previous article I mentioned: in order to use "domestic", I put Linux on the construction and testing entrusted to the Daocloud, and Travis-ci can not be put. Fortunately, this cargo supports MacOS system. So just give it the CORECRM build and test task on MacOS.

I think there have been a lot of writing in the country how to use Travis-ci blog article, I do not need to crap here more. Of course, the best articles are actually TRAVIS-CI documents; The best help is on StackOverflow and GitHub. If still feel that their English is not enough to read these stations, I think there are only two ways to choose: 1. learn English well; 2. Quit being a programmer.

What I want to record here is the two issues that you encounter when building Corecrm with Travis-ci. In my process of solving both of these problems, I found that in this is two very common issues, basically in the current ". NET Core" version (Microsoft.NETCore.App 1.1.0), is two sure to encounter the problem. After I synthesized a lot of GitHub issue, I took 10 commits to solve these two problems.

1. OpenSSL is not installed

The first problem encountered is that the following exception occurred while executing dotnet restore:

Unhandled Exception:System.TypeInitializationException:The type initializer for ' Crypto ' threw an Exception. ---> System.TypeInitializationException:The type initializer for ' Cryptoinitializer ' threw an exception. ---> System.DllNotFoundException:Unable to load DLL ' System.Security.Cryptography.Native ': the specified module    Could not being found. (Exception from hresult:0x8007007e) at Interop.CryptoInitializer.EnsureOpenSslInitialized () at Interop.cryp Toinitializer. Cctor ()---End of inner exception stack trace---at interop.crypto.        Cctor ()---End of inner exception stack trace---at Interop.Crypto.GetRandomBytes (byte* buf, Int32 num)        At System.IO.Path.GetCryptoRandomBytes (byte* bytes, Int32 byteCount) at System.IO.Path.GetRandomFileName () At Microsoft.DotNet.InternalAbstractions.TemporaryDirectory.      ctor () at Microsoft.Extensions.EnvironmentAbstractions.DirectoryWrapper.CreateTemporaryDirectory ()  At Microsoft.DotNet.Configurer.NuGetPackagesArchiver.        ctor () at Microsoft.DotNet.Cli.Program.ConfigureDotNetForFirstTimeUse (Inugetcachesentinel nugetcachesentinel) At Microsoft.DotNet.Cli.Program.ProcessArgs (string[] args, Itelemetry telemetryclient) at Microsoft.DotNet.Cli.Pr Ogram. Main (string[] args)/users/travis/build.sh:line 57:5310 Abort trap:6 dotnet Restore Corecrm

This problem is due to the fact that the dynamic library of OpenSSL Libssl is not properly installed. In the TRAVIS-CI environment, it is supported to use Homebrew to install missing components, but one problem is that OpenSSL needs to be manually link to /usr/local/lib/to use. I started using the link feature provided by Homebrew and did not solve the problem, only using ln to solve it myself:

before_install:-Brew Install openssl-ln-s/usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib/usr/local/lib/-ln-s/ usr/local/opt/openssl/lib/libssl.1.0.0.dylib/usr/local/lib/

The above problem can be solved by adding the above ' before_install ' to the corresponding position. (It took about 3 hours to solve the problem)

2. Too many open files

Each system limits the number of files that a process can open for performance and security reasons. But MacOS's limitations seem to be particularly strict. After the completion of the restore process, the test is supposed to be executed. The result is that you have encountered the following error:

Xunit.net. NET CLI Test Runner (64-bit. NET Core osx.10.12-x64) unhandled Exception:System.IO.IOException:Too many open F Iles at    Interop.throwexceptionforioerrno (errorinfo errorinfo, String path, Boolean isdirectory, Func ' 2 Errorrewriter) at    Interop.checkio[tsafehandle] (tsafehandle handle, String path, Boolean isdirectory, Func ' 2 Errorrewriter) at    Microsoft.Win32.SafeHandles.SafeFileHandle.Open (Func ' 1 fdfunc)    at System.ConsolePal.OpenStandardOutput () at    Xunit.Runner.DotNet.Program.UseTestSinksWithStandardOutputStreams () at    Xunit.Runner.DotNet.Program.Run (string[] args) at    Xunit.Runner.DotNet.Program.Main (string[] args) Summary:total:1 targets, passed:0, failed:1.

Some of the solutions that were found at the beginning may be a bit of a long time, and are aimed at some of the methods under Mono, which do not work after the attempt. After further searching, a solution on Stackexchange was found, which was to increase the number of files allowed to open:

script:-ulimit-n 2048-dotnet Test corecrm.integrationtest

In this way, there are too many problems to open the file above to solve the problem.

Complete. Travis.yml please go to my GitHub or coding.net. When I finished writing this article, three CI platforms, and only TRAVIS-CI was configured using the configuration files in the repository. Later I will download the Appveyor and Daocloud configuration files and put them in the repository so that you can use these templates to implement your own CI process. However, at this point in time, I have not done the test to the extreme, but only to see whether all the tests were successful or failed. With the development of the latter, I'll let the end of the test be more detailed to see which tests are out of the question online.

Github:https://github.com/holmescn/corecrm
Coding.net:https://coding.net/u/holmescn/p/corecrm/git

CORECRM Development Record--travis-ci achieve. NET Core level Build and test on MacOS [anhydrous dry]

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.