locked
Single File Generator for VS2017 Python project RRS feed

  • Question

  • My company internally uses single file generators to for code generation in C# projects, and recently we added support for .NET Core. We use the VSSDK-Extensibility-Samples Single_File_Generator example as a template. For C# projects we target {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}, and for .NET Core projects we target {9A19103F-16F7-4668-BE54-9A1E7A4F7556} in the CodeGeneratorRegistration attribute.

    We have a need to target Python projects now too, and the only ProjectTypeGuid I've been able to find online has been {888888A0-9F3D-457C-B088-3A5042F75D52}. The generator however does not work for Python projects created in VS2017 (15.3.3). Please advise if we can use this method for Python projects, and what the correct guid would be, if any.

    Tuesday, September 12, 2017 9:18 AM

All replies

  • Hi WernerVN,

    You could create a Python project in your Visual Studio and Unload it from Solution Explorer. Then Edit the pyproj file through right-click the Python project. You will find the corresponding project Guid in pyproj.

    So the Python projects GUID should be ed8cdf4e-4d4a-407a-8268-14f94c561231.

    Best Regards,
    Weiwei


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, September 13, 2017 3:23 AM
  • Hi Weiwei,

    I am not looking for the ProjectGuid (which is unique per project), but the ProjectTypeGuid. I have written a quick CommandButton plugin that will return the project type guid, so I've determined that the value is {888888A0-9F3D-457C-B088-3A5042F75D52}.

    What I need to know is if it is possible to register a SingleFileGenerator VSIX for a python project using the CodeGeneratorRegistration attribute?



    • Proposed as answer by Weiwei Cai Thursday, September 14, 2017 5:25 AM
    • Edited by WernerVN Friday, September 15, 2017 6:34 AM
    Wednesday, September 13, 2017 7:02 AM
  • Hi WernerVN,

    Thanks for sharing the solution for getting Python ProjectTypeGuid issue. Please mark your helpful reply as answer.

    Yes, you need to use CodeGeneratorRegistration attribute which could register your Visual Studio extension as a custom tool. And the users can use it to generate files using the Run Custom Tool command in Solution Explorer.

    If any other question, please feel free to come back to create new threads.

    Best Regards,
    Weiwei


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, September 14, 2017 5:25 AM
  • Hi Weiwei,

    I wated to know: is it possible to register a SingleFileGenerator VSIX for a python project using the CodeGeneratorRegistration attribute?

    It seems that Python projects do not allow you to set the Custom Tool attribute on files, so I guess that makes my answer "No".

    Thanks for trying to help anyway.

    Regards,
    Werner


    • Edited by WernerVN Friday, September 15, 2017 6:37 AM
    Friday, September 15, 2017 6:36 AM
  • Hi WernerVN,

    Sorry for misunderstanding your original question.

    I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.

    Thanks for your understanding.

    Best Regards,
    Weiwei


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, September 18, 2017 5:48 AM