Visual Studio 2010, C# and directx managed code - c#

I am trying to use DirectX managed code for Visual Studio 2010 with C#.
I added the references from DirectX from the following path C:\WINDOWS\Microsoft.NET\DirectX for Managed Code\1.0.2902.0
Now every time I try to run a program I will get a Delay Notification saying that "Microsoft Visual C# 2010 is waiting for an operation to complete...", and the program is frozen forever.
I need to close it from task manager.
I need help to solve this problem.

The legacy DirectX Managed Assemblies 1.1 are only compatible with .NET 1.1. and the .NET 2.0 runtime (i.e. 2.0, 3.0, and 3.5). They do not work with the .NET 4.x Framework which is what VS 2010 uses by default.
If you are looking to port existing Managed DirectX 1.1 assembly code, see SlimDX.
For a new app SharpDX is an excellent choice and is supported on a newer 'modern' Microsoft platforms.
See this blog post.

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.

Microsoft DirectX Sound on Visual Studio 2017

I have an old program made with Visual C# 2010. Now I would to use it again so I tried to compile on Visual 2017 Community but it launch an Exception on MicrosoftDirectSound. I understood that it's because is on 32bit so I would ask you if there is any workaround to implement that directx or alternatively what I have to use in the new scenario. I tried with "corflags" too, but it returns a warning about strong named signed.
System.BadImageFormatException: ... is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)
Microsoft.DirectX.DirectSound is part of the legacy Managed DirectX 1.1 assemblies. They only supported for the .NET 1.1 and .NET 2.0 Runtimes and not the modern .NET 4.x Runtime. You also as you note have to force the use of /platform:x86.
Your best option is to use SlimDX which is intended as a drop-in replacement for the Managed DirectX 1.1 assemblies including x64 support. A more modern solution is SharpDX, but of course you probably shouldn't be using DirectSound in a new app anyhow.
See DirectX and .NET
The other thing to keep in mind is that the legacy DirectX Managed DirectX 1.1 assemblies are only installed by the legacy DirectX SDK or the deprecated DirectX End-User Runtime Redistribution Package on systems with the .NET 2.0/3.x Runtime enabled. See Not So DirectSetup and DXSETUP Update.

Running C# v.<latest> on a Win 7 w/ .NET 4.0

We are writing an application that has to run on Windows 7... and we can't install a new version of the .NET framework on those client machines. As the developer, I want to use all the fancy new C# 6.0 language features, and if I understand correctly, the language and the framework have been decoupled.
I just need clarification: If I target C# 6.0 in my application, will the code still run correctly on a Win7 client with .NET 4.0 as the highest framework version?
Yes, you can use a C# 6 compiler while targeting an older version of .NET. The way this usually works is that you have a newer version of Visual Studio and target it at a specific .NET version. For C# 6, this means VS2015. You will be able to use any new C# features, as long as they don't rely on .NET libraries. In particular cases, such as if you want to use async stuff, there are backward compatibility libraries available.
You could also use csc.exe (C# compiler) directly, and bypass Visual Studio.

C# windows application using Ubuntu

I am interested in C# windows application development. But now that I have shifted to Ubuntu I am no longer able to do it. Is there a way other than virtual box to develop a C# windows application in ubuntu??
Well there's the Mono Project but if you want the Microsoft .NET implementation you need Windows.
You might be interested in Mono Project.
It is an open source, cross-platform, implementation of C# and the CLR that is binary compatible with Microsoft.NET. However Mono is not totally up-to-date with lates releases of .NET Framework. It is a mix of .NET 2.0 - .NET 4.0 features.
The Mono project focuses on compilers and runtime libraries and does not directly provide an IDE like Visual Studio. Check here to check available solutions.

What software do i need to install to use WPF in VS2005

I have VS2005 and .net 3.5 installed on my machine I have heard of WPF and want to practice WPF solutions what other software should I install to write WPF program in VS2005 as it does not show any option for the same by default.
Also any link for some cool stuff for beginners on WPF will be very helpful.
Please help
You can get them from here: http://download.cnet.com/The-Visual-Studio-2005-extensions-for-NET-Framework-3-0-WCF-WPF-November-2006-CTP/3000-10250_4-10727672.html.
This was the last version Microsoft released before telling everyone to go with VS2008. If you can't do VS2008, this is an ok solution. We used it for a year and a half and have production UIs running based on it. The problems are that the designer is basically non-existent (so be ready to code XAML by hand), it can be a bit slow, and there's some bugs.
Re: 3.5, VS 2005 is incapable of handling 3.5 projects, linq, etc. If you really want, you can work outside of VS and just use msbuild 3.5. An interesting fact: .Net 3.5 replaces, among some libraries, the PresentationFramework assembly. The new version of this assembly includes additional methods and method signatures that are not included in .Net 3.0. This means that these new 3.5 methods will be accessible in VS2005.
Vinay,
i don't think 2005 can do WPF and it definitely cannot handle .Net 3.5. VS2005 is 2.0.
Start with downloading VS2008 Express. It's free and will have the tools you need to get started with WPF.
http://www.microsoft.com/express/download/
Microsoft had release a extension called "VS 2005 Extensions for .NET Framework 3.0 (WPF & WCF)" but it is not longer available and supported and Microsoft recommends that you upgrade to Visual Studio 2008.
I believe you'll need Visual Studio 2008 in order to do WPF (Windows Presentation Foundation) development, however, there is a way to do some Silverlight (which is a subset of the "full" WPF technology) using Visual Studio 2005. See here:
Silverlight with Visual Studio .NET 2005
You'll need the .NET Framework 3.0 at least, as well as the Silverlight Developer Runtime
Don't forget, though, that you can effectively get a "free" version of Visual Studio (via the Visual Web Developer Express 2008 version) which, I think, will allow "full" WPF development.
Building the Perfect Developer Workstation for WPF by Tim Sneath should answer your question

Categories