简体   繁体   中英

VS2010 can't find common C# dlls

Sorry for the simple question, but this has been killing me and I can't seem to find the answer. I'm writing a Silverlight 5.0 application in C# with VS2010. .NET 4.5.40805 SP1Rel. In the directives of the codebehind, I've added "using System.Diagnostics;" so I can use "Process()". While intellisense will complete "System.Diagnostics" for me, I can't seem to use the Process class located therein. If I try to "Add reference" via the solution explorer, System.Diagnostics is not there.

Am I using the wrong directive? ( http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx as well as the object explorer suggests I'm not) Is there somethings I'm missing for effectively adding these references? Please help me with this recurring problem. Thank you.

AFAIK, Silverlight doesn't have access to System.Diagnostics.Process because of its Core CLR and security considerations. The MSDN page you linked to doesn't have a "Microsoft Silverlight" framework version to look up which is a good marker for this. Any classes that do exist in Silverlight will have a "Silverlight" version of the MSDN page (don't look at the ".NET Framework 4" versions).

For example, the .NET Framework 4 version of the System.Diagnostics namespace shows a slew of entries: http://msdn.microsoft.com/en-us/library/system.diagnostics.aspx However, the same page for Silverlight only shows a few: http://msdn.microsoft.com/en-us/library/system.diagnostics%28VS.95%29.aspx

My guess is that your project is set to use a "Client Profile" version of the framework. You can change this by right-clicking your project and selecting properties, then under the Application tab, changing the target framework to something that doesn't use a "Client Profile".

If this isn't the case, then I'm not sure what to suggest and hope that someone more knowledgeable than I responds. :)

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