3 Replies - 607 Views - Last Post: 28 February 2018 - 09:29 AM

#1 Boompiee   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 28-February 18

file not found exception

Posted 28 February 2018 - 08:50 AM

Hi, I'm a first time poster on this forum. I'm running into a problem that has me stumped and could really use a bit of assistance on. Here's the thing:

I've created a MonoGame UWP project, but I didn't use the visual studio plugin to generate the project (as that gave some errors where it wouldn't register the UniversalWindowsPlatform correctly). So to work around this, I created a regular UWP project, added the MonoGame UWP project manually, and copied over a content file with assets from another previous monogame project (directx one instead of UWP).

MonoGame is running correctly with the normal light blue screen, but when I try to load and use assets through the asset manager, it refuses to load them. I've copied the asset files and the generated .xnb files everywhere I can think of, but it keeps throwing a filenotfoundexception.

I tried finding the correct location by using Directory.GetCurrentDirectory() and placing the files there, but that didn't work either. So again: I'm pretty stumped.

Could it be that MonoGame actually is finding the files but they're the wrong format? Is there a way for me to find out where exactly MonoGame is searching for them?

Any help would be greatly appreciated!

Is This A Good Question/Topic? 0
  • +

Replies To: file not found exception

#2 Boompiee   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 28-February 18

Re: file not found exception

Posted 28 February 2018 - 09:03 AM

For completeness' sake, here's the code that I think is always supposed to work (but doesn't in my case).

<code>
var currentDir = Directory.GetCurrentDirectory();
contentMngr.RootDirectory = "";
var result = File.Exists(currentDir + "\\gclef.xnb");
if (result)           
    GClef = contentMngr.Load<Texture2D>("gclef");
</code>
:code:

This post has been edited by modi123_1: 28 February 2018 - 09:06 AM
Reason for edit:: In the future please use the [code] tag button in the editor.

Was This Post Helpful? 0
  • +
  • -

#3 Boompiee   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 28-February 18

Re: file not found exception

Posted 28 February 2018 - 09:28 AM

Starting to think it might be because UWP doesn't allow me to access the file: when I try to load the file manually I get an unauthorizedaccessexception instead of a filenotfoundexception. By the way, if I've missed something and it *is* possible for me to edit my posts, please let me know :)
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15064
  • View blog
  • Posts: 60,152
  • Joined: 12-June 08

Re: file not found exception

Posted 28 February 2018 - 09:29 AM

Quote

By the way, if I've missed something and it *is* possible for me to edit my posts,

That is happens after participating with the community for a bit of time.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1