Extensions in VB?

Topics: ASP.NET 2.0
May 27, 2008 at 6:25 PM
I wish I could program in C#, but.. I dont so I am wondering is there is any reason I cannot write an extension in VB?  At first I am guessing no, since the core and all is C#.  But, if I can, please give some example script.

My goal is simple, instead of writing in HTML editor <img src=" etc... etc.., Id like to just enter [myimg:"hello.jpg"] and be done with it, letting the MyImg extension do all the HTML.  Reason being is I use an extra ASPX file for image sizing and text overlay, I also use the Lightbox extension. It is a lot of copy & paste to keep the format correct and it is still error prone.

Thanks for any advice...
Andrew

May 27, 2008 at 10:31 PM
Hi Roger,

I think your question can be rooted back to the question "Can app_code contain multiple languages, for example C# and VB.NET?". That's because extensions in BlogEngine.NET is written inside app_code folder, which is compiled on the fly.

I haven't tried this myself, but some people out there said that it is possible. Check this out: http://pietschsoft.com/post/2006/03/ASPNET-20-Use-VBNET-and-C-within-the-App_Code-folder.aspx.

Apart from this, I have a strong suggestion for BlogEngine.NET team to change this model. Instead of coding them all inside app_code folder, it should be enabled to just accept the assembly that is placed inside the bin directory. With reflection technique, it is possible for BlogEngine.NET to examine the attributes of the assembly and perform automatic registration of new extension. So that next time the application is started, the new extension will automatically be loaded.

Regards,
Agus Suhanto
http://suhanto.com
May 28, 2008 at 3:06 AM
I am like you. I would like to use  BE, but not knowing C# well enough and not a fan of mixing languages, I don't use it.  Sure I have it running and tested it in several environments, but I prefer deploying applications that I can fix when they break  and I can not say that with anything written in C#.
There is a blog starterKit from MS  or some guy at MS written in both VB and C#, but for some reason, it was not well publicized and you really have to dig it out from their website, but I have a copy of it. It is a full fledged blog that can be extended to do more.
At one time, I thought of extending the VB codes, but due to time constraints, I never got started.
With the lack of good VB blog apps, I may take another look at it.
cheers,
yousaid


RogerTango wrote:
I wish I could program in C#, but.. I dont so I am wondering is there is any reason I cannot write an extension in VB?  At first I am guessing no, since the core and all is C#.  But, if I can, please give some example script.

My goal is simple, instead of writing in HTML editor <img src=" etc... etc.., Id like to just enter [myimg:"hello.jpg"] and be done with it, letting the MyImg extension do all the HTML.  Reason being is I use an extra ASPX file for image sizing and text overlay, I also use the Lightbox extension. It is a lot of copy & paste to keep the format correct and it is still error prone.

Thanks for any advice...
Andrew




Coordinator
May 28, 2008 at 7:04 PM
You might take a look at this post if yo are interested.
May 29, 2008 at 4:34 AM
Greetings,

Yes, I have used this same model you reference here in so many C# stuff, but the reason why I don't like implementing C# solutions is that I like to be able to fix problems that arise in applications that I deploy. You see, no knowing enough about C# means that I will have to rely on others when problems arise. Till I get a good handle on C#, I will for the time being stick with what I know and can fix, VB.
cheers,
yousaid
Fyi: Comments can not be submitted on your site. Throws an error

rtur wrote:
You might take a look at this post if yo are interested.



May 29, 2008 at 1:17 PM
@yousaid; maybe you can try code converter tools to convert c# code to vb for a quick solution? if you know solid VB, C# would not be a big problem for you.
Thanks.

Murat Duman
http://muratduman.net
Aug 1, 2008 at 10:01 AM
Here's a better solution since this project seems to be so ANTI-VB

Visual Basic BlogEngine.Net 1.4

If you have issues, blast me a comment.  Also, let me know what extensions you write because it looks like I will be working on the Visual Basic project going forward with no support from this project.