A place for spare thoughts


Missing WPF menu items in Visual Studio

Filed under: VisualStudio, wpf — Ivan Danilov @ 12:21

Probably you as me often were confused by the fact that some useful menu items are absent in the Add New Item in Visual Studio when you are working with Class Library.

When adding item into WPF Application you have this menu:

But with Class Library you have only this:

It turns out that you should be adding not Class Library if you want to work with WPF features but rather WPF Custom Control Library project. And then you will have all you need. I find it myself while reading Karl Shifflett’s article. Thanks, Karl! 🙂

Everything is great. Except the fact that you could already have Class Library with hundreds files inside. What should you do in this case? Replacing project and adding all your files again not seems like a good idea. So lets find out what is the difference between the project files from Visual Studio’s point of view.

I’ve created new solution, added there WPF Custom Control Library and plain old Class Library. The diff between the WpfControlLibrary1.csproj and ClassLibrary1.csproj you could see below:

The interesting point is highlighted. Its the only significant difference. In order to have XAML-related menu items in your project you have to paste this line to your *.csproj file:




1 Comment »

  1. […] 11/07/2011 sparethought Leave a comment Go to comments Well, I already faced similar problem here so I know where to look. And it was really the […]

    Pingback by Troubleshooting: MSTest assembly doesn’t get discovered by VS native test runner « A place for spare thoughts — 11/07/2011 @ 16:06

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Blog at WordPress.com.

%d bloggers like this: