none
Junk Namespace in Script task RRS feed

  • Question

  • I am using SQL Server 2008 November CTP.

    I create a script task.  The task creates a namespace that looks like a guid file name.  I want to use a more descriptive namespace, one that matches say my corporate namespace naming conventions.  How do I do that nicely?  Just renaming doesn't work since I am dealing with a partial class and I would need to rename the namespace in the other portion of the partial class.
    Thursday, February 14, 2008 8:26 PM

Answers

All replies

  • How are you creating the Script task?

     

    the task has an ID which is a GUID but it also has a Name, you can change the name to any value you like to follow the naming conventions.

     

    you can then reference the ID from the Name property.

     

    does this help

     

    Tuesday, February 19, 2008 1:56 PM
  • Your point pertains to the script task itself.  I am editing the script and it is the namespace declaration

    I drag a Script Task to the control surface.  I change the name to "TestScript" on the General tab.  I return to the Script tab and click on Edit Script.

     The C# code that is created is in a project named something like:  ST_1231203a13241asdf341234a523.  Click to view ScriptMain.cs, there is a Namespace declaration:

    namespace ST_1231203a13241asdf341234a523.csproj
    {

    }

    I can rename the project to something that makes sense, but as soon as I rename the namespace, the code breaks, because the class ScriptMain is a partial class.  I have to change the namespace in the other side of the partial class.  But I can't find that file, without digging around the file system.

    How do I do this?

    I'm not sure that I would classify this as a bug, but it is sure annoying.
    Tuesday, February 19, 2008 9:05 PM
  • I figured out how to change the namespace.

    First, get to the IDE (Edit script on the Script tab of the Script task).

    I then rename the project.  I then right click the project name and select "Properties."  I change the assembly name and default namespace.  I close that window.

    Now I go to the ScriptMain file.  I edit the namespace to the namespace I like.  I build the script and get four errors (always the same four when starting out).  I double click on the error that has the old guid like name in it.  That brings me to the designer script.  I find the namespace in this code and make it the friendly name.  Then I just hope that the designer doesn't overwrite my changes.

    It is messy.

    By the way this was an issue in SSIS 2005. It is not as noticeable. The name space and the file name does not display like it does in SSIS 2008.  Also, the namespace name is hidden in SSIS 2005 where it isn't in 2008.

    Russ Loski
    Tuesday, February 19, 2008 11:58 PM
  • Hi, Russ.

     

    I stumbled across a solution to this today. There is a property called "ScriptProjectName" that is only available through the Expression Editor. Setting it can change the project name and the namespace in the script. You need to set the expression and save the package prior to editing the script, but if you do that, everything will be named a bit more nicely.

     

    I posted a bit more detail here: http://agilebi.com/cs/blogs/jwelch/archive/2008/04/30/renaming-the-script-project-in-ssis-2008.aspx

    Wednesday, April 30, 2008 11:01 PM
    Moderator
  • It has been a while since I have looked at SQL 2008, but I have discovered that the issue existed in SQL 2005 as well.  It was hidden because of the differences between how VB and C# display the namespaces.  In C# it is always explicitly at the top of your project, while in VB you can declare a root, which hides all of that nastiiness.

    Anyway, in SQL 2005 there is a VsaProjectName, which is similarly hidden in the Expressions that allows you to change the property in SQL 2005.

    I think that they really need to provide that somewhere in the GUI, especially since it is now going to be shown so prominently.

    Russ
    Friday, May 2, 2008 8:27 PM
  • I agree. I'm not really sure why the property is hidden.

     

    Friday, May 2, 2008 8:30 PM
    Moderator
  •  Russ Loski wrote:
    It has been a while since I have looked at SQL 2008, but I have discovered that the issue existed in SQL 2005 as well.  It was hidden because of the differences between how VB and C# display the namespaces.  In C# it is always explicitly at the top of your project, while in VB you can declare a root, which hides all of that nastiiness.

    Anyway, in SQL 2005 there is a VsaProjectName, which is similarly hidden in the Expressions that allows you to change the property in SQL 2005.

    I think that they really need to provide that somewhere in the GUI, especially since it is now going to be shown so prominently.

    Russ

     

    feel free to submit a suggestion on sql server connect: https://connect.microsoft.com/SQLServer/feedback/

     

    please let us know if you've done so that we can vote on it.

    Monday, May 26, 2008 3:45 AM
    Moderator
  • Hello,

    If the task as already been added + saved, and then on an edit of one wants to change the namespace and project name to a Proper Name, 

    if one just change the ScriptProjectName and save, it would only change the project name, but the namespace would not get changed. The name space would still read as ST_GUID.csproj....

    I happed to find one simple way to get all the names changed to the new name that was set in ScriptProjectName.

    Every Task once executed would get saved in C:\Documents and Settings\USER\Local Settings\Temp\SSIS. This path you could get by clicking on the project and checking the ProjectFolder path.

    Delete this folder created in the TEMP folder.

    Then change the ScriptProjectName. Save the Script task and then open the script by click Edit Script. You will find that all the concerned names would have changed with the Project Name

    Hope this hellps....please comment

    vinu
    Thursday, January 7, 2010 4:25 AM
  • Hi jwelch!

    Thanks for posting this but I am unable to find ‘script task’s expressions editor’. Where is this option located? Can you please provide step-by-step procedure?

    Cheers,

    Wednesday, December 11, 2013 12:05 AM