Does DirectX 11 support .NET? - c#

Can I use DirectX 11 from C# app?
Need to use DirectSound from WPF application. .NET 4 W7 x64

You may also want to consider the newer SharpDX. The biggest differences from SlimDX are that it doesn't support DX9 (though that's irrelevant here), and the API is directly generated from the DX SDK headers. You could even begin making Metro style apps in Windows 8 because it's ready to support Direct3D 11.1.

From Chuck Walbourn's Blog Titled: Games for Windows and the DirectX SDK.
He seems to be recommending the SlimDx Library, according to their documentation it does support DirectSound
From the above blog:
The modern version of the DirectX SDK is designed for C/C++ native
developers. If you are looking for .NET solutions for using DirectX
technology, there are many options available although the choice of
solution depends on your specific needs:
....
•For a developer using the Windows Presentation Foundation but wants
to use the new DirectX 11 APIs, the Windows API Code Pack provides
managed assemblies for Direct3D 10.1, Direct3D 11, Direct2D,
DirectWrite, DXGI, and the Windows Imaging Library (WIC) along with
many other Windows 7 features. The latest version supports .NET 4.0,
and x64 native “anycpu” applications. Note you still need to install
the DirectX SDK to get the HLSL compiler (FXC.EXE) tool.
•For
developers who are invested in Managed DirectX 1.1 but are looking for
updates to address the limitations I note above, the open source
SlimDX library is designed to mimic Managed DirectX 1.1 for just this
purpose. It includes support for x64 native “anycpu” applications,
includes modern DirectX support, and is compatible with the .NET 4.0
runtime.
....

If you want to use DirectX 11 with C# you need a wrapper
Look at the following link
http://slimdx.org/

Unfortunately, both SlimDX as well as SharpDX are no longer being developed. They both still work, even with .NET6.0 (as far as I can tell), but no new features or bug fixes will make it into these.
The .NET Foundation has a new project Silk.NET that apparently targets to become a replacement for the former two and is still being developed. When I have to update my projects that currently use SlimDX I'll take a look at it.

Bop, if you are just plan on just playing sounds then FMOD is another alternative, there is a C# wrapper available for this. If you plan on more than this, then I would like above recommend Sharpdx as it is still being supported.

Here is one way I have found. First you need to install DXSDK (I have June 2010 and SDK for Windows 7). Go to "Add reference" dialog press "Browse" , go to "C:\Windows\Microsoft.NET\DirectX for Managed Code\1.0.2902.0" or "C:\Windows\Microsoft.NET\Managed DirectX\v9.02.2904" then choose proper dll. For example - Microsoft.DirectX.dll. Then add "using Microsoft.DirectX" directive to your project.

Related

DirectX assembly reference on Windows 10 and Visual Studio 2013

Running my legacy C# application in Windows 10 on Visual Studio 2013 is proving to be a nightmare. The application has an assembly reference to DirectX. Previously, you could just download DirectX SDK and that was 500 MB. Now, you need to download the entire Windows SDK, which is a whopping 4 GB - as they have bundled DirectX together with the Windows SDK. I am lost - the wifi is poor and its taking ages. Any other ideas what i could do? Is DirectX SDK for Windows 10 available separately?
You are referring to the legacy Managed DirectX 1.1 assemblies. They are not in the Windows 10 SDK. They are only deployed by the legacy DirectX SDK and the legacy DirectX Setup package.
See Where is the DirectX SDK? and this blog post.
The legacy DirectX Setup and DirectX SDK will not install the Managed DX 1.1 assemblies unless the system has a .NET 2.0 compatible Runtime (3.5 or 3.0 works as well) installed. It is not supported by .NET 4.0 or later which is what is included with Windows 10 OS.
See DXSETUP and Not So Direct Setup.
Once they are installed, you'll also run into the problem that they don't work with .NET 4.0 which is what VS 2013 is expecting you to use. There are apparently some hacks out there you can try, but MDX was designed for .NET 1.1 originally.
You should move to something more modern like SharpDX or SlimDX. SlimDX was intended as a replacement for the Managed DX 1.1 assemblies so it's probably the easiest to move to, but the project itself is no longer active.

How to "install" Directx (or other graphic SDK) in C#?

Is there any possibility to write Directx applications using C# ? How to install directx sdk for C# ? And what is the best (or most used) graphic library (framework) for C# ?
You will find an installer included with the DirectX SDK, stored in the redist folder after you install the SDK on your machine. The SDK download is here. You only need it when you write native code or target .NET version 2 or earlier. .NET 3 and up already has a dependency on DirectX so its installer already covers your needs.
By far the most popular graphics libraries in .NET programming are System.Drawing and System.Windows.Media. They are wrappers for, respectively, GDI+ and a DirectX wrapper named Milcore. GDI+ uses software rendering and is thus highly compatible but not particularly fast. Milcore is used by WPF, it doesn't expose all of the DirectX capabilities, just the ones that a WPF program needs.
For game programming, the XNA framework is a common choice. Biggest reason to use it is its capability of running on multiple platforms, Windows, XBox and Phone, wrapping their respective low-level graphics libraries. DirectX on Windows has plenty of 3rd party wrappers for it, SlimDX is popular. There used to be one from Microsoft named "DirectX For Managed Code" that had wrappers in the Microsoft.DirectX namespace but they deprecated it. The last SDK that included it was February 2010. Not recommended, XNA replaced it.
You should use SharpDx...
http://code.google.com/p/sharpdx/
I recently asked a question about SlimDX, which is a .NET Wrapper around DirectX. It's pretty up to date and more flexible than XNA (for instance, for scientific visualization apps). There are some tutorials although i'm told as its so similar to DirectX all you need to know is how to setup a device and then just use the DirectX equivalents from there.

Is it possible to use WPF on unix?

I heard about Mono project but only in regards to winforms. Will it work with WPF?
WPF under Mono does not exist.
At this point, no group in the Mono project has plans to implement Windows Presentation Foundation APIs as part of the project.
The mono team propose using Silverlight/Moonlight instead:
Silverlight implement a subset of the WPF APIs and is available on Windows, MacOS X and through our own open source effort Moonlight it is available on Linux and other Unix systems.
There is a library called Silverform SDK that aims to provide cross-platform WPF and Silverlight implementation.
The library is implemented in managed code and currently works with OpenTK and Unity3D as render backends. Major functionality, such as binding, layout, main controls and primitives, has already been implemented (check Unity web player demos here). Initially it has been focused on Unity3d render, while support for standalone Mono applications will be added as a separate build in the future.
Disclaimer: I am one of the developers of the library.

Is it possible to create a Mono bundle that includes WPF libraries?

I know WPF libraries aren´t implemented by mono class library, however(as far as I know) the mono 2.6 runtime is fully compatible with the .NET 2.0/3.5 runtime, so if the WPF libraries only make PInvoke calls to windows api it is theoretically possible to run a wpf application on windows using the mono runtime.
The reason for wanting that is deploying a wpf application as a standalone executable for windows. Has anyone tried something like that before? If so, what were the results?
In short... No
At this point, the Mono project does not have plans to implement Windows Presentation Foundation APIs as part of the project
Mono will provide Moonlight support which, from what I understand, would also use a subset of XAML to create its UI (the same as Silverlight does) but there are legal complications involved. Such as, it's limited to non-microsoft and non-mac platforms.
If you want to find a list of open-source cross-platform alternatives to WPF/XAML I'm working to compile a list of viable alternatives.
Well I did give it a try with little success. I first checked with corflags if required dll-s are implemented in mixed mode (PresentationFramework, PresenationCore, WindowsBase, System.Xaml). They are all pure CIL implementations so that should work fine with mono. Next I installed mentioned DLLs into mono's GAC and tried running a very simple WPF application. This is what I got:
Assertion at mini-codegen.c:1186, condition `reginfo [sreg].born_in
0' not met
This application has requested the Runtime to terminate it in an
unusual way. Please contact the application's support team for more
information.
So although in theory this should all work, WPF is probably way to complex to run out of the box on mono, it would be cool if there was a pure CIL implementation of WPF that was compatabile with both mono and .NET Framework.
As much as I know, Mono does not support WPF.
Also, WPF uses graphics modules and interacts directly with the GPU. So I can't see how u can use WPF with no hidden pinvokes.
Sounds like you need to read about WPF architecture to better understand it.
http://msdn.microsoft.com/en-us/library/ms750441.aspx
Many pieces are missing in Mono and solely available in .NET. Therefore, your "theory" is not correct, and you cannot run WPF applications on Mono, even on Windows.
At MIX 2010 Miguel de Icaza said in his session that Mono isn't going to support WPF. Anything tangentially related to WPF-like support is only to provide what is needed for Moonlight.
Not fully, but..
You can use Moonlight 4 ( silverlight 4 ) in a desktop mode:-
https://github.com/inorton/MoonBase - MVVM helpers
https://github.com/inorton/XamlPreviewer - XamlPad clone

Is there a Subversion API that can be used to program against in .NET

Is there an API to access Subversion from C#?
SharpSvn is a new Subversion wrapper library for .Net/C# that hides all interopand memory management for you and includes a staticly compiled Subversion library for easy integration. It is probably the only Subversion binding designed to perform well in a multithreaded environment.
SharpSvn is not platform independent, but it makes it really easy to use Subversion from your .Net applications. Several projects switched from other libraries to using SharpSvn in the last year. (AnkhSVN, Collabnet desktop for Visual Studio, SharpForge, to name a few)
Svn.NET is a continuation (fork) of SubversionSharp mentioned in CMS's answer. SubversionSharp is limited to the .NET 1.1 platform.
Svn.NET supports the following platforms:
.NET 2.0 on Windows Platforms
Mono on Win32 (2.0 framework)
Mono on Linux (2.0 framework)
Check SubversionSharp, its basically a C# wrapper library that fully covers the client API of Subversion.
I tried Svn.NET at one point and remember that it didn't do everything that I was looking for. If Svn.NET works for you I'd definitely recommend that route, but if you have problems like I did you can get wild and try using http://www.ikvm.net/ to convert http://svnkit.com/ to a .NET assembly. I definitely got this to work and was experimenting with it in my project when we decided to move away from SVN after all and I shelved the whole thing.

Categories