Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 Cannot insert html snippets in .aspx files
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

pjhunter
New Member

USA
4 Posts

Posted - Jan 24 2024 :  4:47:08 PM  Show Profile  Reply with Quote
I have a VB project in VS2022. I've enabled VB support and can insert snippets in my code-behind files. However, I would like to insert snippets in the .aspx file, but can't seem to see a way to do that. The "Insert VA Snippet" command is disabled.

I've created a snippet in VA under the html language category. It just appears that VA does not recognize .aspx as an html file.

How can I make this work??
Thanks.

Peter

feline
Whole Tomato Software

United Kingdom
18792 Posts

Posted - Jan 25 2024 :  11:26:09 AM  Show Profile  Reply with Quote
I am seeing the same problem here. I tried changing the VA registry keys, to tell VA to treat ASPX files as HTML files, but that isn't enough. I suspect we would need to change the IDE settings as well, to tell the IDE to treat ASPX files as HTML files, but I am not sure if that is a good idea or not. I suspect it might break things on your end.

If you are interested in trying this, I can have a go, and see if I can get it to work, but I am wary of possible side effects.

zen is the art of being at one with the two'ness
Go to Top of Page

pjhunter
New Member

USA
4 Posts

Posted - Jan 25 2024 :  1:05:55 PM  Show Profile  Reply with Quote
I'm willing to try. I can always set it back. Please send instructions.

Peter
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18792 Posts

Posted - Jan 26 2024 :  08:30:14 AM  Show Profile  Reply with Quote
So far no luck making Visual Studio think that an ASPX file is a HTML file. I tried editing the VS2022 private registry file, and playing around with the extension settings, but I am not sure how they work in detail, so my simple edits aren't working.

But, I have thought of a possible work around. Assuming you don't have to many ASPX files, you can create a link (copy) of the ASPX file with a HTML extension. To do this, open a Windows command prompt, running as Administrator. Apparently you don't need to do this as Administrator under Windows 11, but I haven't double checked that.

Move the command prompt into the directory where the file lives, and then run the command:

mklink /H va_linked_aspx.html test_colour_and_font.aspx

obviously using the correct file names. The first file name is the NEW file that will be "created", while the second name is the existing file. Since this is a hard link at the file system level, any edit made to either file is made to the original file. So you can open and edit the ASPX file link, which VA will then treat as a HTML file, with your normal snippet support, and the IDE will see the original ASPX file being edited.

Just be aware there can be a lag before the ASPX file is updated in the IDE if you have both files open at the same time.

Not ideal, but perhaps a suitable work around.

zen is the art of being at one with the two'ness
Go to Top of Page

pjhunter
New Member

USA
4 Posts

Posted - Jan 26 2024 :  11:28:43 PM  Show Profile  Reply with Quote
Great! I just tried this and it works perfectly. I created a new aspx file (PayStubManager.aspx) and then I used your mklink suggestion as follows:

mklink /H PayStubManager.html PayStubManager.aspx

I then, in VS2022, added an existing item (PayStubManager.html) to my project. Giving it the same name it is easily locatable next to the actual aspx file. I then opened the html version, inserted my snippet, made the specified substitutions and then saved and closed the file and opened the .aspx file and everything was there. Perfect, with little added work.

It would be nice is Whole Tomato would recognize .aspx file directly, but this is a great work-around.

Thank you.

Peter
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18792 Posts

Posted - Jan 29 2024 :  09:35:50 AM  Show Profile  Reply with Quote
Thank you for the update, this was a new approach for me, so I am glad to see that it works well

Adding support from extra file extensions, especially when the IDE is already doing some handling of them, isn't always quick or easy, so this isn't really something we are looking to do at the moment. So I am glad we have a useable workaround.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000