QlikTip #44: How I Use Visual Studio.net 2010 to Develop QlikView Extensions

I have tried several ways and editors to develop QlikView extensions. But finally I have found a good and easily to set up way using Visual Studio.net 2010.

Why Visual Studio

Maybe you are asking why I am using Visual Studio although a “normal” editor would be absolutely enough.

My answer:

  • I have been using Visual Studio for years now and it is my editor of choice for nearly all my software projects.
    • So I am just a bit lazy to use a different editor which is maybe more web targeted (like for example Aptana Studio)
    • … and if I am now starting with Visual Studio 2012 I am really excited about the new focus on web technologies in the latest release of Visual Studio …
  • Using Visual Studio is the easiest way for me to incorporate also QlikView Extension solutions into my personal code versioning setup (I am using a combination of MS Team Foundation Server/TFS Team Explorer and Subversion/TortoiseSVN)

Why not Using Workbench?

Sure, if you are using Visual Studio, QlikView Workbench is a good starting point for developing QlikView extensions. But my experience is, that after some practicing hours you will not need QlikView Workbench anymore and there are a lot of WYSIWYG features which are not covered in QlikView Workbench, unfortunately.

My Final Setup in Visual Studio

This is the step by step guide how I set up a Visual Studio solution/project to develop a QlikView extension:

Preperation

First of all I create an empty solution:

File > New > Project > Other Project Types > Visual Studio Solutions

Create a blank Visual Studio solution

Add an empty “ASP.net web project” (in fact you could use also other project types):
File > Add > New Project > ASP.NET Empty Web Application

Create any empty project (e.g. "ASP.net Empty Web Application")

Delete all not necessary references and properties:

Delete unnecessary files

Add the basic files for your QlikView extension:

  • Defintion.xml
  • Icon.png (any 24×24 pixel .png file)
  • Script.js

The result should look as follows:

Resulting view after adding the basic files for your QlikView Extension

You could for sure also automate the steps described above by creating your custom project template in Visual studio and use this for your projects.


Hmmmm ….

Now you are ready to develop your extension … Hmm, wait, that’s not the big deal, isn’t it?
Yes, one important point is missing: automatic deployment to the path where QlikView Desktop and QlikView Server are trying to load the extension from.

My approach: Using “Post-build events” in Visual Studio. So I am using Visual Studio to build the project (Ctrl+Shift+B) which does in fact nothing but I have created a script I am using in all QlikView extension projects:

The code below is created to work as a post build event in Visual Studio, so the code will be executed after you have successfully built your code. In fact when using only JavaScript, Html and CSS nothing happens during a build but it can be triggered easily by hitting Ctrl+Shift+B or using the menu: Build > Build %ProjectName%.

Add the code to the “Post-build event command line” text field within the project properties:

Project Properties: Post Build Events

SET LOCAL_PATH="C:\Users\swr\AppData\Local\QlikTech\QlikView\Extensions\Objects\SwitchOnOff\"
SET SERVER_PATH="D:\QV-Server\v11\Extensions\Objects\SwitchOnOff\"

REM ****************************************************************************************************************
REM COPY TO LOCAL
REM ****************************************************************************************************************
Rem Create target directory if not exists
IF NOT EXIST "%LOCAL_PATH%" (
	ECHO "Create local path: %LOCAL_PATH%"
	MKDIR "%LOCAL_PATH%"
)
REM Remove remaining files from old builds, so delete everything
DEL "%LOCAL_PATH%*.*" /S /F /Q /EXCLUDE:DynProperties.qvpp
XCOPY "$(TargetDir)*.*" "%LOCAL_PATH%" /Y /E /I

REM Delete .dll and .pdb
DEL "%LOCAL_PATH%"$(TargetFileName)
DEL "%LOCAL_PATH%"$(TargetName).pdb

REM ****************************************************************************************************************
REM COPY TO SERVER
REM ****************************************************************************************************************
REM Create target directory if not exists
IF NOT EXIST "%SERVER_PATH%" (
	ECHO "Create server path: %SERVER_PATH%"
	MKDIR %SERVER_PATH%
)
REM Remove remaining files from old builds, so delete everything
DEL "%SERVER_PATH%*.*" /S /F /Q /EXCLUDE:DynProperties.qvpp
XCOPY "$(TargetDir)*.*" "%SERVER_PATH%" /Y /E /I

REM Delete .dll and .pdb
DEL "%SERVER_PATH%"$(TargetFileName)
DEL "%SERVER_PATH%"$(TargetName).pdb

For getting this to work you have to mark all files which should be included in the build with:

  • Build Action: “Content”
  • Copy to Output Directory: “Copy Always”

Setting the build action for each file properly

The advantage of this approach is furthermore that I can include several other files, prototypes and examples within my Visual Studio projects which will not be included in the “Extension output” because I do not mark these files with “Build Action: Content” & “Copy to Output Directory: Copy Always”

What do you think?

What do you think? How to you set up your development environment to develop QlikView Extensions?
I’ll be happy to read about your experiences and gotchas …

Bookmark and Share

and tagged , , , . Bookmark the permalink. Both comments and trackbacks are currently closed.

13 Comments

  1. Posted January 4, 2013 at 23:31 | Permalink

    Hi Stefan,

    That looks like a very nice setup, I’ll have to give this a try. Currently I just use Notepad++ for development and Firebug for debugging.

    Kind regards,
    Barry

  2. Posted January 6, 2013 at 14:18 | Permalink

    Running sublime as editor and chromes debugging tools.
    Also a few powershell scripts to automate new extensions and to deploy them.

    Next in the pipeline is a visual editor for the definition.xml file. For some reason people seem to get stuck on that one quite a lot

    • Posted January 10, 2013 at 21:32 | Permalink

      OK, interesting … your you planning to publish your visual editor for the Definition.xml files?

      Regards
      Stefan

  3. Shubhasheesh
    Posted January 28, 2013 at 11:49 | Permalink

    Is there a constraint on Visual Studio Version. Can I use Visual Studio Express for what you shown up ?
    Regards,
    Shubhasheesh Chakraverty

    • Posted January 29, 2013 at 10:56 | Permalink

      Hi, I don’t see any issues using Visual Studio Express for the solution I have presented … Should work exactly the same way …

      Regards
      Stefan

  4. Chris
    Posted February 4, 2013 at 15:03 | Permalink

    Hi Stefan,

    Very interesting! Would you be willing to provide an example solution of a basic extension for those of us dabbling in QV Extensions?

    Regards,
    Chris

    • Posted June 3, 2013 at 11:08 | Permalink

      Hi Chris,

      I have posted the source code of quite a lot of QlikView Extensions which I have developed in Visual Studio … But maybe a good idea is to post a “Hello World” extension to be used as a basic framework …

      Regards
      Stefan

  5. Tim
    Posted August 1, 2013 at 12:54 | Permalink

    I set up a similar environment in VS2012 Express for Web before I found your post on this.

    Unfortunately due to the way that the Express products are separate from each other (i.e. there is a separate IDE for .NET and Web development rather than in the full VS2012/2010 you just enter a single IDE) you cannot set up post-build events in Express for Web (in fact you are limited to a literal xcopy deployment as part of the build process).

    Therefore, if you are going to use Express for Web then you are limited to picking the files and folders you want for your deployment which can be quite painful, however, it’s still preferable to notepad even just for organisation of your project!

    • Posted August 7, 2013 at 14:16 | Permalink

      In this case I still recommend to create some batch files to automate deployment and separate your code base from the code being used by QlikView Desktop and/or QlikView Publisher.

      Regards
      Stefan

  6. Jeremy Fourman
    Posted October 21, 2013 at 17:36 | Permalink

    Very nice, I’m going to have to give this a spin! Thanks for sharing.

  7. Raju Marella
    Posted October 22, 2013 at 09:18 | Permalink

    Hi,

    We have a great experience with Qlikview workbench integration with Asp.net. We planning to migrate the project to MVC 4, just wanted to check is there any workbench integration available with MVC ? If so any samples available.

    Your help will be appreciated.

  8. Ophir
    Posted November 27, 2013 at 11:28 | Permalink

    hi Stefan,

    thanks for this post.

    Do you by any chance know if there’s a way to fire an event towards the .Net upon a change in the QV OCX?
    (I’ve managed to read and select from the .Net towards the OCX, but am looking for a way to do it the other way around).

    thank you in advance :)
    Ophir