jehugaleahsa / mustache-sharp

An extension of the mustache text template engine for .NET.
The Unlicense
306 stars 80 forks source link

.NET Core (>= v1.1) support. #76

Open huchim opened 7 years ago

huchim commented 7 years ago

.NET Core 1.1 was released at november 17 and there are 3 releases more after 1.1 (1.1.1, 1.1.2 & 2.0.0).

This code don't break your current compilation because I created 1 solution mustache-sharp-core.sln with two projects: mustache-sharp\mustache-sharp.csproj and mustache-sharp.test\mustache-sharp-core.test.csproj that include your code.

mustache-sharp.csproj

This project include all files of your original project but the information of nuget is in the project itself and don't use the .nuspec file.

I added directive NETCOREAPP1_1:

Properties\Resources.Designer.cs

The problem with the resource file is that is "auto-generated" and the original version is that use typeof and now we need to use GetTypeInfo(). Visual Studio 2017 generate the file corrrectly but I don't wan't to break the compilation.

I created a copy of the file with de name Resources.Core.resx and the generated file Resources.Core.Designer.cs had a class named Resources_Core.

I added this code to the files, and only works with the net core, so won't break current compilation.

#if NETCOREAPP1_1
using Resources = Mustache.Properties.Resources_Core;
#else
using Mustache.Properties;
#endif

Nuget

All nuget package is in the csproj file, but the nuspec was not touched. I created a powershell script (nuget-version.ps1) that push the package to the nuget. The package is compiled but VisualStudio.com services using my branch (I needed the package "urgently").

I updated nuget.exe to version 3.5.


This is my first pull request and I tried to don't break your current compilation using directives and creating csproj, my main interest on this project is to generate reports with my code using mustache, and your code works nice.

Kind regards

Carlos Huchim Yucatán, México.