[SlimDX] How to distribute an UserControl?

Started by
8 comments, last by MrSparkle27 15 years, 6 months ago
Hi! I develop a control that internally uses SlimDX to render some graphics on the hardware. The control is used by other developers in their own projects. When distributing their applications, the DirecX-Distributables will be installed as well as the VC Runtimes, simply by calling the web installers, I guess. My question is how to distribute the control itself. Currently it's just a DLL, so every developper has to download SlimDX and make sure, all the other stuff is updated. This way it's really annoying because everytime there is something missing and I have to fix it. After I used the new SlimDX-Release, the control threw the Exception "DirectX9 not found please download the latest dlls from Microsoft" on some computers. Is there a way to make sure, everything SlimDX needs is installed on the computer before using the control? I think, it's not appropriate to build a installation routine for the usercontrol dll. I thought about something like throwing an Exception such as "Please make sure the following components are installed: ...", so eighter the user or the application can download and install them. Thank you! Christian PS: When explaining what components are needed, I always hear the questions "Why?" and "How come?" and I admit, I can barely answer it. Why it is so complicated to use DirectX in managed Languages? Why can't I just import a DLL like when I need a method of the Win32 API that is not published in the .NET Framework. What's so special about DirectX, and when do I have to upgrade which DLLs?
Advertisement
Maybe it is possible to merge all needed DLLs into one using ILMerge (http://research.microsoft.com/~mbarnett/ILMerge.aspx)?
Assemblies are delay loaded by the first method that uses them. What you can do is, before calling any method that attempts to use SlimDX, just call Assembly.Load and see what happens. If that fails, then you know that SlimDX is missing.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Hi Promit!

It's not the SlimDX.dll I'm worried about. I could simply put it in the control's folder...

The Exception I mentioned was raised when the control tried to create the DirectX Device, which means when the SlimDX.dll is already loaded. After I downloaded and installed the current DirectX Runtime from the Microsoft website it worked fine.

But I needed to download and install them, which (I guess) also applies to the VC Runtime. This is very inconvenient for distributing a simple control.

I figured out three different solutions to make this procedure easier:

1. Write a small installation routine, like the installation of SlimDX itself that automatically downloads and/or installs the other stuff. This installation executable again must be included by the application's setup routine, which is inconvenient and makes ClickAtOnce distribution of the application impossible.

2. Provide some decent Exceptions when either the VC Runtime or the DirectX Runtime is not available, so the developper of the application can make sure they are provided somehow.

3. Provide all needed dlls with the component itself by packing all files into one dll using ILMerge or an Obfuscator, or simply put them into the component's folder. But I guess this will never work for several reasons. You guys would've done that with SlimDX :)


Why is it so painful to develop software with managed DirectX? I'm not developping games, but I need hardware support for technical visualisations. I tried Managed DirectX, I tried SlimDX (Thank you guys for dedicating so much work to this great project!), I even tried to write my own Wrapper, and XNA is a nightmare (not for developing games, I guess).

So please help me to find a solution, people starting to ask me if they have to recompile the Windows Kernel to use my control :)

Christian
There is no difference between using DirectX in C# or C++. You will always need the appropriate dependencies. It's just how it works. You will need the latest DirectX, and you will need the latest VC runtimes, no matter whether you are using managed code or not.

I don't understand why providing an installer with your application is a big deal. In fact, I would think it would be a required feature in order to make your product appear professional. I can't remember the last piece of software I got that didn't have an installer.
Mike Popoloski | Journal | SlimDX
Quote:I don't understand why providing an installer with your application is a big deal.


Not really, I just don't like the fact that an application setup includes another setup of my control which includes another setup of the SlimDX control which includes two more setups.....

The question is if I really need to provide an installation routine to distribute a simple control, which is not an application - it's just one dll.

But maybe I just change my point of view and call the control an Application which would justify the need of an own installation routine :)




For what it's worth, the VC runtime requirement is actually probably going away for the next release. DX is still required of course, but removing the CRT bit should simplify things somewhat at least.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
That sounds like good news! What is the CRT good for anyway? Or, to put it in another way, would it be possible to write a DirectX wrapper in pure C#?
To some extent, yes. SlimDX does a lot of more complex interop stuff that I'm not sure could be translated into pure C# rather than IJW code, and if it could I have a feeling performance would suffer in those corner cases.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Hi Promit!

Thank you for that explanation, thats exactly what I needed to know.

I've found a good DirectX installation guide at MSDN
And I also found a guide how to use DirectSetup here
But as I expected, it was not exposed by SlimDX and I found out why, because it "wasn't doing a goddamn thing" like you said here

Your solution is to call the dxsetup.exe in silent mode during installation. But I could even provide a method that starts the installation process in my control's assembly (say my own DirectSetup class), I just need to put the dxsetup.dll in the control's folder. That way the application setup can use this method instead of installing components for other components.

This method could also be called on runtime, e.g. the application could check the DirectX version on startup, call the installation method if needed and restarts. If it worked, it would make developping applications with this control more convenient.


// Edit: Links added

This topic is closed to new replies.

Advertisement