Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Editing/Modifying an Existing Custom Visual

Hi,   I am currently new to Power BI Custom Visual development and would like to modify an existing Power BI Visual. I am currently trying to modify the open source Map Box Custom Visual Source Co...
  • dm-p's avatar
    dm-p
    5 years ago

    Hey Anonymous,

    When you say you have only changed the guid, does this include backing-out the minor changes you wanted to make? I'd be inclined to stash those somewhere and confirm the base visual works from checkout before packaging with the changes. The visual host suppresses runtime errors and a blank visual can also be a side-effect of such a runtime error.

    Assuming you have and the guid is the only change, then my next steps to investigate would be as follows:

    If you're still getting a smaller package size it sounds to me like the newer SDK is somehow still installed. Is it possible that you may have installed powerbi-visuals-tools locally to the project as well as globally? You can check this as follows:

    • Confirm that package.json doesn't contain powerbi-visuals-tools in either dependencies or devDependencies.
    • If it does, type npm un powerbi-visuals-tools and press [Enter].
    • Confirm the entry is removed from package.json.

    I'm unfortunately not in a position where I can confirm the below process will work as I have several active visual projects on the go and I can't downgrade at this time, but this used to be my process:

    1. In the command prompt, type npm un powerbi-visuals-tools -g and press [Enter].
    2. Type pbiviz and press [Enter] - this should return an error as tools should be uninstalled.
    3. Re-attempt the install: type npm i [email protected] -g  and press [Enter].
    4. Once installed, type pbiviz --version and press [Enter]. This should say 1.13.x (where x will be a minor version - according to npm the latest build under 1.13 is 1.13.1 so will likely be that - as long as it's 1.13 we should be good).
    5. The older version of the SDK has a 2-step cert process.
      • First type pbiviz --create-cert and press [Enter]. This will generate the file. Make note of the key.
      • Then type pbiviz --install-cert and press [Enter]. This should present the standard dialog where you can install the cert. Add in your key here as normal (remeber that the cert needs to be installed into Trusted Root Certification Authorities).

    It also looks like Mapbox has their own additional steps for the dev process. It's possible if these aren't done in the right order then they might cause issues also. I would attempt the following to ensure that your checkout corresponds correctly:

    • Type npm i and press [Enter].
    • Type npm run build-turf and press [Enter].

    Confirm that your pbiviz.json still shows "1.13.0" under the apiVersion property.

    As long as pbiviz.json and the tools are in sync then pbiviz package or pbiviz start should bundle correctly.

    If the guid is the only change you've made to the checkout then theoretically that should be all there is to it. If the code, minus this one change doesn't work then I would suggest creating an issue with Mapbox for advice on how to set-up the development environment correctly to match their own.

    You could also try asking the visuals team at MS directly, as they don't weigh-in on the forums any more: [email protected]. it is however possible they will direct you to Mapbox for support.

    Regards,

    Daniel

  • dm-p's avatar
    dm-p
    5 years ago

    On the older SDK, the apiVersion isn't tied to a sensible repository like npm and is managed through some other arcane means, so there are some manual steps.

    BTW updating your SDK and API to 2.6.0 should be okay as this is as far as you can go on the older tooling before needing to migrate packages and code to the newer tooling.

    On the older tooling, the specified apiVersion in pbiviz.json needs to be pulled down separately and stored in your project's .api folder if you update the tools in-place.

    As long as you have powerbi-visuals-tools 2.6 installed, you should be able to run the following from the command line:

     

    pbiviz update 2.6.0

     

    This should set the apiVersion to 2.6.0 in pbiviz.json and a pbiviz start should hopefully not complain about SDK and API being out of whack.

    You will also need to re-generate the certificate on the older versions if you either update the API or the tools due to a change in signature of the SDK + API.

    If it's still upset, check the .api folder of your project and delete any that aren't relevant to your current specified API version. The tool should do this itself but it's possible that errant ones may remain if you've been shifting between versions.

    On the newer toolchain there are separate npm packages for the API and tools so its easier to manage, and certificates only have to be generated for new versions of powerbi-visuals-tools (updating powerbi-visuals-api is safe).

    The older tooling was still evolving and a lot of existing visuals still use it, which unfortunately does make experiences like these commonplace, if you're picking up someone else's work. You definitely get a better experience if you attempt to work on anything with an SDK >= 3.1.

    Hopefully this should get you on track,

    Daniel