Get project content in MonoDevelop

1

I'm trying to insert a PNG image in my game, but I'm not getting it, the image is in Content/alien.png , with the code below:

Texture2D alien;
.
.
.
protected override void LoadContent ()
{
    spriteBatch = new SpriteBatch (GraphicsDevice);
    Content.RootDirectory = "Content";
    alien = Content.Load<Texture2D>(@"alien");
}

When I run the game, the error message appears:

  

Microsoft.Xna.Framework.Content.ContentLoadException: Could not load   alien asset as a non-content file! --->   Microsoft.Xna.Framework.Content.ContentLoadException: The directory   was not found. --- > System.IO.DirectoryNotFoundException: Could not   find a part of the path   "/home/leonardo/Documentos/Mono/MaisUM/MaisUM/bin/Debug/Content/alien.xnb".   at System.IO.FileStream..ctor (System.String path, System.IO.FileMode   mode, System.IO.FileAccess access, System.IO.FileShare share,   System.Int32 bufferSize, System.Boolean anonymous,   System.IO.FileOptions options) [0x001cf] in   : 0 at System.IO.FileStream..ctor   (System.String path, System.IO.FileMode mode, System.IO.FileAccess   access, System.IO.FileShare share) [0x00000] in   : 0 at at (wrapper   remoting-invoke-with-check) System.IO.FileStream: .ctor   (String, System.IO.FileMode, System.IO.FileAccess, System.IO.FileShare)
  at System.IO.File.OpenRead (System.String path) [0x00000] in   : 0 at   Microsoft.Xna.Framework.TitleContainer.OpenStream (System.String name)   [0x00029] in: 0 at   Microsoft.Xna.Framework.Content.ContentManager.OpenStream   (System.String assetName) [0x0002e] in   : 0 --- End of inner exception   stack trace --- at   Microsoft.Xna.Framework.Content.ContentManager.OpenStream   (System.String assetName) [0x00053] in   : 0 at   Microsoft.Xna.Framework.Content.ContentManager.ReadAsset [T]   (System.String assetName, System.Action 1[T] recordDisposableObject) [0x00073] in <c33f6c525d914593acc9b590397e7c2b>:0 --- End of inner exception stack trace --- at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset[T] (System.String assetName, System.Action 1 [T] recordDisposableObject)   [0x0012b] in: 0 at   Microsoft.Xna.Framework.Content.ContentManager.Load [T] (System.String   assetName) [0x00068] in: 0 at   MoreUM.Game1.LoadContent () [0x0002e] in   /home/leonardo/Documentos/Mono/MaisUM/MaisUM/Game1.cs:46 at   Microsoft.Xna.Framework.Game.Initialize () [0x0004d] in   : 0 at MaisUM.Game1.Initialize ()   [0x00002] in /home/leonardo/Documentos/Mono/MaisUM/MaisUM/Game1.cs:35   at Microsoft.Xna.Framework.Game.DoInitialize () [0x00011] in   : 0 at   Microsoft.Xna.Framework.Game.Run   (Microsoft.Xna.Framework.GameRunBehavior runBehavior) [0x00033] in   : 0 at   Microsoft.Xna.Framework.Game.Run () [0x0000c] in   : 0 at MaisUM.Program.RunGame ()   [0x00010] in   /home/leonardo/Documentos/Mono/MaisUM/MaisUM/Program.cs:31 at   Most. Program.Main (System.String [] args) [0x00001] in   /home/leonardo/Documentos/Mono/MaisUM/MaisUM/Program.cs:55

Probably and error is because it expects an .xnb file, but I only have one .png, because in Linux I did not find a way to convert. Could someone help me?

Information: Linux Elementary OS Freya MonoDevelop 5.10 MonoGame 3.5

    
asked by anonymous 11.11.2016 / 04:42

2 answers

0

I was able to resolve, I discovered that I had to open the Pipeline Content , simply opening the file Content.mgcb , adding my contents to it and clicking Build , but I had problems with the build, then I installed MonoGame 3.4 over 3.5 , after that I deleted 3.4 , and I installed 3.5 > again, it worked there. It may be some files that have not been extracted during the first installation.

    
12.11.2016 / 17:40
0

This really causes a lot of confusion because in XNA it was only necessary to create a folder and put the files inside (only with the audio files was needed the use of XACT) already in Monogame all files should be added / converted through of the "Monogame Pipeline". IPC: Do not forget to make the proper settings in the properties of the file (building, copy always, etc) as this tb is very difficult to add the files.

    
08.09.2017 / 15:57