How do I programmatically get the version of a DLL or EXE file?

You would use the GetFileVersionInfo API. See Using Version Information on the MSDN site. Sample: DWORD verHandle = 0; UINT size = 0; LPBYTE lpBuffer = NULL; DWORD verSize = GetFileVersionInfoSize( szVersionFile, &verHandle); if (verSize != NULL) { LPSTR verData = new char[verSize]; if (GetFileVersionInfo( szVersionFile, verHandle, verSize, verData)) { if (VerQueryValue(verData,”\\”,(VOID FAR* FAR*)&lpBuffer,&size)) { … Read more

How can I make my managed NuGet package support C++/CLI projects?

As Patrick O’Hara wrote, NuGet will not make changes to a C++/CLI project for you. See GitHub Issue NuGet/Home#1121 – Cannot install managed packages into a CLI project. However, using the NuGet command line utility, NuGet.exe, you can have NuGet download and unpack the desired package(s). For a complete example, here were steps that I … Read more

Generate manifest files for registration-free COM

It looks like the perfect solution does not yet exist. To summarize some research: Make My Manifest (link) This tool scans a VB6 project to look for COM dependencies, but it also supports manual declaration of late-bound COM dependencies (i.e. those used via CreateObject). Interestingly enough, this tool puts all information about the dependencies inside … Read more

__cdecl or __stdcall on Windows?

I just did some real-world testing (compiling DLLs and applications with MSVC++ and MinGW, then mixing them). As it appears, I had better results with the cdecl calling convention. More specifically: the problem with stdcall is that MSVC++ mangles names in the DLL export table, even when using extern “C”. For example foo becomes _foo@4. … Read more

What is in a DLL and how does it work?

First of all, you need to understand the difference between two very different kinds of DLLs. Microsoft decided to go with the same file extensions (.exe and .dll) with both .NET (managed code) and native code, however managed code DLLs and native DLLs are very different inside. 1) At what point does web.dll dynamically link … Read more

The name ‘ViewBag’ does not exist in the current context

I was having the same problem. Turned out I was missing the ./Views/Web.config file, because I created the project from an empty ASP.NET application instead of using an ASP.NET MVC template. For ASP.NET MVC 5, a vanilla ./Views/Web.config file contains the following: <?xml version=”1.0″?> <!– https://stackoverflow.com/a/19899269/178082 –> <configuration> <configSections> <sectionGroup name=”system.web.webPages.razor” type=”System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, … Read more

Is there any native DLL export functions viewer? [duplicate]

dumpbin from the Visual Studio command prompt: dumpbin /exports csp.dll Example of output: Microsoft (R) COFF/PE Dumper Version 10.00.30319.01 Copyright (C) Microsoft Corporation. All rights reserved. Dump of file csp.dll File Type: DLL Section contains the following exports for CSP.dll 00000000 characteristics 3B1D0B77 time date stamp Tue Jun 05 12:40:23 2001 0.00 version 1 ordinal … Read more

Could not load file or assembly ‘System.ValueTuple’

ok this feels completely wrong but I cut <dependentAssembly> <assemblyIdentity name=”System.ValueTuple” publicKeyToken=”cc7b13ffcd2ddd51″ culture=”neutral” /> <bindingRedirect oldVersion=”0.0.0.0-4.0.3.0″ newVersion=”4.0.3.0″ /> </dependentAssembly> This out of my web.config for the main application. I was really just seeing what happened to see if there was an underlying dependency or something, not expecting it to run. It just carried on working, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)