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"
- Download a modified version of the XNA vsix: https://mxa.codeplex.com/
- 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" />
</Installation>
-
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.
-
Copy everything from
C:\Program Files (x86)\MSBuild\Microsoft\XNA Game Studio
toC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\XNA Game Studio
-
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 :).
- Roy Triesscheijn @roytries http://roy-t.nl
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):
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.