I am pretty new to WPF Developing and i am trying work with the GraphSharp lib within my project but I cant access the GraphSharp.Controls dll classes.
i declared this row in my mainwindows.xaml file
xmlns:gsc = "clr-namespace:GraphSharp.Controls;assembly=GraphSharp.Controls"
and when I try to write
<gsc:GraphLayout/>
Note-GraphLayout is a class that represents a graph in xaml
I tried to look on how to declare namespace in xaml and other resources but couldn't find a good answer for my problem...
Did you try to rebuild the solution after adding the GraphSharp lib? In order for the XAML designer/editor to see it, it needs to have the solution rebuilt. Otherwise it will give you an error stating it could not be found.
I just added the GraphSharp lib to a project and was able to use the same namespace you provided, so the namespace is valid.
Also make sure you have added a reference to the GraphSharp library in your project. The best way to do this is via NuGet. Right-Click on your project References and chose to add a new NuGet package. Search for GraphSharp and install it.
Related
I'm not new to C# programming, but I suppose I'm new to programing "the right way" in C#. I've worked in C on embedded devices for years and have written desktop apps to support them. First in VB6, then in C#.
I recently started making better use of classes for reusing code (and for instantiating more than one instance of the class in a program). For example, I "wrapped" a UART interface with some additional functionality so I can use the same code for multiple ports by creating an instance of the class for each one.
It is in a separate file, but still in the same program namespace, so when I want to reuse it, I have to copy the file and change the namespace to the new project.
I'm sure there's a way to create it such that I can just reference it like everything else with either a "using..." reference at the top of the program or with a "Project | References..." checkbox. But for the life of me I can't find a good learning journey for this.
Any direction would help.
You want to create your reuseable class in an assembly - this is the equivalent of a dll from your C experience.
To create an assembly, have a separate project of type assembly (instead of exe) . You can reference the assembly from other projects. If your project is in the same solution you can reference the project, otherwise you can reference the compiled assembly.
C# uses a packaging system called Nuget, so you can package your assemblies into "Nugets" which you host in a Nuget Server. You can then use tooling to discover and import these.
Please create a Class Library project and include your class into that project. Make sure your class is public. Once you build this project you'll get an assembly which can be referenced from other projects. See Tutorial: Create a .NET class library using Visual Studio
There are different ways of referencing it.
You can have the class library project in the same solution as the main project. In this case you should add a project reference.
You can copy the compiled *.dll file to some folder in your solution (e.g. Lib) and add an assembly reference.
If this assembly is to be used in multiple projects please consider creating a NuGet package with this library and pushing it to some repository. Then other projects can add a package reference to this package.
Details:
How to: Add or remove references by using the Reference Manager
Install and manage packages in Visual Studio using the NuGet Package Manager
It is in a separate file, but still in the same program namespace, so when I want to reuse it, I have to copy the file and change the namespace to the new project.
Well, it isn't the best practice but (unfortunatly) still a common behavior. So don't worry to much about it.
What you could do to improve it place the file (and other reusable parts) in a seperated csproj.
For example name the project of the type class library and name it VinDag.Tools. Within the project create a folder UART and place the wrapper there. The namespace of the wrapper would then be VinDag.Tools.UART.
From know on you can just reference the class library instead of renaming the file. It's not necessarily required to be the same namespace as the project.
From there you can start considering (private) nugets. This would prevent you from copying files/csproj around.
I am trying to create a custom library in C# using Visual Studio and then be able to refer to it from code-stages in BP objects. I know that the .dll has to be placed in the Automate folder for BP to see it, but what about .exe, config and all other files? Just placing the .dll only in the Automate folder doesn't seem to work for me. I did reference it under Code Options on the Initialize page and also placed a Namespace under Namespace Imports. But BP still tells me that the library is missing. Do I need to package as NuGet or some other way? I have zero experience doing this, so I am sorry if this is basic.
I was wondering if someone could point out some tutorial or information on how to do this A-Z, or maybe share their experience doing this? Thank you.
If you want to create a DLL to be used with Blue Prism, the best thing to do is to compile the code with all its references and resources into a single DLL.
I have always used Costura Fody to achieve that for usage in BP several times.
Thank you for reading my question.
I am updating a third-party library. My goal is to add a new control.
I seem to have added a new class to the namespace containing the group of controls, which I am trying to extend.
However, when I try to link again my "now extended" library, I don't see my new control.
Where does Xamarin Studio get the information regarding the classes contained inside a resource DLL? Is it from an mdb file?
Also, when I compile my library, DLL is created fine and mdb is not created. Is this OK?
Please advise.
Thank you
While I could not figure out how to find out from Xamarin Studio where is each/in-question listed library located on the disk, edit references menu has an option to specify the location from which the newly referenced assembly is loaded. This worked.
Thanks.
I frequently load dll file and import namespace for instance
xmlns:UI="clr-namespace:Microsoft.Advertising.Mobile.UI;assembly=Microsoft.Advertising.Mobile.UI"
and then create XAML element using it
<UI:AdControl .../>
Can anyone share a post where is described how to create such a useful dll?
You create this like any other DLL in .NET:
Create a "Library" project. There is a "User Control Library" in some versions of WPF, so you might as well use it, but I believe a standard "Class Library" will work just as well
Add a "UserControl" to your library. Make sure it is marked public!
From the project that will use this DLL, add a reference to the new library project
Create a xmlns line like the one you have, but mapped to your assembly and namespace
Use the UserControl, again just like you already have.
Nothing special really, it really is just like any other DLL project.
(VS 2008)
I'm using a C# library for my VB.NET project. And the method summary/notes or what they are called do not show in intellisense. Is this supposed to be like that? Or is there something I must do to fix it? And if not, will VS 2010 be able to do this?
EDIT: Still unresolved. Now building library dll + xml file, but how to import the xml file in my vb project?
See image: http://i52.tinypic.com/25kh5xw.png
In C# library, go to the properties on the build tab, and check the checkbox for including XML documentation and specify the name and path. After that include the new library in your VB.Net project.
one reason could be resolved by importing the namespace needed
another reason could be due to faulty writing
if you send the code where the problem is we might be able to help you
If you're using source control (TFS or Github) then you need to the following:
Check in ( Push) for safe return point (base line)
Delete the references from the project.
Delete the custom dll's from the solution.
At this point the libs are marked as [removed], if you would add them again at this point, they will just be marked as [changed] again. This did not include the summaries for me.
Check in (push). dll's are now removed from source control as well.
Drag and drop the dll's (including xml) into the solution (I recommend using this method for including dll's
Add references to these dll's via Browse.
Check if you have summaries.
Check in (push).