Search code examples
visual-studio-2012code-snippetssql-server-data-tools

Distribute SQL_SSDT Code Snippets using vscontent (lang attribute error)


I'm trying to distribute some SQL_SSDT Visual Studio code snippets using .vsi and .vscontent files, but I'm getting an error while installing:

The .vscontent file either contains invalid attributes or specifies a code snippet for a programming language that is not installed.

The .vscontent file is based on the documentation provided by Microsoft How to: Distribute Code Snippets

The sample on this site is the following:

<VSContent xmlns="http://schemas.microsoft.com/developer/vscontent/2005">
    <Content>
        <FileName> </FileName>
        <DisplayName> </DisplayName>
        <Description> </Description>
        <FileContentType> </FileContentType>
        <ContentVersion>2.0</ContentVersion>
        <Attributes>
            <Attribute name="lang" value=""/>
        </Attributes>
    </Content>
</VSContent>

My file looks like this:

<VSContent xmlns="http://schemas.microsoft.com/developer/vscontent/2005">
    <Content>
        <FileName>SSDTTest.snippet</FileName>
        <DisplayName>SSDTTest</DisplayName>
        <Description>SSDTTest</Description>
        <FileContentType>Code Snippet</FileContentType>
        <ContentVersion>1.0</ContentVersion>
        <Attributes>
            <Attribute name="lang" value="SQL_SSDT"/>
        </Attributes>
    </Content>
</VSContent>

I'm using the value SQL_SSDT since this is the required value in the .snippet files (<Code Language="SQL_SSDT">).

The installation starts as expected (double clicking on the .vsi file), the VS Content Installer pops up, lists the included content. The error occurs after hitting Finish. (Installation starts, but the above error pops up after a few seconds.)

The snippet is working fine if I copy it to the default snippet folder for SSDT (Documents\Visual Studio 2012\Code Snippets\SQL_SSDT\My Code Snippets) or if I'm adding it via snippet manager in SSDT, but the .vsi installation fails using the above file.

Am I missing something?

Installed VS products on this box:

  • SSDT
  • SSDT-BI
  • VS Express for Desktop (2012)

Update

I found the XML schema reference for the .vscontent files (VS2012), and it seems that the SQL_SSDT is not a valid value for the Lang attribute. It suggests that there are only four values available for the lang attribute. (csharp, jsharp, vb, xml).

Now the question is: Does SSDT add any extensions to this XML schema?


Solution

  • It seems that VS Content Installer has no support for deploying SSDT code snippets. There is a posted idea on visualstudio.uservoice.com which requests this feature, but it is still open.

    I did not found any other resources related to this issue.

    There is a possible workaround, which needs testing: You can create a PS/BAT which copies the snippet files into the VS's snippet folder for SSDT.