dotnet / vblang

The home for design of the Visual Basic .NET programming language and runtime library.
290 stars 64 forks source link

eShopOnWeb.vb: A full ASP.NET Core 3.1 app in VB.NET #510

Open VBAndCs opened 4 years ago

VBAndCs commented 4 years ago

I just published eShopOnWeb_VB.NET which is the VB.NET version of the Microsoft full web sample eShopOnWeb eShopOnWeb is a sample ASP.NET Core reference application, powered by Microsoft, demonstrating a single-process (monolithic) application architecture. I created a VB.NET version of this app, using Vazor and ZML to design MVC views and Razor Pages, because ASP.NET Core Doesn't provide a razor syntax that supports VB.NET. vazorpng

I hope VB.NET developers found it helpful, and start creating their web applications targeting ASP.NET Core 3.1 using VB.NET and Vazor.

@KathleenDollard I hope you publish this work in VB blog and .net magazine. Vazor readme contains the necessary details to write such article. And I wish to fix the issues I mentioned before regarding XML literals, to make using Vazor easier. I aborted Vazor for months waiting for the top level code and other amazing work of @AnthonyDGreen but since you announced freezing VB.NET, Vazor is the only left option. You promised to keep enhancing VB.NET editor and VS.NET tools for VB.NET. This is what I am asking for Vazor. At least I need the editor support for html5 in XML literals. Thanks.

KathleenDollard commented 4 years ago

Can you let me know what link you would like me to Tweet

VBAndCs commented 4 years ago

@KathleenDollard I am not sure I understand the question correctly. If you mean the link of the repo, I prefer to refer to the eShopOnWeb_VB.NET as a practical usage of Vazor: https://github.com/VBAndCs/eShopOnWeb_VB.NET It's readme contains links to Vazor and ZML. But I would appreciate if someone form .NET magazine summarize this work in an article like they did in this one Thanks for you care and fast respond.

ericmutta commented 4 years ago

@VBAndCs I haven't had a chance to look at this but it is definitely interesting and I commend your efforts on it! I have been learning ASP.NET Core and wanted to try it using VB and this looks like it solves that problem. Great stuff and thanks for leading the way :muscle: :+1:

PS: love the transformer logo - very memorable!

VBAndCs commented 4 years ago

@ericmutta
Thanks for your support. I found this image named Vazor so I took it and added the .net core logo :)

InteXX commented 4 years ago

@VBAndCs Good job, thank you.

VBAndCs commented 4 years ago

@InteXX You're welcome.

VBAndCs commented 4 years ago

I fixed the bug in the ApplicationCore.vb project, and updated the repo. It is all a VB.NET code now! I described the bug caused by a VB expression tree here: https://github.com/dotnet/vblang/issues/512

VBAndCs commented 4 years ago

Writing web pages with vbxml code now should be a fun with html5 auto completion https://github.com/dotnet/vblang/issues/527#issuecomment-610232087

InteXX commented 4 years ago

Incredible...

Where do you find the time?

VBAndCs commented 4 years ago

@InteXX Thanks. I have nothing but time :). This is not because a Corona curfew. I work mainly in writing books about VB.NET and C# for Arabic readers, which is a struggling career as publishing market in Arabic is very limited in general. And of course MSFT flush out my VB.NET books by declaring freezing VB.NET :( , which motivated me to continue my work about Vazor trying to make VB.NET live a little longer. I like doing some code adventure every spring, as it makes me learn new things, and enhance my books with new experiences. And above all, you can save a lot of time if you realized where to start. @paul1956 advised me to look at the the RegexCompletionProvider, and this led me to think: "There is already some limited version of XML completion provider, used for XML document comments, so, why don't I look at?" It gave me a kick start to write my first completion provider with zero previous knowledge of the subject, and it really was easy, letting me focus on learning xsd format and the .NET XMLSchema API used to parse it (which is really hard and needs to be more user friendly. I needed to search for answers in every step forward). In short, all gradients are there in VB.NET waiting to be used. I explained the making of the provider to encourage VB developers to get involved with Roslyn. It is not intimidating as it may seem, and we really need to step up to take over the fate of our beloved language.

InteXX commented 4 years ago

Aha. You're the perfect candidate for helping to finish off the VB.NET Generator for EF Core ;-)

Anyway... I'm quite envious of you. I've got all of these wonderful things I'd like to do, but there's just not enough time in a day.

If it were possible to continue without eating or sleeping, I would do it :-)

VBAndCs commented 4 years ago

You're the perfect candidate for helping to finish off the VB.NET Generator for EF Core ;-)

Sounds interesting. I will add it to the list after finishing all aspects of Vazor. But there is no documentation of that work, nor even a readme.

Hope you make the most efficient usage of your time.

InteXX commented 4 years ago

I'll try to work on a readme.

InteXX commented 4 years ago

Hope you make the most efficient usage of your time

Thanks :-)

VBAndCs commented 4 years ago

I contacted VS Magazine and they published an article about this work: https://visualstudiomagazine.com/articles/2020/04/10/vbnet-aspnetcore.aspx

InteXX commented 4 years ago

@VBAndCs

That is absolutely fantastic.

Congratulations :-)

VBAndCs commented 4 years ago

Thanks @InteXX.

VBAndCs commented 4 years ago

I want to advertise this to regular VB.NET developers. Is there still a popular forum or whatever that gathers a large number of them?

InteXX commented 4 years ago

You might try http://www.vbforums.com/.

InteXX commented 4 years ago

I hear also that there're a couple of VB groups on Facebook, but as I'm a social media holdout, I've never seen them.

VBAndCs commented 4 years ago

Thanks. I'll try both suggestions.

InteXX commented 4 years ago

@VBAndCs

Didn't you recently build a project template for one of these? I've been poking through my history, but I'm not finding what I seem to remember having read.

Anyway, assuming I'm correct... why not try a PR to get a link published here:

https://github.com/dotnet/templating/wiki/Available-templates-for-dotnet-new#vbnet-templates

This looks like it might have some potential for becoming a go-to spot for our stuff.

VBAndCs commented 4 years ago

@InteXX Yes, here it is: https://github.com/VBAndCs/Vazor/blob/master/VazorTemplateSetup.zip I am not sure if it is compatible with dotnet new.

InteXX commented 4 years ago

@VBAndCs

I betcha it is!

I was fiddling around today with dotnet new and project templates. It's surprisingly simple. In my research I happened upon this interesting little tidbit:

Creating your own templates

You can also create your own custom templates. These don't have to be for popular frameworks, but might be for internal or personal projects. Essentially, if you often find yourself creating a specific folder structure, set of references, or boilerplate files, consider creating project or item templates. Project templates are simply plain text files, including the .vbproj files — there's no requirement that the generated templates are .NET Core specific, and they can be made to target any framework.

https://www.infoq.com/articles/dotnet-core-template-engine/

In any case, I can think of one sure way to find out ;-)

InteXX commented 4 years ago

@VBAndCs

I cloned your repo, but I couldn't find a project template.

Did I look right past it?

VBAndCs commented 4 years ago

@InteXX
It is in the Vazor repo. The eShopOnWeb app uses the Vazor and ZML NuGets, so it doesn't have to be a part of the Vazor repo.

InteXX commented 4 years ago

@VBAndCs

OK, got it.

Is the source for this in the repo? I'd like to review your file/folder hierarchy and compare it to my own as I learn more about templating.

VBAndCs commented 4 years ago

You can export any project as a template. I used the sample projects in the repo to do that. Follow these steps: https://docs.microsoft.com/en-us/visualstudio/ide/how-to-create-project-templates?view=vs-2019

InteXX commented 4 years ago

@VBAndCs

That helps, thanks for the link.

I've been going by this one, but it doesn't provide documentation for the placeholders. I found that here, nestled among the topic tree you pointed me to.

My next step, after getting this under my belt, is to work out dotnet new with Vazor.

VBAndCs commented 4 years ago

Nice.

InteXX commented 4 years ago

@VBAndCs

I'm running into all kinds of problems trying to shoehorn this .NET Core project into a Framework 4.8 template project for the VS IDE.

Clearly you were able to do it; are you able to publish the source for your template and installer projects? I'd like to compare what you're doing with what I'm trying to do.

InteXX commented 4 years ago

I spotted a couple of typos in your item templates:

VazerPage VazerView

:-)

VBAndCs commented 4 years ago

trying to shoehorn this .NET Core project into a Framework 4.8 template project

Vazor is meant for ASP.NET Core. It has nothing to do with .NET framework.

I spotted a couple of typos in your item templates:

Thanks. I fixed them. I attached the template project here. VazorTemplateSetup.zip

InteXX commented 4 years ago

Vazor is meant for ASP.NET Core. It has nothing to do with .NET framework

Right, but the documentation I was using wants us to create a Framework 4.8 (or lower) interim template project:

https://docs.microsoft.com/en-us/visualstudio/extensibility/creating-custom-project-and-item-templates?view=vs-2019#create-a-project-template

That's where I was getting hung up. Once I dropped that approach and pointed the deployment project to the .ZIP file, as described here, I then could at least get a build and generate a VSIX file.

But this thing isn't out of the woods just yet. When running an experimental-instance debug (described here) or installing a VSIX Release build, the new template doesn't show up in the New Project list.

According to this, starting with recent releases of VS2019 it's apparently pretty important to include the *Tag elements in the manifest. But I see you're not including them in yours. And while I haven't tried a Vazor template installation yet, I believe it's safe to presume that yours are showing up where they ought to. That's a head-scratcher.

I don't see anything fundamentally different between your deployment project and mine.

Anyway, I'm done for the day. I'll pick it up again tomorrow.

VBAndCs commented 4 years ago

I believe it's safe to presume that yours are showing up where they ought to

No. I failed to do so. Nothing is working as they describe. So, I just told the users to search for the Vazor name in the new project window search textbox.

InteXX commented 4 years ago

@VBAndCs

I just opened a support case on this.

I'll keep you posted on my progress.