How to install an additional .NET library? - c#

I'm a beginner .NET programmer (C# and IronPython).
I've come across WatiN .NET library which will show handy for what I'm trying to do. The website claims that it is compatible with any .NET language, so I assume it's compatible with IronPython as well.
How do I go about installing it? Their website only has some instructions, using NUget in Visual Studio. I neither use Visual Studio nor am I interested in it. How and where would I put the downloaded files in order to make it work with IronPython?

A library is a .dll file ( or many ), if you used nuget there should be a folder called packages in your solution folder and in there a folder with your dll.
What you want is to add a reference to that dll. Have a look at this

Related

Cross platform C# and C++ VS2022 solution

I'm currently converting a VS solution of a C# web application targeting .NET Framework 4.8, that has interop to C++ native libraries using C++/CLI as a bridge.
My goal is to port it to .NET 6, and make it all cross platform, so C++/CLI has to go. Also I need to make changes to my C++ native library projects which currently have dependencies to Windows SDK.
I've read that CMake is the way to go, and that VS 2022 has good support for it. I'm trying to set up a sample solution that has a single C# project and a CMake project, but it has proven to be very challenging.
It's like there is no such thing as a CMake project, but rather just a folder with a special CMakeLists.txt file.
When I add a CMake project it unloads the VS solution file, and the whole IDE changes to the Opened Folder mode. I cannot add an existing CMake project to a solution, because there is no project file.
The experience is sub-optimal.
The VS solution I'm trying to convert has a handful of C# and C++ projects, and it would be nice to be able to keep them all in the same solution.
Am I doing something fundamentally wrong? Should I be using something else instead of CMake?

How to create Nuget package with C# and C++ libraries built with different options?

There is a project that wraps V8 engine into C# library. Its nuget package is broken and i'd like to fix it. Creating a package seems easy and there is documented way to pack different C# dlls for different .NET versions. However, i have no idea how to package .dll with C++ and C# code which could be built with different options:
x64 or x86 and not "Any CPU"
MS Visual C++ 2010/2012/2013
debug or release
.NET 4.0/...
I've found this thread and it seems that one can use .targets file with MSBuild commands inside. Then i've read in the docs that MSBuild way is old and not recommended. So what should i do?
One more question is: if this package depends on MSVC++, how to specify this? How to let package consumer select a specific version of dll (built against MSVC++2010, 2012 or 2013)? I suppose it is not a good idea to package msvcr*.dll.
Take a look at how the SQLite packages deploy their DLLs. With the 2.x and earlier versions of NuGet you need to write some powershell code to inspect the version of Visual Studio and apply your changes to the project manually.
We are working towards a more elegant solution for this exact problem with the updates that are to be deployed in NuGet v3

C# Setup with external DLL

I am trying to make a setup for a C# application in .NET 3.5.
The application runs an other application which was compiled for .NET 4.5 and uses some DLLs. I want to add this application to the application folder in the setup.
I can't add the DLL's to the setup as a file, there is an error popping up. ("The operation could not be completed")
If I add the DDLs to the project folder and then use them as content, I get an "Unrecoverable build error" when I create the project.
How am I supposed to add these DLLs? I do not care how, but I need them in the project folder.
Thanks.
PS: I am using the standard setup for VisualStudio 2008.
With Visual Studio, when you add your external DLL as a reference in a project, it will automatically be added to the setup.
First of all, isn't there any way to find an earlier version of the assembly targeting .NET 3.5? Or if you have access to the source, remove/change the .NET 4.5 specific code and recompile?
Otherwise, you can try to wrap you dll around a COM interface, as described here. This article targets .NET 4 dll used with .NET 2.0 but the mechanism should still work in your configuration. I have used it successfully myself for 2.0/4.0 interop.
Here is another trick you can try.
Consider that in either case you will need .NET 4.5 installed on target computer, in order to work. So you can move your project from 3.5 to 4.5. I understand that you use VS2008 which doesn't have .NET 4.5, but you can use express (free) edition of Visual Studio from here -> Microsoft Download Page
I solved this problem using a simple trick:
The errors came only from the DLLs written in .NET 4.5. The executable (.exe) did not cause any errors. What I did is to package all the DLL's into the exe using the ILMerge tool.
Then I added the .exe file to the library and everything worked like a charm.
ILMerge download site (Microsoft)

Installing Twilio C# api with VS2008

I have successfully installed and tested twilio api with C# .Net framework 4.0 using VS2010. I referred to the link https://www.twilio.com/docs/csharp/install which has instructions to install with VS2010/12
Now I have another computer where I have to install twilio C# api with .net framework 3.5 and VS2008. How can I do that ?
I tried to copy the dlls and take reference but it didn't work.
Kindly let me know how can I install twilio api for C# with .net framework 3.5 and VS2008 ?
Twilio evangelist here.
You will likely need to manually download the NuGet package since there is no built in way in VS2008 to do it. There are a bunch of ways to do this:
NuGet Package Explorer
NuTake Chrome extension
NuGet support for Visual Studio 2008
Once you get the nupack file change its file extension to .zip, extract the contents and locate the folder that contains the .NET 3.5 version of the assemblies. Then add to your project.
Or you can always pull the source from Github.
Hope that helps.
Had to add SMS support to a legacy VS2008 app, and here's an easy way to do it.
Use VS2010 or later, create some dummy project, and then use Nuget Package to download Twilio. It will create a 'packages' folder inside your solution directory.
Use VS2008 to open your actual project.
Right click on references, select 'Browse' tab, and browse to the packages folder inside your dummy project you obtained in step one.
You need to add two references (one for Twilio, and one for RestSharp, which Twilio depends on). They are located in these two folders:
...\packages\Twilio.4.4.1\lib\3.5\Twilio.Api.dll
...\packages\RestSharp.105.2.2\lib\net35\RestSharp.dll
The versions I specify above are targetting .NET 3.5

How to install lastfm plugin for c# in .net framework

still newbie on C#.
i never installed a plugin, on my .net framework but i would like to build an application communicating with lastfm webservices.
so i went in the api lastfm page and i downloaded the lastfm c# plugin here.
now i have one zip with the plugin inside.
i don't know how to install it before to include it in my new project.
how can i do?
thank you in advance
If you only want the binaries and not the source then make sure to download the binaries download - otherwise you will need to build the source yourself.
Extract the zip file and inside you will find a dll called lastfm-sharp. I recommend moving this to a lib directory in your project. Then you need to add a reference to to your project which is explained here.

Categories

Resources