spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

Managed DirectX / SharpDX / SlimDX working without installer?


I actually have a solution for this. Or rather, I am closing in on one.

If you use SharpDX.Direct3D9 or SharpDX.Direct3D10 it's likely you need D3DX9_43.dll and D3DX10_43.dll respectively.

You are right that these DLLs are located in the C:WindowsSystem32 and C:WindowsSysWow64 directories after installing the DirectX10 June 2010 Runtime.

However, your users don't want a 100MByte download (too right)...

EDIT: Update. I now have this working

  1. Include the libraries you need as dependencies as embedded resources in your Managed DLL.

    • Make sure you include the x86 and x64 versions of the library in separate folders.
    • e.g. D3DX9_43.dll from C:WindowsSystem32 is the 64bit version on x64 machines, should be included as an embedded resource in ResourcesDependenciesx64
    • D3DX9_43.dll from C:WindowsSysWow64 is the 32bit version (go figure!) on x64 machines and should be included as an embedded resource in ResourcesDependenciesx86
  2. Now create a DLL loader using this technique to selectively write out the correct (x86 or x64) DLLs to file, using the UAC save AppDataLocalYourAppDependenciesx64 or x86 folders as targets

  3. Finally, call the Kernel32 LoadLibrary function via P/Invoke on the dependencies. IMPORTANT! Only ever load x86 unmanaged DLLs when the Environment.Is64BitProcess flag is false. Vice versa for x64 unmanaged DLLs

Finally, sip margarita and watch your SharpDX application in all its glory on a machine with no DirectX Runtime installed!

EDIT 2: The above breaks the licensing agreement for the DirectX Runtime

As Xoof points out in the comments, the above breaks the licensing agreement for the DirectX Runtime. Good he let us know really as I was about to package these DLLs into commercial software.

Instead, we're going to go down the route of pre-packaging a subset of the *cab files found under C:Program Files (x86)Microsoft DirectX SDK (June 2010)Redist with our installer. We will use this to create our own mini DirectX Runtime (about 4.7MBytes) with just the files we need.

enter image description here

Hopefully the above info is useful to anyone who wants to know how to dynamically load platform-specific unmanaged DLLs with a managed application, and how to pre-package a subset of DirectX DLLs with your application!


Categories : C#

Related to : Managed DirectX / SharpDX / SlimDX working without installer?
Izpack installer can't run without java
If you are using maven to build your installer the launch4j-maven-plugin will help you with this. You find the details for using it in another question already answered on stackoverflow here: Trying to integrate Launch4j in a Maven project using Alakai plugin

Categories : Java
How to set a default app installer program?
You can limit the packages your intent resolve to using Intent.setPackage().

Categories : Android
How can create an installer from my Application C#
In order to have a more flexible (custom) installer, I recommend using WiX you can start from here Download WiX from here or The faster (typical) way but not flexible (custom) is: new Project -> Other Project types -> Setup and Deployment

Categories : C#
How can the Wix Installer distinguish target builds?
With the following code you can define producttarget WiX variable based on Configuration MSBuild property: <!-- Somewhere in .wixproj --> <PropertyGroup> <DefineConstants Condition=" '$(Configuration)' == 'Debug' ">$(DefineConstants);producttarget= (Demo)</DefineConstants> <DefineConstants Condition=" '$(Configuration)' == 'Release' ">$(DefineConstants);produ

Categories : C#
How do I deploy a Visual Studio addin with an installer like MSI?
Here is a MSDN link on how to register an addin. http://msdn.microsoft.com/en-us/library/19dax6cz(v=vs.120).aspx It is easy to create an MSI from this. There are also several tools that have support for deploying an addin

Categories : C#
Recently Add
How to find current index of your list / array in a changing list?
Comparing a null terminated string to a non-null terminated string
How to find out if something will collide with something in Unity (2D)
How do I populate a listbox based on a selected item from another listbox?
C# FOREACH on multiple LIST<> types
How can i match inner expression on nested expression with regular expressions?
How to connect from client using CCDT and SSL to Remote Queue Manager (WebSphere MQ Server) using C#
How to write Firefox plugin with C# and mono?
Shake Gestures Windows Phone
Thread.Sleep and Painting UI
What is the purpose of TabPage.Hide()
Using Dictionary to count the number of appearances
asp.net c# create a new page and refresh routing map
Don't know where is database that was created using Entity Framework
Want to understand async
How to open excel file's read only mode on C#?
How to programmatically set App Pool Identity
using .NET TimeZoneInfo Pacific Standard Time (PST) versus Pacific Daylight Time (PDT)
Why can't I assign null to an Object in C#?
GroupLevelIndicatorPane causes ColumnStretchMode=ALL to not fit columns
Cascading Multiple Inheritance and Events
Mutator makes program run indefinitely
How to generate excel like report in WPF?
How to check if user clicked on an image in web browser control
WCF Service with entity framework error with more than table
Why am I not getting the text from my file with this code?
Accessing TFS Work Item Properties "Blocked" & "Root Cause" using TFS API
How to pass values to a user control in winforms c#
How to determine the type of Group from an ldap path
What files am I missing wile running migrations from a console app?
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.