Unable to Register/UnRegister dll with Visual studio 2010 and regsvr32 tool - dllregistration

My project generates a dll and when build in Debug mode the dll gets registered automatically by Visual Studio 2010. But when I try to register the same dll in the command prompt using "regsvr32" I'm unable to register/un register.
I tried registering and unregistering the dll using the following command,
regsvr32 dll_name.dll
regsvr32 /u dll_name.dll
Start -->Command prompt (Run as Administrator) --> regsvr32 /u dll_name.dll
I have tried registering dll with the Command prompt in Administrator Mode
C:\WINDOWS\system32>regsvr32.exe C:\User_Application\bin\Debug\dll_name.dll

Related

Installed Custom Visualizer not loading in VS2022

I am trying for some hours to install a custom visualizer in VS2022. Basically it is a simple string visualizer that opens a wpf form.
I followed this: https://learn.microsoft.com/en-us/visualstudio/debugger/how-to-install-a-visualizer?view=vs-2022
But the instructions do not seem to work.
When the visualizer and the test console app are in the same solution, the visualizer works, shows up. Everything is alright, but that is not of too much help
What I have tried until now, but without success:
Copy all visualizer dlls in C:\Users\XXXX\Documents\Visual Studio 2022\Visualizers
Copy all visualizer dlls in C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\Packages\Debugger\Visualizers
Checked on multiple projects, some targeting .NET Framework 4.7.2, some .NET 6
Checked on one of my colleagues pc, also with VS2022
Copied all dlls to a folder here(where I found DataSetVisualizer and IEnumerableVisualizer): C:\Program Files\Microsoft Visual
Studio\2022\Professional\Common7\IDE\CommonExtensions\Platform\Debugger\
Run devenv /ResetSettings from an admin console
Run devenv /resetskippkgs from an admin console
Run Visual Studio as administrator
Checked in Debug => Windows => Modules to see if the custom dll is loaded
Do you guys have any idea what should I try? Or what could be the problem?
Did any of you succeeded in running a custom visualizer in VS2022
Thank you
So, after some days, and many hours of trial and error, I could finally install and see my custom visualizer.
Basically, what I have done and (I think) it solved the issues:
Cleaned up all the dlls from "C:\Users\XXXX\Documents\Visual Studio 2022\Visualizers" and all of its subfolders corresponding to .net framework versions
Checked that my visualizer corresponds to the correct type:
[assembly: DebuggerVisualizer(
typeof(DebuggerSide),
typeof(TextChunkObjectSource),
Target = typeof(IEnumerable),
Description = "PDF Visualizer")]
Don't put List<TextChunk>, or IReadOnlyList<TextChunk>, instead of IEnumerable<TextChunk>
Delete bin folder(s) and rebuild the visualizer project
Make sure to copy the dlls in all the needed folders:
I had to copy them here:
C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\Packages\Debugger\Visualizers\
C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\Packages\Debugger\Visualizers\netstandard2.0\
C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\Packages\Debugger\Visualizers\netcoreapp\

Open Visual Studio (Not Visual Studio Code) from the ubuntu bash terminal on windows

I was wondering if it is possible to open Visual Studio (Not Visual Studio Code) from the ubuntu bash terminal on windows.
Opening Visual Studio Code just works fine but I couldn't find a way on how I could actually open Visual Studio from the command line.
Thank you in advance!
It is possible to refer to anything in the Windows file system from inside WSL. However, understand that, since Visual Studio is a Windows exclusive application, it will run in the context of your host Windows OS, not the Ubuntu guest OS. By contrast, Visual Studio Code is a Linux-native application; so it can run in either context.
Try this:
’/mnt/c/Windows/System32/cmd.exe /c “/mnt/c/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/devenv.exe”'
If this works, you can save the command as an alias in your .bashrc
References:
https://learn.microsoft.com/en-us/windows/wsl/interop
https://medium.com/#heinrich10/launching-windows-application-on-windows-subsystem-for-linux-wsl-60cc2c165029

How to compile Winsock Control 6.0 on VB6 in Windows 10?

When trying to compile in the "Winsock Control" component on Windows 10, I get this error:
mswinsck.ocx could not be loaded
Notably, I have installed VB6 SP6, and with SP6 it works great on Windows 8.1 and Windows 7, but it won't compile on Windows 10.
Also notably, the compiled .exe, when compiled from Win7/8, has no problem loading ws2_32.dll. It's just the compiling step that doesn't work on Win10.
Running Dependency Walker, depends.exe suggests mswinsck.ocx can't be loaded because it's depending on API-MS-WIN-CORE-SYNCH-L1-2-0.DLL and API-MS-WIN-CORE-PROFILE-L1-1-0.DLL and API-MS-WIN-CORE-PROCESSTHREADS-L1-1-0.DLL and a bunch of other DLLs with similar names (I think these DLLs have something to do with SysWOW64), which can't be found:
Does anyone know how to compile in "Winsock Control" in VB6 on Win10?
(Also notably, it seems the MSFlexGrid component is un-compilable on Win10 in a similar fashion, but this question is about the WinSock control, not MSFlexGrid).
EDIT: additional info: I have installed "VB6 Service Pack 6", VB version is "Version 9782 VBA retail 6.0.9782", and the version on the mswinsck.ocx file itself is 6.1.97.82 (and thanks to the comments, I know a newer one exists: 6.1.98.16)
I have run into this problem often on Windows 10 machines and resolved it by unregistering and re-registering each OCX using an elevated Command Prompt:
Open a Command Prompt window from the Start Menu by right-clicking it and choosing "Run as administrator". It is important that your Command Prompt window is titled "Administrator: Command Prompt".
Go to SysWOW64 folder by typing cd \Windows\SysWOW64
Unregister OCX by typing regsvr32 -u mswinsck.ocx
Re-register OCX by typing regsvr32 mswinsck.ocx
That usually fixes the problem.
If you use Visual Studio Installer 1.1 to deploy applications, you will probably have the same issue on Windows 10 systems you deploy to. The installer doesn't seem to properly register files. If you use Visual Studio 2019 and the Setup extension, that will build an installer that properly registers the OCX, in my experience.

How to build a solution from the command line with VS2012 Express?

How to build a VC++ solution from the command line with Visual C++ 2012 Express ?
Open a "Developer Command Prompt for VS2012", located in the "Microsoft Visual Studio 2012 --> Visual Studio Tools" in "All Programs".
Type msbuild /help to have documentation.
Example:
cd to your solution folder.
type MSBuild MyApp.sln /t:Rebuild /p:Configuration=Release /p:Platform=Win32

Creating a dynamic link library with Visual C++ in Visual Studio

I have a link script that links a bunch of obj and lib files into a dll. I'm trying to do the same thing in Visual Studio, but without any luck. Problem is that the project doesn't have any source files. The project needs to take all the lib and obj files and link them to a dll.
I'm not sure you can do it from Visual Studio, but you can do it from the Visual Studio Command Prompt with a command like this:
link /OUT:"Dll.dll" /DLL obj1.obj obj2.obj lib1.lib lib2.lib
Create Makefile project. In VC++ 2010: Visual C++ - General - Makefile Project. In the Project properties open Build command line: Configuration properties - NMake - Build command line. Enter the script name here. When you execute Build command, this script is executed.

Resources