ASP.NET Core 1.0 First steps

In this week at last I installed Visual Studio 2015 on my computer.

Then I installed Asp.NET Core 1.0 RC1(Release Candidate 1), which was released in November 2015. According to the roadmap RTM(Ready To Manufacture) version should be available approximately Q3 2016.

I run Visual Studio and add new project ASP.NET 5 to my solution. I chose authentication as Individual User Accounts and after project creation let nuget restore many packages including EF7.

When I clicked to Debug my app on IIS Express, Visual opens browser with new page, but what is interesting in Visual I can see Diagnostic Tools bookmark:

Diagnostic Tools

It shows diagram of memory usage by process, when GarbageCollector runs, which generation, duration of run and if was forced/unforced(show it after mouse hover the yellow object). It also shows percentage of all processors usage. Cool!

Short description of project’s components is on docs asp dot net.

To run web page without using Visual Studio, then DNX(Microsoft .NET Execution Environment) must be used. It provides host process, CLR hosting logic and can run also other types of .NET apps.

More about DNX, DNU, DNVM and other ASP.NET names You can read there.

I have published my newly created website to Azure on financialdata azurewebsites net

Choosing project licence, is it really simple?

I have to admit, that I’ve never before think about choosing licence for my projects, but this time setting up new project on GitHub I decided to stay longer on choosing licences from given list(picture below). I have made this decision, because I wanted to learn sth new about differences in using many types of licences.

licenses

At the beggining I know, that my project has to be open source. GitHub created very helpfull page with great address choose a license dot com, where are expleined the differences between MIT, Apache 2.0 and GNU v3.0.

  • MIT – short liberal licence. It lets people do anything they want with your code as long as they provide attribution back to you and don’t hold you liable. Examples of usage: jQuery and .NET Core
  • Apache 2.0 – similar to MIT with difference, it provides an express grant of patent rights from contributors to users. Examples of usage: Apache, Swift and Android.
  • GNU v3.0 – requires anyone who distributes your code or a derivative work to make the source available under the same terms(read also open source in my case). Examples of usage: WordPress, Linux, and Bash

When licences are used there is need to attach copyright header at the beginning of the every source file included in the project. Content of the licence also should be included among project files.

This time I chose None licence (I think my choice was dictated by the fact, that I’m lazy), which is equivalent with choosing Public Domain licence. That’s mean everyone can change my code and apply it to own projects, but I do not have obligation to insert copyright headers to my code files 🙂

During project development I may change decision and choose other licence kind.

Let’s the party begin

Some time ago with my good friend I wrote an application, which uses financial data for Polish equity market. Unfortunatelly, as it comes to most of homemade projects, work on this project was suspended, before the project started to presented some value added. My friend let me to reuse part of this application in the competition Daj się poznać.

At the begining I am going to write about some little problems upon migration of existing project. I copyied project files from existing solution to newly created solution. Then problems occurs.

First of all NuGet compilation problem:

Error 1 This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is \.nuget\NuGet.targets.

One look at the packages folder(where NuGet downloads packages) and all packages were properly downloaded. One little question to „uncle google” gave me the answer from stackoverflow. After removing appropriate lines from *.csproj and repeated the operation on Test project, solution becames properly compile. JUUUUPI 🙂

I changed some class names and then next problem arise. Class name and the same namespace name bode problems, indeed. In this case when creating system under test in the test project there should be used code sth like this:
sut = new NewsService.NewsService(…)
That means there is a need to repeat name. I am not proud of it, but for now I have to leave it in that form.

And finally the last problem. I run unit tests and… FAIL. Auuuu… So it ends, when CI(Continuous Integraion) is not used in the project. Tests are run from time to time, instead of after every little code change. I must put effort to implement apps with TDD.

Problem with unit tests was due to use RhinoMocks IgnoreArguments() method. I also gave method parameters and of course parameters were ignored, a few minutes of life vanished 😉

Problems with app import solved. Keep fingers crossed for evolution of my project in the competition 🙂