简体   繁体   中英

C# Windows API Code Pack

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?

System.Xaml.dll的引用添加到您的项目中。

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 (eg 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.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM