Installing ScintillaNET, cannot add libraries in Visual Studio - c#

I want to add Scintilla to my project, because I want to make my own HTML editor.
Visual Studio doesn't want to add a reference to SciLexer.dll and SciLexer64.dll.
I've dont everything in the installation instructions.
I'm using Windows 7 64 bit and Visual Studio 2012.

It's pretty clear in the documentation. You want to reference only ScintillaNET.dll in your project, and ensure that SciLexer.dll and SciLexer64.dll are somewhere in your path. The ScintillaNET.dll is a wrapper around the two other unmanaged DLL's, and used P/Invoke to call them.
This means that you need to ensure that the unmanaged DLL's are deployed with your application.

Related

Inspect unmanaged C++ objects/variables on Visual studio 2017

So i have one C# desktop application that references a C++ dll. This dll project was developped by other persons, it can't be compiled on visual studio, I use NMake with the parameter -DCMAKE_BUILB=Debug to generate the .dll & .PDB files. I copied the files on the C# project reference folder and enabled Debugging of Unmanaged Code in the project properties. So im actualy able to debug unmanaged code from the dll. My issue is that i can't inspect any of the object nor the variables im lokking in the unmanaged code side. The visual studio contextual inspector doen't show when I passe my mouse on the objects/variables & when trying to add a spy it's not better. I need to see the values of the objects/variables from the unmanaged code to make sure it doen't do anything wrong.
Note : a coworker of mine had already opened a thread here How add spy on Visual studio using unmanaged code
But sadly the thread was closed for lack of details, so I tried to add more details to describe the issue.
Pls don't close this one
Inspect unmanaged C++ objects/variables on Visual studio 2017
Suggestion
Update 1
Please make sure that you have installed the C++ development and C# development workload in VS Installer. That's all the premises.
1) when you reference the path of the dll, make sure that the pdb file already exists under the reference folder(the folder where you referenced the dll) and then use DLLImport node to import the c++ functions.
2) Tools-->Options-->Debugging-->General-->check the option Used Managed Compatibility Mode
3) Right-click on your C# project-->Properties---> Debugging-->check the option Enable native code debugging
Also, check Allow unsafe code option under Build.
4) also, if your c++ dll is built with x64 platform, you should also use x64 platform to debug your c# main project.
In addition, you can refer to this similar issue for more detailed info.

C#.net DLL COM wrapper and installation

I'm making a load of code bits that will eventually be used in another C# program long term, but I may want to use it in various other apps, and I need to use it easily now as it gradually develops. So I've written a few C#.net DLLs in Visual Studio Express 2017. Two of which reference a 3rd-party DLL (one of which was installed by other software, one of which I just pointed at in Visual Studio), and one of my DLLs references my other 2 DLLs. I've ticked the boxes to COM register my ones and I'm now happily using them from Excel/VBA.
But how do I install it on another Win10 machine in simple steps though, so I can use the same spreadsheets and automation on those computers? (preferably with some explanation of what the steps are actually doing?) I haven't had any luck with the other options I've googled, maybe they're not "idiot proof" enough for me, or my DLLs have dependencies on other DLLs, or I'm getting them from the wrong place.
I assume these are 64-bit DLLs (they're complied for 'Any CPU') so I
want to copy them into the 64-bit place (syswow64)? Or should they go
in system32 as well?
I guess I get them from my 'release', not 'debug' folders?
I also have .pdb and .tlb as well as .dll. Do I need these? Maybe they're the missing piece of the jigsaw?
What's the difference between regsvr and regasm and what should I be using? (Or both).
Also is there a simple way to make a DLL copying and COM registering installer app? And if yes, does that still apply if it's VS Express
2017?
Thanks for the help!

Debugging Multiple Projects which are in different solutions in Visual Studio 2013

I have four different solutions: two C/C++ libraries, a C++/CLI wrapper which uses those libraries and a WPF project.
How can I debug my libraries when they are called by my WPF Project?
When you want to debug anything you call that is outside your solution, you need to help Visual Studio find the debugger information. If you just link to a library it can run code but you can't do step by step debugging becuse you're only linking binaries and not source code.
For debugging external libraries, you need two things:
link the library files compiled in debug mode
tell Visual Studio where to find the .pdb files (which contain useful information for debugging).
To make sure the .pdb files are loaded correctly, you can go in your project options then Debugging->Symbols and then select the directory where the .pdb files from your library are. Visual Studio will put the .pdb files in the release directory usually (default settings).
Important note: that since you are using a wrapper over the libraries, you need to make sure that the wrapper itself is also doing this (or you will only be able to debug the wrapper).

Unable to Import a Visual Studio made C++ DLL into a Visual Studio C# Project on Windows

I have been trying to monitor video memory for a highly performance intensive program.
So I used the NVIDIA CUDA libraries in a C++ Visual Studio Application to collect the data I need.
Unfortunately I need a package that can be used with Ruby, C# and the Software Testing tools my company has.
So I decided to compile a C++ DLL and import it into a C# Visual Studio Project for testing.
I was able to compile the DLL but importing it into my Visual C# Program has been an issue.
I right Click on References -> Add Reference. Then I click on the Browse tab and browse to the location of my DLL; "TestProgram.dll" and I click "OK"
Then I get the following Error message "A reference to C:.... could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component."
What I have tried so far:
1. Importing the DLL from several different locations on my system.
2. Moving the DLL into my Solution Explorer and importing it
3. Using the "Invoke" method: [DllImport("PathToMyDll")]
4. Using the "Invoke" method with just my dll name.
5. Typing 'using' path to my DLL
6. Exporting the dll as a .lib file instead
What am I doing wrong? I thought that if I exported a DLL using Visual Studio 2010 then surely that same DLL could be Added into a Visual Studio 2010 project.
Well, is it a valid Assembly or COM component? Just because it's a C++ DLL doesn't mean it can be used with just a reference, in fact, most can't. It needs to be a managed DLL or a COM object. If it's none of those, then you have to invoke unmanaged code from a managed assembly. That means defining each function in a stub.
More info here: how to call a C++ dll exported function from c#
Be aware, you also have to deal with 64/32 bit issues, since if the DLL is compiled for 32 bit, you can't use it in a 64 bit application.
I found the solution to this problem. CUDA creates a Windows Console Application project. So the solution was to just use that instead of a DLL.
This worked well because Ruby, Test Complete and Visual C# can read the output from a basic .exe console program (with some work).
The compiled exe is simple. All I need to do is pass in an integer as an argument when I launch the program and the program will get the data I need from my NVIDIA card.
The challenge now will be finding a good way to interface with the .exe.

How can I include files in a C# deployment?

I have a DLL I need to deploy with my C# application. It's not currently included in the installation package when I hit "Publish" so how do I include it?
Would the process be any different if I had app.config and other files I wanted to deploy with my application?
If it's referenced it should be included automatically. I've deployed a couple of apps that require a 3rd party dll and they've published OK.
Is the dll referenced correctly in your project? That's the only thing I can think of at the moment that might be the problem, but if it wasn't your code wouldn't compile and/or link anyway.
To get the xls file to deploy all you need to do is add the file to the solution and then set the "Copy to Output Directory" property on the file.
I take it you are using Visual Studio?
If your using Visual Studio 2008 (I have no experience with Visual Studio 2005) under the Publish tab in your project properties click on the Application Files button. This will bring up a list of all dependencies assembalies required by your project. If you find that required dll is not being published by the Visual Studio publisher tool by default you can go into here and set the Publish Status of the offending dll to Include.
Sometimes in my more complicated projects, depending on the type of dependency, I have to go into this menu and force certain dll's to be included opposed to the default Prerequsite setting.
...but this is all under the assumption you have the assembly properly referenced in the required projects and everything is compiling fine.
Can't you add the dll as a resource to your installer project?

Categories