Closed jimmcslim closed 6 years ago
Sorry I'm not sure I understand. How would you propose using this in a non-.NET Core application? This library has dependencies on ASP.NET Core bits so it wouldn't work on full framework either way. There were issues targeting standard with this. Even if it did work it would pull in all sorts of ASP.NET Core dependencies into your non-core project so this is really not an option.
If you want support for full .NET framework for the basic markdown features then take a look at the full framework version:
which you can use in Webforms (for the control) and in MVC/Web API for the Markdown bits.
I suspect you're just after the Markdown parsing functions, in which case I'd recommend you just lift that code out and create a small component of your own in your own application. The meat of this library are the taghelper and the middleware which are ASP.NET Core specific. The Markdown parsing is just the dependency helper.
You're correct in identifying that its the Markdown parsing integration with ASP.NET Core (e.g. tag helpers) that I want to use.
ASP.NET Core is definitely compatible with .NET Framework 4.7 (Microsoft initially proposed that ASP.NET Core V2 would be .NET Core only, but backed down when the development community protested). I run my ASP.NET Core v2 web app on top of .NET Framework 4.7.
Sure ASP.NET Core is .NET Standard 2.0 compliant (4.6.1 and 4.7.1 actually), but again - why would you do that?
If you take a dependency on this you will pull in all of the ASP.NET Core MVC dependencies that you can't do anything with in a full framework project. They'd just clutter up your project.
As I said - there is a full framework package that has these same base libraries that you can use for the markdown parsing. Much less overhead with that approach. Same classes.
In fact I would suggest you don't need a package at all - take a dependency on MarkDig and add the parser classes to your project and you're done without any extra dependencies.
I'm not sure we are on the same page here; I am already pulling in all the ASP.NET Core MVC dependencies as I have an ASP.NET Core MVC project that runs on full framework.
At any rate I have gone ahead with using MarkDig directly.
Just as another example for a library exclusively targeting ASP.NET Core, I opted for netstandard2.0
for HtmlTags because I had dependencies on ASP.NET or ASP.NET Core bits. All my dependencies were netstandard2.0
so there really wasn't any reason for me to only target netcoreapp2.0
for just a library, even if it was ASP.NET Core 2.0.
I did have to create a completely separate library though from the base HtmlTags
one because it had a dependency on System.Web
that I couldn't remove. So the recommendation was a completely new HtmlTags.AspNetCore
one.
This should absolutely target netstandard so that folks using ASP.NET Core on .NET Framework can use it. See my Tag Helpers at damianedwards/TagHelperPack for an example.
Sorry I misunderstood what you were trying to do here. I didn't realize you are in fact running ASP.NET Core under full framework in your own app.
I can't remember now why I switched this project to netcoreapp2.0 - I generally target netstandard for all non-top level projects. But there was some odd dependency problem that caused the code to not compile properly.
I'll go ahead and take another look and see what the issue is - it certainly should work just fine with Netstandard 2.0.
All things considered though - in your case if you just want the simple Markdown parsing features you are better off just referencing Markdig and implementing the parser factory and parser directly.
I remember now what the issue was at the time why I switched the target - File.ReadAllLinesAsync() didn't work under .NET Standard. I meant to clean that up but at the time just changed the target to Netcoreapp. Anyway fixed the code with explicitly reading a stream and re-target the projects.
// string markdown = await File.ReadAllTextAsync(pageFile);
string markdown;
using (var fs = new FileStream(pageFile, FileMode.Open, FileAccess.Read))
using (StreamReader sr = new StreamReader(fs))
{
markdown = await sr.ReadToEndAsync();
}
Target updates: 624325a8a8f9244c8e2e9cb30fdbbc95bb977620
Nuget Packages have been updated for both projects.
Would be great if this was dependent upon netstandard2.0 rather than netcoreapp2.0, some of us are still using full framework for web apps.
I'd be happy to submit a pull request for this... I note that the latest version of this repo currently has a compilation issue however.