Creating a vs Extension

I’m a moderate user of extensions. As in, I have some favorites, but I’m not trolling the gallery everyday.

I’ve never made one before. No idea has either been both big enough and small enough to warrant me building an extension.

In April 2016, at Build, I saw Mads Kristensen create & publish (with integrated CI, and pretty images) a brand new extension during a 1 hour session. It was a great talk, and I had promised myself that I would watch it again on Channel9. I also signed up to be a VS Partner while at build.

I received an email about a week ago saying my VS Partner status would be canceled, unless I published a product in the next week.

Two days later, I came across a fitting challenge for an extension. So I set out to build it.

I followed Mads’ video, and it was surprisingly easy. The docs are still very confusing for the VS interfaces, but it was still doable.In the end, what took Mads less than an hour on stage, took me about 5 hours of total work at my desk.

All in all, it was still surprisingly easy, and I regret not doing it sooner.

VBScript Conditional Includes

This is a nasty one to track down in production, so I’m going to show you here.

VBScript has a fun way of interpreting include references that are nested inside an if statement. It will load all include references. If you have different functions, with the same name, it will use the second one.



Response.Write "<br/>Function 1 loaded...<br/>"

function myFunc(int1, int2)
    Response.Write "<br/>Function 1 executing...<br/>"
    myFunc = int1 * int2
end function 


Response.Write "<br/>Function 2 loaded...<br/>"

function myFunc(int1, int2)
    Response.Write "<br/>Function 2 executing...<br/>"
    myFunc = int1 + int2
end function


    if (true) then
        Response.Write "<br/>Case 1 executing...<br/>"

<!-- #include file="myTest_inc1.asp" -->

        Response.Write "<br/>Case 2 executing...<br/>"

<!-- #include file="myTest_inc2.asp" -->

    end if
    Response.Write myFunc(3,3)

The output of myTest.asp is:

Case 1 executing…

Function 1 loaded…

Function 2 executing…


Thanks for reading.