Finding namespace and libraries in VS 2010 - c#

I need following namespaces to use native wpf property grid however, VS 2010 doesn't recognize them. I went over available namespaces and libraries under "Add Reference" but no luck.
An suggestions will be appreciated.
System.Activities
System.Activities.Core.Presentation
System.Activities.Presentation
Thank you.

This dll available is this location, on a 64-bit OS.
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0

The best way to find what DLL to add is to check with MSDN Library
Find the help for the class you need. Ex: System.Activities.Activity
On the page, look for the assembly name. It is locate in the top part of the page and in bold. Ex : Assembly: System.Activities (in System.Activities.dll)
Add the reference to the DLL that is between the parentheses and you will have access to the namespace.

Related

How to get list of all .NET assemblies programmatically?

I have an application to write dynamic assembly in runtime, so I need to a list of all assemblies in my system like Visual Studio Reference Manager:
My question is: How to fetch a list of all .NET Assemblies by self .NET languages and without searching a folder files?
Note:
I know I can find any assemblies from:
C:\Windows\assembly\GAC\...
or
C:\Windows\Microsoft.NET\Framework
but I not sure to find that assemblies in all system by this way!
Because I do not have access to these folders on all computers. So my app only through .NET code can fetch the names of these assemblies. And other problem is that the path to this folder on all the computers are not fixed and may vary.
You should really have a look on GAC Manager project on Codeplex :
https://gacmanager.codeplex.com/
It will be really helpful and nice to use for your purpose. On the project page you'll also find a working sample (not tried with .Net 4.6 by me anyway, hope it works well also for this one)
You can execute gacutil.exe/i command directly from your code to get list of all GAC assemblies. You can see a sample code here: https://social.msdn.microsoft.com/Forums/vstudio/en-US/d9283b0f-94b7-4fe2-9196-92f81c6e7ba0/obtaining-list-of-assemblies-present-in-gac?forum=clr
On my PC Visual Studio simply reads the contents of this directory to display this info:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5
As a test, I deleted Accessibility.dll
YMMV

Can't Load Assembly (.DLL) that's visible in References

As shown in the screenshot, VS 2010 is failing to load my OAuth reference despite the fact that it is RIGHT THERE in my References folder. What am I doing wrong? I have already restarted VS 2010.
Thanks for your help.
An assembly (the DLL) does not necessarily need to use the same names for namespaces as the DLL name. This means that your assembly (EvernoteOAuthNet.dll) may use a completely different namespace structure, ie: Evernote.OAuth. You can double-click on the assembly in References to view it in the Object Browser, and inspect what types it contains, including their namespaces. This may help you pick the right namespace for your using .
The problem was VS 2010 was deleting the assembly every time I would try to build. I found the solution:
You need to change your target framework from ".NET Framework 4 Client Profile" to ".NET Framework 4"
Ref. http://social.msdn.microsoft.com/Forums/en-US/vststest/thread/1537c41b-52b9-4e47-91b2-2e38b8fdfbfa/

Where to put my dll files using F#

I have a library with both managed and unmanaged C#, C++ dll files. I want to reference it from F#. Where can I place the C#, C++ dll files? I can not place them in the application folder (I must have copy local = false) and it will be only me who will use the program. I have tried windows/system32, GAC using setup and adding PATH variable pointing to a folder with all the dll files but none of it seems to work.
Thanks for any hint
When building your application in Visual Studio, it looks for the references in all the default folders (depending on your OS, .NET Framework version and other things) but also in locations you specified in the project configuration. Right click on the project in Solution Explorer, click Properties and go to the Reference Paths tab. Add C:\MyDllFolder or anything.
If you do this in all your applications which are using that dll, you could just have it sitting there once.
You can specify dll locations MSDN : Specifying an Assembly's Location or maybe use something like
Assembly.LoadFrom
if you want dynamics.

The project has an assembly reference missing it's <Private> element

I am trying to use cruise control .net to build a solution using msbuild. When the project is built inside of Visual Studio (2010) I do not receive any errors; however, when I try to let cruise control build the project I receive the following error:
The project has an assembly reference missing it's <Private> element.
The project does not have any missing assembly references, so I know this is not the issue.
I have scoured Google for an answer and have found nothing... have any of you run into this issue before? Any help would be greatly appreciated.
Thanks.
Psychic Guess:
Try editing the project file directly and add the following tag
<Private>True</Private>
to the inside of the Reference tag (for the dependency/ies that is/are having issues)
Otherwise can you link the msbuild output and the project file in question.
Here are a several guesses:
Are you fetching everything from source control?
Are any references to dlls using the full path that doesn't exist on the build machine?
Do you have a difference in build order for debug and release builds?

Missing System.Windows

I have a rather large solution with some Silverlight and WPF projects inside it, as well as some class libraries and other things.
One of the project is a class library that references a SilverLight application which references System.Windows
But at runtime, I get the error:
{"Could not load file or assembly 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified.":"System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e"}
I looked in the GAC (C:\Windows\assembly) and couldnt see it in there...
Whats happening here?
The reference is to: c:\Program Files\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\System.Windows.dll which DOES exist.
Sounds to me like your WPF app is loading a class library that references a Silverlight assembly. That cannot work, cats and dogs. If an assembly is referenced by both a WPF and a Silverlight app then it has to be compiled twice with different framework assembly references. That takes two projects. Keeping the WPF and the Silverlight stuff separate in different solutions is the best way to keep out of trouble.
I've seen similar errors in two cases that might apply here:
When an assembly I reference required an assemble I have not referenced . . . in this case that would mean System.Windows is using something else you need to add a reference too.
The more interesting case is when VS2010 auto selected ".Net Framework 4 Client Profile" for me when I actually needed ".Net Framework 4" (no "client profile"). Select the project properties and see what your setting is.
Frank
Per you request additional instructions:
Open Solution in VS2010, right click the project in question (not the solution line) and select "properties" from the bottom. In the resulting GUI, select the "Application" tab and make sure "Target Framework" does not have "client profile" in the name . . . that is should be ".NET Framework 4" not ".NET Framework 4 Client Profile".
I have not found this solution anywhere else, but stumbled upon it as a trial-and-error-by-fire...
The error message was a bit misleading in my situation. The tip off was that it wasn't really the "System.Windows" assembly itself, but one of the dependant assemblies.
What you may want to do is to check your GAC and see if one of these assemblies are in it:
System.Windows
System.Windows.Controls
System.Windows.Controls.Toolkit
System.Windows.Controls.Layout.Toolkit
Try removing them from just the GAC, then do your rebuild. If it doesn't work, just open two windows explorer windows and copy them back from either the c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\System.Windows.dll folder or the folder for your Silverlight Toolkit and you'll be back to where you started from.
Here's what I suspect is happening:
The Visual Studio 2010 compiler is getting confused about where to get those referenced assemblies when doing the build because the GAC assemblies always takes precedence over another copy of an assembly (even the reference assembly folder that VS2010 uses). So even though the assembly is technically correct with the same ID key and everything there's something with the VS2010 compiler that can't determine which library to use for building and it will refuse to complete the build.
mmmm sometimes you put your classes in different project for example you can create a project for viewmodels , if is this the case then you need to reference PresentationCore.dll , this is the dll that give you access to System.windows so you can use ICommand for command bindings

Categories