Click here to Skip to main content
15,892,643 members
Articles / Programming Languages / XSLT

XSL Transform Code Generator for Visual Studio .NET

Rate me:
Please Sign up or sign in to vote.
4.88/5 (14 votes)
13 Feb 2021CPOL3 min read 145.7K   2.4K   75  
A custom tool for Visual Studio .NET which runs an XSL transformation to generate code
namespace CustomToolGenerator 
{
  using System;
  using System.Runtime.InteropServices;   

  [
  ComImport, 
  Guid( "3634494C-492F-4F91-8009-4541234E4E99" ), 
  InterfaceTypeAttribute( ComInterfaceType.InterfaceIsIUnknown )
  ]
  public interface IVsSingleFileGenerator 
  {
    //
    // Retrieve default properties for the generator
    // [propget]   HRESULT DefaultExtension( [out,retval] BSTR* pbstrDefaultExtension );
    //
    [return: MarshalAs( UnmanagedType.BStr )]
    string GetDefaultExtension();

    //
    // Generate the file
    // HRESULT Generate( [in] LPCOLESTR wszInputFilePath,
    // 					[in] BSTR bstrInputFileContents,
    // 					[in] LPCOLESTR wszDefaultNamespace, 
    // 					[out] BYTE**    rgbOutputFileContents,
    // 					[out] ULONG*    pcbOutput,
    // 					[in] IVsGeneratorProgress* pGenerateProgress );
    //
    void Generate(
      [MarshalAs( UnmanagedType.LPWStr )] string wszInputFilePath,
      [MarshalAs( UnmanagedType.BStr )] string bstrInputFileContents,
      [MarshalAs( UnmanagedType.LPWStr )] string wszDefaultNamespace, 
      out IntPtr rgbOutputFileContents,
      [MarshalAs( UnmanagedType.U4 )] out int pcbOutput,
      IVsGeneratorProgress pGenerateProgress );
  }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United Kingdom United Kingdom
Systems builder and developer, DotNet C#, Ruby, Golang, Linux, Cloud, Open Source contributor.

Comments and Discussions