I would like to use log4j.net in my windows forms project. However I have never used any library or dll in .NET. How to do it? I look at the site, but I can't find it.
I'm using visual studio 2010.
Add the log4net assembly to your project:
Browse to the log4net downloads page and download the latest log4net archive
(right now the latest version is 1.2.10).
Extract that archive and place the files somewhere to your project
(for example in a folder like yourproject/lib/log4net).
In Visual Studio right click in your project on the References folder and click on Add Reference....
Browse to the folder where your assemblies are (see point 3) and choose the log4net.dll assembly.
Here are some nice basic tutorial for the first steps using Log4Net:
Log4Net Tutorial pt 1: Getting Started
Using Log4Net in 4 Simple Steps
Log error or exception using Log4Net
In your project, you need add a reference to the library, usually by selecting the DLL from the references dialog.
A package manager, NuGet, has been created as an add on to Visual Studio 2010, which lets you select libraries - it will download and set them up for you.
Whichever way you do this, you will now be able to use the library - in a code file, use the using directive to import the namespace, then you can use the classes and other public members of the library in your code (though you could use the fully qualified name every time, if you wish to).
This has nothing to do with a library being open source or not, by the way.
you can easily get now using NuGet package manager in visual studio 2010
Write this command in Package manager console.
Install-Package log4net
See this link
Do you have any specific problems?
Check link below and maybe ask a question if you are stuck on something:
http://sadi02.wordpress.com/2008/06/29/log4net-tutorial-in-c-net-how-can-i-show-log-in-a-file/
Related
I have a VS2017 solution and project which is displaying these core dll libraries in solution explorer, which pollutes the view.
The dlls are included via a .targets file included in a 3rd party nuget package.
I know this because when I try right click item -> remove, I get error prompt:
Cannot modify an evaluated object originating in an imported file
"....nuget\packages\some.third.party.package\1.0.0\some.third.party.package.targets"
Obviously, best thing to do would be to solve root problem and not include these dlls files in msbuild targets file, however let's assume I cannot remove/modify/update this 3rd party library and it is necessary to use.
How can I configure Visual Studio (2017) to not show these dlls? Some way to filter the view is a good enough fix for me.
How can I configure Visual Studio (2017) to not show these dlls? Some way to filter the view is a good enough fix for me.
To my knowledge, there is no such configure Visual Studio (2017) to hide those dlls. Because those files are included via a .targets file included in a 3rd party nuget package, we could not handle those dll files directly. In addition, you also have no control over this third party package.
So I am afraid you could not hide those dll files in Visual Studio 2017 without manipulating dlls files directly.
I have found the FTPFactory Code Project, and I want to test drive it. However, so far I only installed new packages via Nuget. How do I add FTPFactory to my Solution in Visual Studio 2015?
You have 2 options.
Since this is such a simple single class library, you could just manually copy the ftp.cs file from the source and add it to your project.
Alternately, you can download and build the project which will produce a FTPTest.dll file. You can add a reference (browse) to this file in your project and use the class form there.
I am making a C# Web Form application and I want to use RedditSharp. https://github.com/SirCmpwn/RedditSharp
I've never used an API in C#, this would be my first time using something outside of the C# generics. Could someone help me understand how to import it to use it?
Create C# Web Forms project in Visual Studio
Download RedditSharp code from Github
Compile RedditSharp into DLL (build enclosed solution, grab DLL from the bin/release folder or wherever it builds to)
Add a reference from your project to RedditSharp DLL
Check examples at https://github.com/SirCmpwn/RedditSharp, add something like that to your code
Don't forget to add "using RedditSharp;" to the top of your code file.
Easiest thing to do in Visual Studio is to install the nuget package. Go to Tools...Nuget Package manager... Manage Packages for Solution. Search for RedditSharp, click install.
Now you can reference it from anywhere in your project by adding:
using RedditSharp;
This has the added benefit of Visual Studio alerting you to new updates anytime the official RedditSharp project is updated.
I have several reusable parts of my code in a .ttinclude file. I would like to make a reusable / installable visual studio add in (something like a VSIX) to deploy this file and then be able to include it in any t4 template in any project, just as if it were an assembly reference (something like being able to install the .ttinclude file to the GAC).
I already googled about it but I couldn't even find a tip on how to start doing this.
Any help is appreciated.
You can for instance use NuGet, NuGet is shipped with Visual Studio and is a pretty decent. For inspiration take a look at: https://github.com/mrange/T4Include/tree/master/NonSource/NuGet
The .nuspec file is used by NuGet to build a package and it deploys 3 ttinclude files and a sample tt file.
Hope this can help you get started.
I come from a long Java background and very new to C#. I was trying to run one of the starter kit applications from Windows phone and I am getting this error.
A first chance exception of type 'Newtonsoft.Json.JsonReaderException' occurred in Newtonsoft.Json.WindowsPhone.dll
I am finding it hard to debug this because I am directly referring to the dll file under References pointing to Newtonsoft.Json.WindowsPhone. In Java, I would have searched for the library and downloaded the source to step into the exact location during debugging.
If that is possible, how would I do it in C# (as in how would i refer the library source for my project to pick up at run-time)? I am using the Visual studio 2010 Express Edition as the IDE.
Download the third party library you are dealing with
Add this library's project into your solution
In your project, remove the reference to the 3rd party library
Add a project dependency into your project, make it depend on the 3rd party library project you have just added to your solution
Compile and run, happy debugging
My best guess is you should download last release of Json.NET, remove the compiled library from your project's references and add reference to the source code project. (Add Reference... > Projects > Browse...)
Once you have stopped your program in the debugger, you can use the modules window to load the symbols for Json.NET. Obviously, you need to have the symbols on your machine so you can browse to them.
Failing that, you can switch to a project reference and include Json.NET in your solution as Dan suggested.
The easiest way is to download their latest build then inside visual studio right click your solution and under add menu select existing project point to project file of the library and click open button. after that u will be able to set brakepoint wherever u want.