question

KevinFugate-8453 avatar image
0 Votes"
KevinFugate-8453 asked TianyuSun-MSFT edited

Start action set in template

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


vs-generalvs-msbuild
image.png (33.8 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

TianyuSun-MSFT avatar image
0 Votes"
TianyuSun-MSFT answered

Hi @KevinFugate-8453 ,

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.