5

I'm trying to complete the App Hub tutorial on how to create a Shooter 2D game in XNA - Located here: http://xbox.create.msdn.com/en-US/education/tutorial/2dgame/getting_started

The project contains a bunch of graphics and some audio files. But when I build the solution on my computer at hope it writes:

Error 1 Failed to open file gameMusic.mp3. Ensure the file is a valid audio file and is not DRM protected.

Now I know for a fact that the supplied audio file is not DRM protected, but just as a test, I used a program to re-"record" the MP3 and save it (should remove any DRM protection), I tried both saving it as MP3 and WMA, but same result. Lastly I tried recording my own MP3 at random, but same effect.

The error appears when it project is built so its not a "player" issue, but something in XNA I'm led to believe, or something missing from my computer.

Does anybody have any idea why this happens and how to fix it?

I'm using Visual Studio 2010 Ultimate and the Windows Phone Developer tools as explained in the tutorial (linked above)

Lee Taylor
  • 7,761
  • 16
  • 33
  • 49
Daniel Olsen
  • 1,020
  • 2
  • 15
  • 27
  • So you're saying this is happening on an unmodified, fresh build of the downloaded project from that link? – Andrew Russell Aug 31 '12 at 13:43
  • Yes indeed. And I've tried it on another PC, where the error didn't appear, so I must be missing something from my PC. But I have no clue what that thing is. – Daniel Olsen Aug 31 '12 at 19:21
  • A wild stab in the dark might be to reinstall XNA Game Studio. – Andrew Russell Sep 01 '12 at 08:15
  • Well I tried installing an updated version of XNA studios, but that required VS SP1 - But I couldn't install that, so I removed VS2010, and installed it once more with VS2010 SP1. And then reinstalled the newest XNA game studio version I could find. But to know avail, I'm really at a loss. – Daniel Olsen Sep 03 '12 at 07:18
  • If you're building this for WP7, you should clarify that earlier in your question and retag without XNA and with WP7. – DanM7 Sep 29 '12 at 22:31

3 Answers3

0

Check what platform you are building your project for. I had the same issue back in school using VS08. If you don't choose the correct platform, i.e. "x86", "Mixed Platforms", "Xbox 360", or "WP7" then the project will not be rebuilt properly and not reference the correct DLLs and other files.

DanM7
  • 2,203
  • 3
  • 28
  • 46
0

I had this problem (in the same tutorial by the way) and I solved it by installing the "Media Feature Pack" (link below), which includes the Window Media Player, that does not came in Win 7 N. It seems that XNA uses some DLLs from this package.

http://www.microsoft.com/en-us/download/details.aspx?id=16546

André Schuster
  • 165
  • 6
  • 18
0

I had the same issue with regards to the DRM message you mentioned while updating an old XNA from 2011 to build it with Visual Studio 2019 on Windows 10.

Here are the steps to get it working:

  1. Install Visual Studio Community 2019

    • Choose only .NET Framework 4.8 SDK in the Individual Components selection tab of the installer
  2. Follow the steps provided here to Setup XNA on Windows 10

At this point the project opens correctly but would get an error due to a missing Reference Assembly while building:

  1. Cache the missing Reference Assembly
    • Open the Developer Command Prompt for VS 2019 as an Administrator and run:
cd "\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin"

gacutil /i Microsoft.Build.Framework.dll

At this point the project build and runs, but would get the DRM error message due to a dependency on the Windows Media Player shared libraries.

  1. Enable Windows Media Player
    • At Control Panel > Programs and Features > Turn Windows features on or off > Media > Windows Media Player

After these steps the XNA project builds and runs properly on Windows 10 with Visual Studio 2019.

rbento
  • 9,919
  • 3
  • 61
  • 61