How to add and build files in Visual Studio 2017

How to add and build files in Visual Studio 2017

I’m making cocos2d-x games that can be played on mac and windows.

I already have a project under development with mac xcode.
It runs fine on mac.

I opened win32/MyGame.sln in Visual Studio 2017 to run it on windows.
There were only AppDelegate and HelloWorldScene in src of solution explorer, so I deleted them and drag and drop all files in Classes folder.

When I did retarget solution and built it, it failed with errors.


Several errors “cannot open include file” have been issued for the file that should have been added to src.

The same failure occurred when I executed “cocos run -p win32” in the project directory.

The execution of the test project without any changes was successful.


How can I add and build files correctly in Visual Studio 2017?

I use cocos2d-x 3.17 and Visual Studio 2017.

Thank you.



Did you try not dragging and dropping? Just add the files manually, right click, add files, etc…

1 Like


Thank you for your reply.

In my project, there are multiple folders under Classes, in which files are stored.

Finally I decided that all the files needed to be in the same folder.

I created a new folder proj.win32/Classes, copied all the files in Classes and extracted them.
And I drag and drop proj.win32/Classes to Visual Studio and succeeded to build it.

But now I have problems loading Resources.

I created a proj.win32/Resources folder as well as Classes, copied all files in the Resources folder to this.
I changed (MyGame)->properties->Debugging->WorkingDirectory to specify proj.win32/Resources folder.

And as a result of the build, an error occurred that the plist file in the Resources folder could not be read.

cocos2d: fullPathForFilename: No file found at NRZPlayer.plist. Possible missing file.

Image and audio files are successfully read, but only plist files fail.

I’m trying to read plist with such code.

ValueMap profile = FileUtils :: getInstance ()-> getValueMapFromFile (key + “.plist”);

profile remains empty.

How can I read a plist file?



but you should not need to create these folders at all. They are created when you run cocos new ... Did you run cocos new ... or did you create a project in a different way?