Open GrahamTheCoder opened 6 years ago
A similar solution could probably also cover https://github.com/icsharpcode/CodeConverter/issues/219
Has there been movement on this? We have a huge web application with hundreds of vbhtml files and could use a helping hand.
Just to check I'm looking at the right thing, am I right in thinking it's .net framework 4.8 that's the latest version that supports vbhtml? Is that what you're using?
I've started adding some background information to the issue description. The good news is that it's possible to get at and convert the code itself, the less good news is that it needs a fair amount of surrounding code to be useful on the scale. If you, or anyone else is interested in doing some digging in the roslyn repo for the relevant parts I've mentioned that would be a huge help.
I've got a spike that gets me access to what's needed I think, but it's reflection heavy: https://github.com/icsharpcode/CodeConverter/pull/1110
Related info for aspx is probably relevant here: https://github.com/icsharpcode/CodeConverter/issues/175
May be necessary to use things like
Out of scope: ASP Net Classic will not be supported
Background
For each file that currently has an open editor, we receive a whole project object (same file path as the one containing the vbhtml) with a bit of boilerplate and then a projection of each code block in the vbhtml
e.g. About.vbhtml
About.vbhtml.__projection.g.vb:
So we need:
Layout = "~/Views/Shared/_Layout.vbhtml"
Using internals
Given a bunch of internal interfaces, this may be a good time to try out the new way of accessing such things (with appropriate guards of course): https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.unsafeaccessorattribute?view=net-8.0#examples
Side note
There's a snippet here which tells us how we should be getting the right one of these projects normally (currently it just grabs the first!) https://github.com/dotnet/roslyn/blob/e102ec27b9a89b4ee462f93bcd3295a66c439329/src/VisualStudio/Core/Def/Implementation/HierarchyItemToProjectIdMap.cs#L76-L87