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