Skip to content

Instantly share code, notes, and snippets.

Last active February 19, 2023 10:43
  • Star 25 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Install XNA 4.0 under Microsoft Visual Studio 2017

This guide will provide you with a workaround for using XNA in Visual Studio 2017. This will solve problems with the target files and Microsoft.Build.Framework.dll such as: Error loading pipeline assembly "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Microsoft.Build.Framework.dll"

  1. Download a modified version of the XNA vsix:
  2. Unzip XNA Game Studio 4.0.vsix and replace the <Installation /> tag in extension.vsixmanifest with this:
 <Installation InstalledByMsi="false">
    <InstallationTarget Version="[12.0,16.0)" Id="Microsoft.VisualStudio.VSWinDesktopExpress" />
    <InstallationTarget Version="[12.0,16.0)" Id="Microsoft.VisualStudio.Pro" />
    <InstallationTarget Version="[12.0,16.0)" Id="Microsoft.VisualStudio.Premium" />
    <InstallationTarget Version="[12.0,16.0)" Id="Microsoft.VisualStudio.Ultimate" />
    <InstallationTarget Version="[14.0,16.0)" Id="Microsoft.VisualStudio.Community" />
    <InstallationTarget Version="[14.0,16.0)" Id="Microsoft.VisualStudio.Enterprise" />
  1. Place everything in a zip file again and change the extension to vsix. Now run the the vsix file. It should give a warning message but other than that install for VS2017 without problems.

  2. Copy everything from C:\Program Files (x86)\MSBuild\Microsoft\XNA Game Studio to C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\XNA Game Studio

  3. Open the Visual Studio 2017 developer command prompt by searching for Developer command prompt for VS 2017 as administrator and execute the following code: (this will add the new version of Microsoft.Build.Framework to the Global Assembly Cache).

cd C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin
gacutil /i Microsoft.Build.Framework.dll

Note that the bug is tracked here: dotnet/msbuild#1831

After this you should be able to work with XNA in Visual Studio 2017 without problems. Remember that you can upgrade the .Net version XNA uses by manually editing the csproj files in notepad :).

Copy link

ctkat commented Aug 13, 2017

Hi, I am missing something here; I downloaded the modified XNA zip, unzipped to new folder. Than I dont understand; do I need to unzip the vsix file?, Guess not, however when I take the vsix file to a normal editor, this is some sort of compiled code, that I can not edit, searching that file for one of the replacements did not result in anything. What am I missing here?
Thanks you.

Copy link

junwatu commented Sep 16, 2017

@golyalpha you need to install XNA Framework and XNA Game Studio separately before run vsix. Those files already on the zip file.

Copy link

rlundy commented Sep 26, 2017

I just tried this, and it worked! A few tips:

  • The .vsix is indeed a .zip file, something I never knew before. You'll need to unzip it, make the changes, and re-zip it.
  • As korenb mentions above (thanks, korenb!), if you're using 7-Zip, make sure you re-zip the .vsix as a .zip file, not a .7z file.
  • Also, make sure you zip the contents of the .vsix, not the folder containing them. If you unzip the .vsix to a "VSIXStuff" folder, you should zip back the stuff inside that folder, not the folder itself.
  • Don't forget to open the Developer Command Prompt as administrator.
  • Check your file paths carefully!

Thanks, roy-t, for posting this guide.

Copy link

PabloHorno commented Sep 29, 2017

I have the instalation of the visual studio in the HDD, and I don´t have the directory in C,
I can´t use gacutil because i can´t accest to the D unit.
D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin
Any ones knows?

Copy link

Followed the steps and still getting the pipeline error. Any ideas how I would debug this? This is trying to run an xna sample.
I followed the guide and installed for vs2017 from (XNA 4.0 Refresh (Visual Studio 2017))
I've also run (and it executed no problem)
gacutil /i Microsoft.Build.Framework.dll
in folder:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin

Getting this error: (nothing to do with monogame, it just happens to be in a subfolder below that)
1>------ Build started: Project: BillboardPipeline, Configuration: Debug x86 ------
1> BillboardPipeline -> D:\monogameProjects\XNAGSSamplesAndArticles\XNAGameStudio-master\ExtractedSamples\Billboard\BillboardPipeline\bin\x86\Debug\BillboardPipeline.dll
2>------ Build started: Project: BillboardWindows, Configuration: Debug x86 ------
2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\XNA Game Studio\v4.0\Microsoft.Xna.GameStudio.ContentPipeline.targets(78,5): error : Error loading pipeline assembly "D:\monogameProjects\XNAGSSamplesAndArticles\XNAGameStudio-master\ExtractedSamples\Billboard\BillboardPipeline\bin\x86\Debug\BillboardPipeline.dll".
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Copy link

This is broken? At step 4:
Copy everything from C:\Program Files (x86)\MSBuild\Microsoft\XNA Game Studio
This folder does not exist at all, where is it coming from?

Copy link

@Jofairden After installing everything it should be there. Make sure you have followed all the above steps correctly.

Copy link

Have you tried changing the binding information

The includes its self.. wouldnt that be better being so that it redirects everything up to 15 to 15.1?

Any way around this without gacing?

Copy link

I've tried to get my WP Game Project opened with VS2017 Community on Win10, but it doesn't work.

Your installation of XNA Game Studio does not support this project (XNA Platform = 'Windows Phone', XNA Framework Version = 'v4.0').

Copy link

thaumatrope commented Dec 3, 2017

Same problem here, step 4+5 were done succesfully.

Warnung Your installation of XNA Game Studio does not support this project (XNA Platform = 'Windows', XNA Framework Version = 'v4.0').

Sorry, works!!!

Copied files from wrong directory.
C:\Program Files (x86)\MSBuild\Microsoft\XNA Game Studio
(I took accidentally C:\Program Files (x86)\Microsoft XNA)
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\XNA Game Studio

That is wonderful! Thank you very much!

Copy link

Unzip XNA Game Studio 4.0.vsix and replace the tag in extension.vsixmanifest with this:

↑ I don't know how to replace the tag in extension.vsixmanifest with that.
Please help me. I'm a beginner about programming.

Copy link

davidhesselbom commented May 11, 2018

I skipped step 5, but everything still appears to work (I can create new XNA projects as well as build and run them). Why is step 5 necessary?

EDIT: Turns out that while I can create new projects and build them, I cannot build existing (old) projects (created with VS 2013):

Error loading pipeline assembly "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\Microsoft.Build.Framework.dll".

The same thing happened to OP here. I guess this is because I skipped step 5.

But, this also leads me to believe that there's something in the .sln or maybe the .csproj files that causes this error, and that these files can be modified somehow to work with VS 2017 without step 5.

Will update this post if I figure out how.

Copy link

C00lzer0 commented May 16, 2018

Nice guide (thx 4 that) but for me it also doesn't work :(

I got the same error after loading my old xna project as SimonDarksideJ:
"Your installation of XNA Game Studio does not support this project (XNA Platform = 'Windows Phone', XNA Framework Version = 'v4.0')"

Also creating a new project does not work (same error here too).

The interesting part is that the content pipeline importers are working:

Is it possible to switch back to the "old" Microsoft.Build.Framework ?

After a lot of reading an testing i finally switched to MonoGame (3.7 development version) to get it work with VS 2017 and it runs now on my WP10 (needs only some adjustments for scaling XD).

Copy link

wldevries commented Dec 12, 2018

To revert to the old dll you need to unregister the assembly from the GAC.

With the following command you can list the dlls that are currently registered:
gacutil /l Microsoft.Build.Framework

The entry that I registered from my Visual Studio 2017 installation is the following entry:
Microsoft.Build.Framework, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL

To uninstall it you need to pass the entry you found above to gacutil /u as a parameter and remove all the spaces:
gacutil /u Microsoft.Build.Framework,Version=,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a,processorArchitecture=MSIL

To fix Visual Studio after an upgrade you need to register the updated dll in the GAC
I've found that Visual Studio 2017 often stops working or weird behavior starts to occur after I upgrade it. The reason is that with each update to Visual Studio the Microsoft.Build.Framework.dll is potentially updated and VS relies on it. To fix it you need to reregister the dll in the GAC. To do this you repeat step 5 in the guide above and if you are using Visual Studio 2017 Pro like me the commands are:

cd C:\Program Files (x86)\Microsoft Visual Studio\2017\professional\MSBuild\15.0\Bin
gacutil /i Microsoft.Build.Framework.dll

The Visual Studio 2019 path has changed slightly:

cd C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin
gacutil /i Microsoft.Build.Framework.dll

Copy link

ghost commented Jun 22, 2019

On the download site, it only gives me the ability to "download archive." Where is the .vsix file I want to unzip and edit in there?

Copy link

roy-t commented Jun 23, 2019

@Nalonnariek unfortunately this file was hosted at CodePlex, which has shut down. I'm not sure if the file is hosted anywhere else. I'm afraid it is really time to move to MonoGame, which is API compatible with XNA.

You can also try sending a message to @SimonDarksideJ ( he has archived a lot of XNA stuff, and I think he said he would also archive this VSIX file somewhere).

Copy link

This is my xna archive site, with the entire xna catalogue and more.
Can't recall if I did put the xna studio stuff on there, but I'll check, and if it's not I will

Copy link

ghost commented Jun 24, 2019

Ok, thanks to both of you for your help.

Copy link

Eversor commented Oct 19, 2020

I don't know why "Error loading pipeline assembly "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\Microsoft.Build.Framework.dll". happens, but i found out you can solve it by creating a new c# project to "warm up" VS. It will then behave and the error should not happen again.

Copy link

Thank you so much for posting. After a re-installation of Visual Studio, this bug left me frozen, since I couldn't compile my solutions anymore.

Copy link

Eversor commented Nov 20, 2020

Funny i had this problem again 5 days ago and was able to solve it by dropping on my own solution :D Happy to know it helps someone else <3

Copy link

I have it running happily in VS2019 following all of these steps, with the addition of needing to install these extra items to the GAC for it to work in step 5:

gacutil /i Microsoft.Build.Framework.dll
gacutil /i Microsoft.Build.dll
gacutil /i System.Collections.Immutable.dll
gacutil /i Microsoft.Build.Utilities.Core.dll

Hope this helps someone.

Copy link

DoubleBullet commented Mar 28, 2022

I have it running happily in VS2019 following all of these steps, with the addition of needing to install these extra items to the GAC for it to work in step 5:

gacutil /i Microsoft.Build.Framework.dll gacutil /i Microsoft.Build.dll gacutil /i System.Collections.Immutable.dll gacutil /i Microsoft.Build.Utilities.Core.dll

Hope this helps someone.

Thanks. This helped for my VS2019.

Copy link

isral commented Sep 6, 2022

In VS2022, on create new project, I get "The system cannot find the file specified. (Exception from HRESULT 0x80070002)".
I already do gacutil like @intelligentvending do.
Help me.

Copy link

Arefu commented Sep 6, 2022

I haven't installed in 2022, I've moved on from XNA.
Although I did try to see what goes on, I am not sure what to blame. XNA technically is dead according to MS, but that's not to stop you chipping away further.

Copy link

roy-t commented Sep 6, 2022

I'm sorry. Microsoft stopped working on XNA in 2013. I wrote this guide back in 2017 and even then it was a super hacky way to get everything working. I haven't tried enabling this in 2022. You can try to use MonoGame or FNA, Both are drop-in replacement that should work without too many problems. Though there are some weird quirks with both of them.

Copy link

Arefu commented Sep 6, 2022

Oh, wow, I commented here, my bad, I didn't mean comment on this one haha, @isral commented on my one here, I had a massive derp when I wrote my reply here here thinking I was sure that I already replied once, I guess that answers that humdinger.

Copy link

The MXA installs for installing XNA Game Studio are still on the XNA Game Studio Archive here
There are still only catalogued up to the 2017 version, but it's not that hard to unpack the MSIX installers and update them to newer versions (seen it working in VS2019) but the Visual Studio Team are deprecating older features that the XNA GS depends on as far as I know, so the better route is to still use the versions compatible with these installers for accessing XNA content.

The archive is still slowly updating XNA content to MonoGame, but it's slow progress with only one hand on the wheel ;D

Copy link

DanielJonesEB commented Sep 25, 2022

Many thanks for this guide.

My project can't resolve a few classes from the Microsoft.Xna.Framework.Audio package, particularly Cue, AudioEngine, WaveBank and similar. I've poked around and it looks like they're not in the DLL? I'm not really very experienced in C# or Visual Studio, so I'm probably missing something obvious. I'm utterly confused as to why half the contents of the package would be missing!



Any help would be most gratefully received. I'm trying to resurrect an old XNA 3.0 project. I figured that I should try getting it to compile under XNA 4.0 first, and then think about porting it to Mono/FNA. It's been a bit of an epic journey, as I'm a Mac user and have already spent the day faffing about with Bootcamp so I can install Windows :)

Copy link

D'oh - I was being a twazzock and not reading things properly. I mistakenly believed that, for example, Microsoft.Xna.Framework.Audio.Cue class would be in the Microsoft.Xna.Framework.Audio assembly, and not Microsoft.Xna.Framework.Xact. Probably a rookie's mistake, but it seems that package names and assembly names do not need to match :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment