Aaron Johnson
Aaron Johnson

Reputation: 23

SSIS script task editing - where is my code?

I have never used a script task in SSIS before and I am trying to learn how to use it to read JSON files. I have several tutorials that I am following on the web that seems to be clear. I an not a c# programmer, but have enough experience in other languages that I am figuring things out.

My question is: When I hit the [Edit Script...] button and write my script, how do I save it and later re-edit it?

When I save the code all seems well, but when I have to quit and come back to it later, I can't find it. the [Edit Script...] button show me a new blank script screen. If I try a save-as when editing the script, that option is not available.

Where did it go? How can I edit it? Is this going to be a "get it right the first time or else" kinda thing?

None of the tutorials I found talk about this, none suggest going back and editing. I have been searching for answers and don't find any... Perhaps something is wrong with my installation....

Upvotes: 2

Views: 1880

Answers (1)

alkoln
alkoln

Reputation: 629

The code for script components is stored as a block of data inside your package file. Every time you hit 'Edit script...' Visual Studio extracts the data to a set of files inside a temporary folder and starts a new window pointing to those files. When you click 'OK' in the original window, Visual Studio closes and automatically saves the files, packing them back into your package. Sometimes there are bugs with this process that are related to corrupted packages or installations of Visual Studio. As a workaround, you may try the following:

  • make sure you don't close child VS window manually, but rather click on the 'OK' button in the original script component properties window
  • try to hit 'Save All' in the child VS window before hitting 'OK' in the original script properties popup dialog

If you see empty VS window (no files at all), try one (or all) of the following:

  • hit 'Cancel' in script properties, reopen it and try to hit 'Edit script...' again
  • change the list of ReadOnly or ReadWrite variables in the script component properties (this makes Visual Studio to recreate automatically generated code), then press 'OK' and try to open script component again
  • in the child Visual Studio window, go to Tools->'Import and export settings...' -> 'Reset settings' -> ... -> choose BI settings to apply as a default set of settings (or you can try Visual C# also) -> press 'Finish'. Then in the original properties window press cancel and try to open script component code again
  • in the original VS/BI editor, right-click on your package in 'Solution Explorer' and rename it (this may implicitly convert the package to latest version), then save it and try opening the script component again

I've had similar issues and occasionally some of the above steps were able to temporarily solve my problem, but it didn't go away forever. I suspect that only a clean install of VS and BI tools can solve it, however I'm not sure it's your exact case.

Upvotes: 2

Related Questions