Forum Discussion

Husain's avatar
Husain
Advocate I
6 years ago
Solved

Extract Visual.ts file from pbiviz file

Hi,

 

If I share a  custom visual's pbiviz file which I have developed with someone, can he see the source code or decode it in someway (for e.g the visual.ts and other files).

Is there a way to protect your code?

Regards,

Husain

 

 

  • When you package a Power BI Custom Visuals the TypeScript source like visual.ts is first compiled to JavaScript en then minified (https://en.wikipedia.org/wiki/Minification_(programming)) and stored with all the metadata in one big JSON file, which is zipped and ready to distribute.

     

    So yes, everybody that is using your custom visual has the option to 'read' the code you have written. Due to the minification it is not that easy, but not impossible. All CVs are client side scripts and are interpertered by a browser in the client space. And therfor there is no way to protect your code.  

     

    -JP 

3 Replies

  • jppp's avatar
    jppp
    Continued Contributor

    When you package a Power BI Custom Visuals the TypeScript source like visual.ts is first compiled to JavaScript en then minified (https://en.wikipedia.org/wiki/Minification_(programming)) and stored with all the metadata in one big JSON file, which is zipped and ready to distribute.

     

    So yes, everybody that is using your custom visual has the option to 'read' the code you have written. Due to the minification it is not that easy, but not impossible. All CVs are client side scripts and are interpertered by a browser in the client space. And therfor there is no way to protect your code.  

     

    -JP 

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion
    Hmm, perhaps not. If you rename a pbiviz file to zip, you can open it up and the ts file is in the resources directory.
    • Husain's avatar
      Husain
      Advocate I

      Hi Greg_Deckler 

       

      I just tried this

      I only see the pbiviz.json file in th resources folder