1

I have inherited a Visual C++ project with about four thousand lines of code in a single file. The code compiles great with /clr:oldSyntax but when I change anything in the designer, it updates it to the new syntax and then everything breaks.

How do I keep the designer from converting my code to the new syntax (gcnew et al)? If this isn't possible, what's the quickest way to convert the entire project at once to the new syntax?

Tim
  • 14,447
  • 6
  • 40
  • 63

1 Answers1

1

Unfortunately, this is not possible. The Windows Forms designer stopped supporting the old managed C++ syntax back in version 2003. You'll have to either revert back to that version of Visual Studio for maintenance of this code base, or bite the bullet and convert the project to use the new C++/CLI syntax.

I don't know if you're going to find much in the way of an automated solution for converting from managed C++ to C++/CLI. You might start looking in the answers to this question.

In my personal experience/opinion, the designer is more trouble than it's worth when working in C++/CLI. I would strongly consider making the necessary modifications to your form classes by hand and not letting the designer bungle your code in the first place. "If it ain't broke, don't fix it."

Community
  • 1
  • 1
Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574