Dan
Dan

Reputation: 650

WPF migrating backwards to vs2010

I have a WPF application I've been working on for about a month at work, but because of licensing issues I have to convert it back to vs2010 from a vs2013 project. I'm none too thrilled, but what can you do. I can only find material on upgrading from 2010 to 2013, not downgrading (which makes perfect sense).

Unfortunately but understandably, you can't open vs2013 projects in 2010, so I'm starting a new WPF project in 2010, and adding files in.

One of the things I've noticed is that 2010 doesn't seem to have App.config, or App.xaml and App.xaml.cs. I am using App.config to store connection strings, and App.Current.Properties to store data from window to window in the application although that functionality doesn't seem to exist.

I do not know what to do to make this work. Is there a major difference in how one is supposed to program WPF from VS2010 to VS2013? I don't know to get around these issues. I'm perfectly happy to rewrite code if I have to, but I don't know what the old way to do these things may have been.

Upvotes: 1

Views: 33

Answers (1)

Dan
Dan

Reputation: 650

It turns out I had accidentally created a Windows Forms project in vs2010, which was the source of most of the issues. However, when I switched it to a WPF project, I did still need to add a reference to System.Configuration, and add a couple of using statements. It turned out to be relatively painless. Then of course the other thing you have to do is make sure the startup uri is set to what you want. It's in App.xaml, and in my case I change it from

StartupUri="MainWindow.xaml"

which is the default,

to

StartupUri="LoginWindow.xaml"

which is of course my login window, which I want to launch straight away.

The only other thing to do is move the data classes over, move the .xaml files over, and move the .xaml.cs files with them. Then just use 'Add Existing Item' to put them all in the project. Pretty straightforward.

Upvotes: 1

Related Questions