Tomasz Kot
Tomasz Kot

Reputation: 293

Visual Studio removes props file definition from vcxproj file

I created a Project Template https://learn.microsoft.com/en-us/visualstudio/ide/creating-project-and-item-templates?view=vs-2017 Inside vcxproj I have props file definition: (left side of the image): props in vcxproj

The prop file is present in the project package. When creating a New Project the line with prop file definition is deleted from vcxproj by Visual Studio. When I restored it manually and reload project everything works fine. What can be the reason Visual Studio is doing that?

Upvotes: 0

Views: 2146

Answers (1)

Leo Liu
Leo Liu

Reputation: 76928

Visual Studio removes props file definition from vcxproj file

First, make sure the props file exists in the project template, Second, make sure the new project is created with the custom template. You can follow below steps:

  1. Create a new C++ project, which I named it MyCustomTemplate.
  2. Unload the project , then add <Import Project="$projectname$.props" /> to the project file .vcxproj.
  3. Reload the project, go to the Project tab, select Export Template, click Next and Finish. (You can check if the props line is exists in your template file, open the .vcxproj with notepad.)
  4. Create new project with the new custom template MyCustomTemplate, then unload the project and check the props file.

enter image description here

Update:

Since you are using the Visual Studio 2015, you would get that error. And if you upgrade your Visual Studio to 2017, everything will be fine.

If you do not want to upgrade your Visual Studio to 2017, you can follow the method of Paul H. to resolve this issue:

How to include a property sheet in VC project template

Hope this helps.

Upvotes: 1

Related Questions