开发者

how to include XNA libraries in C# project?

I am trying to make a C# game. I want to include XNA libraries there (e.g. Microsoft.XNA.Framework.Graphics). But, if I do so, I get an error :

The type or namespace XNA doesnot exist in the namespace 开发者_StackOverflowMicrosoft.

Can anyone please help ?


First of all, check you are using the correct case, the namespace and assembly names are Xna not XNA. If that doesn't work:

You should follow the instructions here. These describe how to install (as well as some flavour of Visual Studio 2010) XNA Game Studio and to create a project using the template. Using the template project is much easier than adding the references manually.

To add a reference to the XNA assemblies, you need to right click your project in Solution Explorer in Visual Studio and select "Add Reference".

If you do not see the DLLs you are looking for, you may need to right click your project, select properties, and then ensure that the target framework is one of the flavours of the .NET 4.0 framework (for XNA 4.0).


First you should right click on the "References" folder shown (usually) at the top of the project you are working in. From here you can select add references and manually browse to the location of the XNA .DLLs.


First, you need to add a reference to the XNA binary files. Second, I recommend you start off with the Built-In Visual Studio XNA Game Template, and work from there.

To add the references manually, you'll (probably need XNA Game Studio installed) and then add references to Microsoft.Xna.Framework.dll and whatever else you need.

Personally, I still think you should start with the built-in visual studio template for a Game. Once you get a feel for it, move on to advanced concepts like embeding your game into a standard WinForm app or whatever.


In the solution explorer. Go to reference, add reference and then add th Microsoft.Xna.Framework.Xact reference 4.0 It is somewhere near the bottom if you leave it unsorted. Then you can access the Audio Engine class.

I had the same problem and then found it at the 3rd time of trying. Worked fine for me. Hope this helps.


Instead of hassling around in the references list in Visual Studio, just download the DLL from HERE, or the direct link: https://www.dllme.com/dll/files/microsoft_xna_framework_dll.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜