I'm using Visual Studio 2010 Express for C# and am having trouble installing the code pack. I downloaded the source from MSDN and don't know what to do with it? I opened the WindowsAPICodePack.sln and attempted to build the project and got:
Error 16 The type or namespace name 'ContentPropertyAttribute' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Joe\Downloads\WindowsAPICodePack\Shell\CommonFileDialogs\CommonFileDialogRadioButtonList.cs 13 6 Shell
and
Error 13 The type name 'IComponentConnector' could not be found in the namespace 'System.Windows.Markup'. This type has been forwarded to assembly 'System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' Consider adding a reference to that assembly. C:\Users\Joe\Downloads\WindowsAPICodePack\Shell\obj\Debug\Controls\CommandLinkWPF.g.cs 42 99 Shell
each about 5-6 times each.
I attempted to build the samples also but got similar errors.
How do I install the code 开发者_高级运维into Visual Studio?
How do I fix the errors?
How do I include the code into my projects?
Can I make the Library usable in my projects with just a "using" command?
Add a reference to System.Xaml.dll
to your project.
I've just downloaded version 1.0.1, opened it up in Visual Studio 2010 Professional and built it with no problems at all.
Check which version of .NET your projects are now targeting. It's possible that the Express edition automatically "upgrades" projects to target .NET 4, whereas mine have been left targeting .NET 3.5.
Another thing to check - do you have .NET 3.5 installed? I'd expect so, but it's worth checking.
When you've built the projects, you need to do two things to use them:
- Add a reference to the built assembly (e.g. Microsoft.WindowsAPICodePack.dll)
- Add a
using
directive to the appropriate namespace. (This is actually optional, but otherwise you'll have to use the fully-qualified name for any type in the library, which isn't generally what you want.)
精彩评论