Start action set in template

Kevin Fugate 21 Reputation points
2022-09-21T21:50:11.953+00:00

I am building a template for creating VB add ins for Autodesk inventor. I would like the "Start external program" field on the debug page to by default be selected and the text box populate with the path info to my Inventor application. I have set the values accordingly and exported the template. When creating a new project from the new template "Start project" is selected as the start action and the text box is of course empty.

Is there a way to set up a template that will set the "Start external program" field on instantiation of a new project?

243645-image.png

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,721 questions
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
36,638 questions
0 comments No comments
{count} votes

Accepted answer
  1. Tianyu Sun-MSFT 28,056 Reputation points Microsoft Vendor
    2022-09-22T04:13:29.417+00:00

    Hi @Kevin Fugate ,

    Welcome to Microsoft Q&A forum.

    The Start action is set in yourprojectname.xxproj.user file. This file contains per-user settings and is automatically generated by Visual Studio when user changes some preference settings like Debugger settings. But this file will not be exported(or imported) together with your project to a custom project template, so it won’t work.

    One way that I can think of is writing some codes(maybe create an extension) to modify(or create this .user file and modify) the .user file, and add the following xml codes into it:

    <StartAction>Program</StartAction>  
    <StartProgram>C:\Prgram Files\XXXX\XXXX\XXX.exe</StartProgram>  
    

    But it’s still not that easy, so as a summary, I suggest that you can try to directly add above codes into the .xxproj(for example .csproj) file, and then export this project as a custom project template. Following is a snippet of the .csproj file, please kindly check it.

    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">  
        <PlatformTarget>AnyCPU</PlatformTarget>  
        <DebugSymbols>true</DebugSymbols>  
        <DebugType>full</DebugType>  
        <Optimize>false</Optimize>  
        <OutputPath>bin\Debug\</OutputPath>  
        <DefineConstants>DEBUG;TRACE</DefineConstants>  
        <ErrorReport>prompt</ErrorReport>  
        <WarningLevel>4</WarningLevel>  
        <StartAction>Program</StartAction>  
        <StartProgram>C:\XXXX\XXXX.exe</StartProgram>  
      </PropertyGroup>  
    

    Best Regards,
    Tianyu

    • If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
      Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

0 additional answers

Sort by: Most helpful