Redistribution of renamed MSVC runtime DLLs in commercial Python applications

walker aruyo 0 Reputation points
2026-10-18T15:50:58.23+00:00

Hello,

I am an individual developer using Visual Studio Community 2022. I am developing a commercial Windows desktop application in Python.

My application uses NumPy and Shapely, whose Windows wheel packages include Microsoft Visual C++ runtime DLLs with hash-suffixed filenames:

  • NumPy: msvcp140-a4c2229bdc2a2a630acdc095b4d86008.dll

Shapely: msvcp140-0fa7eb792d3fbcf2233e4ea47e9144b9.dll

Both DLLs have valid Microsoft digital signatures. Their version information identifies the original filename as msvcp140.dll.

I understand that the Visual Studio 2022 redistribution terms permit redistribution of specified Visual C++ runtime files, subject to the applicable license conditions.

I would appreciate clarification on three questions:

Is it permitted to redistribute an otherwise unmodified Microsoft Visual C++ runtime DLL under a filename that includes a hash suffix?

Does the redistribution permission apply to Microsoft runtime DLLs obtained from third-party Python wheels, rather than directly from the Visual Studio VC\Redist directory?

If redistribution in this form is not permitted, what compliant approach would you recommend when the NumPy and Shapely binaries depend on these exact DLL filenames?

I would like to ensure compliance before distributing my application commercially.

Thank you for your assistance.

Developer technologies | Visual Studio | Other
Developer technologies | Visual Studio | Other

A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Grant Totinov 80 Reputation points
    2026-10-19T00:56:24.8333333+00:00

    Hi walker aruyo, :)

    This comes up a lot with Python wheels on Windows. I'm not from Microsoft licensing and this isn't legal advice, but here is what the published terms say and how I would approach it.

    Where the hash suffix comes from

    NumPy and Shapely build their Windows wheels with delvewheel. It copies the DLLs a package depends on into the wheel and renames them with a content hash. Without that, two packages shipping different copies of the same DLL could collide in one Python process. It then rewrites the import table of the package's own .pyd/.dll files to point at the new name. The Microsoft DLL itself is not edited.

    You can check this yourself. An Authenticode signature covers the file contents, not the file name, so a valid Microsoft signature means the bytes are what Microsoft shipped. To compare against your own install:

    
    $dll = ".\msvcp140-a4c2229bdc2a2a630acdc095b4d86008.dll"
    
    $sig = Get-AuthenticodeSignature $dll
    
    $sig.Status; $sig.SignerCertificate.Subject
    
    (Get-Item $dll).VersionInfo.FileVersion
    
    (Get-FileHash $dll).Hash
    
    # From a Developer PowerShell for VS 2022:
    
    $ref = "$($env:VCToolsRedistDir)x64\Microsoft.VC143.CRT\msvcp140.dll"
    
    (Get-Item $ref).VersionInfo.FileVersion
    
    (Get-FileHash $ref).Hash
    
    

    If both files have the same version, the hashes should match.

    1. Redistributing under a hash-suffixed name

    The Visual Studio 2022 Distributable Code list lets you distribute the files under VC\redist with your program, and states "You may not modify these files." It says nothing about the file name. Renaming does not change the binary and the signature stays valid, so my reading is that this is not a modification of the Distributable Code. The terms don't address renaming explicitly, though, so this is an interpretation and not a statement from Microsoft.

    2. Files that came from a third-party wheel

    Your right to redistribute comes from your own Visual Studio 2022 license, not from NumPy or Shapely. The same page ties that right to having a valid Visual Studio license and to distributing the listed files unmodified. It also says that runtime binaries downloaded from Microsoft's VC++ Redistributable pages fall under the same Visual Studio terms, so the right is not limited to copies taken from your own VC\Redist folder. What matters is that the file is identical to the listed one, which is what the check above confirms. The general conditions in the Distributable Code section of the VS 2022 license terms (Help > About Microsoft Visual Studio > License Terms) still apply. Those include shipping it as part of an application that adds significant functionality, and having your end-user terms protect it at least as much as the VS license does.

    3. If you want to avoid the question entirely

    • Keep the wheels as they are. This is the least effort and works today, but it relies on the interpretation in point 1.
    • Central deployment (Microsoft's recommended approach). Run vc_redist.x64.exe /install /quiet /norestart from your installer. Then point the packages back to the standard name with delvewheel replace-needed <file> -change msvcp140-<hash>.dll msvcp140.dll. Do this for every .pyd/.dll in the package and its .libs folder that imports the hashed name (delvewheel needed <file> lists a binary's imports). After that, delete the hashed copies.
      • Benefit: Windows Update services the runtime.
      • Trade-offs: you are patching third-party binaries, you have to repeat it on every upgrade, and you lose the isolation delvewheel added. Test carefully, and make sure the runtime the process loads is at least as new as the one the wheels were built against.
    • Rebuild the wheels yourself with delvewheel repair --exclude msvcp140.dll, and deploy the runtime through vc_redist. This gives you the most control but takes the most effort.

    The same reasoning applies to vcruntime140.dll and vcruntime140_1.dll, which the python.org runtime and freezers like PyInstaller place next to python.exe.

    For a definitive answer before a commercial release, confirm with Microsoft licensing or your own legal counsel.

    If this helped, please consider accepting the answer so others can find it.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.