How to install XNA game studio on Visual Studio 2012? - xna

Is it possible to create XNA games using Visual Studio 2012?

Yes, it's possible with a bit of tweak. Unfortunately, you still have to have VS 2010 installed.
First, install XNA Game Studio 4.0. The easiest way is to install the Windows Phone SDK 7.1 which contains everything required.
Copy the XNA Game Extension from VS 10 to VS 11 by opening a command prompt 'as administrator' and executing the following (may vary if not x64 computer with defaults paths) :
xcopy /e "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft\XNA Game Studio 4.0" "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\XNA Game Studio 4.0"
Run notepad as administrator then open extension.vsixmanifest in the destination directory just created.
Upgrade the Supported product version to match the new version (or duplicate the whole VisualStudio element and change the Version attribute, as #brainslugs83 said in comments):
<SupportedProducts>
<VisualStudio Version="11.0">
<Edition>VSTS</Edition>
<Edition>VSTD</Edition>
<Edition>Pro</Edition>
<Edition>VCSExpress</Edition>
<Edition>VPDExpress</Edition>
</VisualStudio>
</SupportedProducts>
Don't forget to clear/delete your cache in %localappdata%\Microsoft\VisualStudio\12.0\Extensions.
You may have to run the command to tells Visual Studio that new extensions are available. If you see an 'access denied' message, try launching the console as an administrator.
"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe" /setup
This has been tested for Windows Games, but not WP7 or Xbox games.
[Edit] According Jowsty, this works also for XBox 360 Games.
[Edit for Visual Studio 2013 & Windows 8.1] See here for documentation on installing Windows Phone SDK 7.1 on Windows 8.1. Use VS version number 12.0 in place of 11.0 for all of these steps, and they will still work correctly.

On codeplex was released new XNA Extension for Visual Studio 2012/2013. You can download it from: https://msxna.codeplex.com/releases

I found another issue, for some reason if the extensions are cached in the local AppData folder, the XNA extensions never get loaded.
You need to remove the files extensionSdks.en-US.cache and extensions.en-US.cache from the %LocalAppData%\Microsoft\VisualStudio\11.0\Extensions folder. These files are rebuilt the next time you launch
If you need access to the Visual Studio startup log to debug what's happening, run devenv.exe /log command from the C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE directory (assuming you are on a 64 bit machine). The log file generated is located here:
%AppData%\Microsoft\VisualStudio\11.0\ActivityLog.xml

There seems to be some confusion over how to get this set up for the Express version specifically. Using the Windows Desktop (WD) version of VS Express 2012, I followed the instructions in Steve B's and Rick Martin's answers with the modifications below.
In step 2 rather than copying to "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\XNA Game Studio 4.0", copy to "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\WDExpressExtensions\Microsoft\XNA Game Studio 4.0"
In step 4, after making the changes also add the line <Edition>WDExpress</Edition> (you should be able to see where it makes sense)
In step 5, replace devenv.exe with WDExpress.exe
In Rick Martin's step, replace "%LocalAppData%\Microsoft\VisualStudio\11.0\Extensions" with "%LocalAppData%\Microsoft\WDExpress\11.0\Extensions"
I haven't done a lot of work since then, but I did manage to create a new game project and it seems fine so far.

Related

VCVARSALL.BAT for Visual studio 2019

What is the location of vcvarsall.bat file for Visual Studio 2019 (Preview and future release as well)?
Seems it is different from VS 2017 "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat"
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat"
As it turned out the path is very similar, just without "Community" part:
For VS2019:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Auxiliary\Build\vcvarsall.bat
For VS2022 since the toolchain now is 64-bit:
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat
If after installing the "Build Tools for Visual Studio 2019" and doing all that was recommended in the other answers, you still can't find the the file in the location mentioned (no Build folder inside Auxiliary) make sure you
Install "Desktop Development With C++ Workload"
because vcvarsall.bat is part of C++ workload.
(In VS, go Tools menu -> Get Tools and Features -> Install the Desktop Development With C++ workload)
You need to install the "Build Tools for Visual Studio 2019" which can be found here.
See the explanation:
You can build C and C++ applications on the command line by using tools that are included in Visual Studio. The Microsoft C++ (MSVC) compiler toolset is also downloadable as a standalone package from the Visual Studio downloads page. It's part of the Build Tools for Visual Studio package. You can choose to download only the tools you need for C++ development.
If you are using it in the pre-build event, you can execute the vcvars32.bat to set the environment variable VCINSTALLDIR and get rid of the Visual Studio version:
call "$(DevEnvDir)....\VC\Auxiliary\Build\vcvars32.bat"
Then
"%VCINSTALLDIR%\Auxiliary\Build\vcvarsall.bat"
Note:
-In my tests, the variable VCINSTALLDIR has value only after executing the vcvars32.bat
-As Wei Yang said you need to install "Build Tools for Visual Studio 2019", it can be installed using Visual Studio Installer.
I felt free to add a possible solution.
1.) Open the Developer Command Prompt for your wanted VS if you have more than one installed. BTW this lets you work with TFS tool tf if you need it.
2.) Add in your make script the following code at the concerning location:
for /f "delims=" %%d in ('dir /s /b %VSINSTALLDIR%\vcvarsall.bat"') do #set myVCVARSALL=%%d
if not defined myVCVARSALL exit 1
call %myVCVARSALL%
Hope that helps to find this file for the wanted VS version. It results in different files for different installations.
I needed to install and build some older build tools for windows. So, I had to set the location.
The location is C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build
If you haven't installed the "Build Tools for Visual Studio 2019", you can do so from https://visualstudio.microsoft.com/downloads/.
Once this is done, the correct path for running vcvarsall.bat is;
"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat"
For VS 2019 Professional, it is "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat"
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat this is the location.

Robert Giesecke's Unmanaged Exports and Visual Studio 2015 Build Error

We have been using Robert Giesecke's excellent Unmanaged Exports library for a while with our Delphi application. We just upgraded to Visual Studio 2015 and it doesn't seem to be working anymore--I can compile the exact same project in VS2013 and it works fine, can access the functions in the DLL, etc. I recompile in VS2015 (exact same code and project) and I get a build failure on the Unmanaged Exports library as shown below:
Task Parameter:SdkPath=C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\ (TaskId:44)
Cannot find lib.exe in 'K:\Visual Studio 2015\Common7\IDE\\..\..\VC\bin'. (TaskId:44)
Done executing task "DllExportAppDomainIsolatedTask" -- FAILED. (TaskId:44)
Done building target "RGieseckeDllExport" in project "BWSITwilio.csproj" -- FAILED.: (TargetId:73)
And as such the library will not export the functions in the DLL for me to access in Delphi. I can stay in VS2013 for a while but something seems amiss with the library in VS2015 (maybe looking in the NETFX 4.6 folder??)
I am open to ideas so I can use VS2015--I was about to uninstall 2013 but have to hold off now.
Thanks in advance for any input or advice--it is really this library that has allowed us to continue to use Delphi since we can access anything in .NET with it!
The release notes for version 1.2.7 (dated 16 August 2015) on Nuget include this:
no longer fails the build when it can't find lib.exe
I suspect you are using an older version and can solve your problem by moving to the latest.
You are probably using a version that was built before VS 2015 was released and I'm sure Robert's latest version now supports VS 2015.
For what it's worth, even if lib.exe still cannot be found that's not going to bother you since you don't need a .lib file to import into Delphi.
I was facing the same issue and was able to solve this by manually copying over some Visual Studio 2013 files into the 2015 folder. I searched for lib.exe on my computer and used Beyond Compare with the two application's program file directories.
Open C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\ in
Explorer, select all files, Copy.
Open C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\ in Explorer, Paste. When prompted to replace, choose Skip.
After doing this I was able to compile my projects that were using RGiesecke.DllExport in Visual Studio 2015 again.
I can't tell you what specific version of 2013 I had installed because I've since uninstalled, but apparently these files are leftover. I'm running MS VS Community 2015 Version 14.0.23107.0.
Not sure if its relevant at all, but the lib.exe I copied from the 2013 bin folder's version reads 12.0.21005.1.

Visual studio 2013 Build error on TFS

I use framework 4.5 and vs 2013 and TFS 2013. When I build project get error like that;
"C:\Program Files
(x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets
(3079): Task could not find "AL.exe" using the SdkToolsPath "" or the
registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft
SDKs\Windows\v8.1A\WinSDK-NetFx40Tools-x86". Make sure the
SdkToolsPath is set and the tool exists in the correct processor
specific location under the SdkToolsPath and that the Microsoft
Windows SDK is installed"
I tried everything but I could't fix error. Can you help me about it ?
Download and install the Windows Software Development Kit (SDK) for Windows 8.1. In the setup program, make sure .NET Framework 4.5.1 Software Development Kit is selected.
This will install al.exe to C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools.

Web.config fail to transform on TFS 2012

I currently work on a MVC 4.0 project that was upgraded to MVC 5.0 using the official guide.
I use Visual Studio 2012 locally and a publish profile was created for the project.
Locally I call msbuild via the Visual Studio developer command prompt using: msbuild /m /p:Configuration=Dev;DeployOnBuild=true;PublishProfile=Dev my-solution.sln
All projects in the solutions do have a Dev configuration and there is a web.dev.config.
The command line on the server is the same.
So far the difference is that on the server only the visual studio shell is installed (not the full) and we cannot install the full instance of VS2012 on the server.
Also, seeing on the install of TFS on the server, I discovered that only v9.0 target files were installed (Visual Studio 2008). Copying Visual Studio 2012 target files do not fix this problem.
I see 2 solutions so far but searching for a third.
Install full Visual Studio 2012 instance
Update csproj to include a target transformConfigFiles (basically copy and paste the content of the "Microsoft.Web.Publishing.targets" section) or import the file via a declaration inside of the .csproj
Would there be a third solution available?
It is pretty common to install full Visual Studio on your build server. As of VS 2012 you couldn't even run Unit Tests in your build without VS installed.
I'd suggest installing VS and seeing if that fixes the issue.

Setting up OpenCV 2.4.3 & Microsoft Visual Studio 2012 ( Win8 x64 )

I want to configure opencv with Visual Studio 2012 on Windows 8 x64.
I configured opencv and there is no compilation errors, but when I execute my program I get this error :
The program can’t start because MSVCR100D.dll is missing from your
computer
I tried to install Visual C++ Redistributable for Visual Studio 2012 and Microsoft Visual C++ 2010 Redistributable Package (x64) but always the same error.
If it's still relevant, try this tutorial to create project and configure OpenCV directories:
http://karanjthakkar.wordpress.com/2012/11/21/usin-opencv-2-4-2-with-visual-studio-2012-on-windows-7-64-bit/
It worked for me on Windows 8 (x64) with Visual Studio 2012 and OpenCV 2.4.3.
After configuring the paths and libraries in Visual Studio as mentioned in http://karanjthakkar.wordpress.com/2012/11/21/usin-opencv-2-4-2-with-visual-studio-2012-on-windows-7-64-bit/ you need to install the Visual C++ Redistributable for Visual Studio 2012 from http://www.microsoft.com/en-us/download/details.aspx?id=30679
After restarting your PC, opencv code could be executed in Release mode. If you need to execute the code in Debug mode, then you would have to install the Redistributable version with "D".
This worked with Opencv 2.4.6, Windows 8.1 and VS 2012 Desktop.
Without having any experience with Windows 8 myself, I think this post could solve your problem.
Basically it says that the default system folder for Win 8 is c:\windows\system, unlike c:\windows\system32 on earlier systems. The redistributables probably install to the old system directory, so you have to move the dll to the correct folder manually.
You could also search the file on your PC and put it into the working folder of your program. This is in most cases the output folder, if you run it in Debug mode from VS it can also be the project folder.

Resources