Pregunta

Can we change the default location for package templates? Or at least add more locations?

I would like to create some templates and add them to the source control but I'm not very keen on adding a file on the C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\ProjectItems\DataTransformationProject\DataTransformationItems folder to the source control.

How do you deal with that?

¿Fue útil?

Solución

I've never tried moving it, but when we built out templates, we had a Common project that contained common material (we're creative like that) like configuration settings for databases as well as template packages. The solution also had a start up project with nothing in it but a post build script where we'd copy the templates into the above path. That way people didn't have to worry about this "complex copying stuff" to get started.

copy /y "$(SolutionDir)\SQL\SSIS\PackageTemplate.dtsx" "$(DevEnvDir)\PrivateAssemblies\ProjectItems\DataTransformationProject\DataTransformationItems"

As rvphx reminded me, you will want to have people that use your templates to reset the Package ID. Otherwise, you greatly complicate reporting against your sysdtslog90/sysssislog table. The free visual studio add on, BIDSHelper, has a feature to reset the GUIDs from the project window. Another issue I ran into with our own templates was they would a physical file name that we provided but did not match the Package Name property inside SSIS. We'd either assign a junk physical file name and then rename it to the proper name or just remember to fix it in the package properties.

Otros consejos

The template we've been using is pretty plain-vanilla (mostly a bunch of standard variables, connection managers and event handlers for SSIS 2008), and a couple of years back I wrote a NAnt script to build a simple one-package solution. Since the .dtsx format is just XML, it's not too terribly difficult to make a text template file out of a minimalist package and use NAnt's <replacetokens> task to replace things like package names and GUIDs. It's even easy to create unique GUIDs, since NAnt lets you embed C# code in your scripts:

<script language="C#" prefix="script" >
    <references>
        <include name="System.dll" />
        <include name="System.DirectoryServices.dll" />
    </references>
    <imports>
        <import namespace="System.DirectoryServices"/>
    </imports>
    <code>
        <![CDATA[
        [Function("create-guid")]
        public static string CreateGuid() 
        {
            return Guid.NewGuid().ToString().Trim();
        }
        ]]>
    </code>
</script>

<property name="PACKAGE_DTSID_GUID" value="${script::create-guid()}"/>
<property name="PACKAGE_VERSION_GUID" value="${script::create-guid()}"/>

To plainly answer your questions :

No you can't change it. No you can't add more locations.

As described, you can script copy from one location to this folder. This is what most of us do.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top