Thoughts about setup and deployment issues, WiX, XNA, the .NET Framework and Visual Studio
All postings are provided AS IS with no warranties, and confer no rights. Additionally, views expressed herein are my own and not those of my employer, Microsoft.
I have heard from a few customers since the release of the .NET Framework 4 who have installed the .NET Framework 4 on Windows Vista or higher and setup reported success, but they see an error when running the .NET Framework setup verification tool. I wanted to describe this scenario in a bit more detail, including how to diagnose whether or not your computer is running into this issue based on the setup log files.
How to quickly tell if this blog post might apply to you
Before reading this whole post, here is a quick way you can check whether or not you are likely to be encountering the issue described below:
Symptoms of the problem
In the cases I’ve seen so far, the .NET Framework setup verification tool reported an error like the following when it tried to run a .NET Framework test application that is bundled with it:
****ERROR**** Process 'Netfx40TestApplication.exe' exited with return code -2146232576
This return code translates to 0x800131700, which is a .NET Framework common language runtime (CLR) error code that means “Failed to load the runtime.” In other words, this return code means that this version of the .NET Framework runtime failed to load at all on this computer.
Further investigation on the computers that exhibited this behavior showed that the file mscoree.dll (which is located in %windir%\system32 and/or %windir%\syswow64) had a version number of 2.0.*. This file is shared by all versions of the .NET Framework, and it should always have a version of at least 4.0.* after installing the .NET Framework 4. If this file is not updated to version 4.0.*, the CLR loader will be unable to load the .NET Framework 4, and it will cause the type of failure in the .NET Framework verification tool that I described above.
Gathering more detailed information from .NET Framework setup log files
I wasn’t sure how a computer could be in a state where .NET Framework 4 setup reported a successful installation but yet mscoree.dll was still versioned 2.0.*. I had the customers use the instructions in this blog post to gather their .NET Framework setup log files, and I started looking at the logs to narrow this issue down further.
In the cases I’ve seen so far, I found an error like the following in the log file named Microsoft .NET Framework 4 Setup_*.html:
Exe (C:\Users\myusername\AppData\Local\Temp\Microsoft .NET Framework 4 Setup_4.0.30319\Windows6.1-KB958488-v6001-x64.msu) failed with 0x80240017 - (null).
The .msu file listed in the above error message is one of the ones that are responsible for updating mscoree.dll to version 4.0.* on Windows Vista and later versions of Windows. Return code 0x80240017 means that the .msu file is not applicable on the computer it is being installed on. This type of return code can occur for several different reasons:
.NET Framework 4 setup prevents cases #1 and #2 from happening behind the scenes, but it cannot prevent cases #3, #4 or #5. To complicate things further, it is not possible to reliably distinguish from this return code which of the cases is the actual cause of the return code. Even worse, case #3 is a case that should be treated the same as a successful installation of this .msu as opposed to a failure.
As a result, the .NET Framework 4 setup ignores this error and treats it as a successful installation of this .msu (case #3). This is why you will see information like the following later in the log file:
Error 0x80240017 is mapped to Custom Error: Success
Narrowing down the root cause based on the log files
Because mscoree.dll was not updated like it should have been on the affected computers, I made an educated guess that the customers who contacted me were running into case #4 on their computers. I was able to confirm this in the following ways:
Possible solutions for this type of error
<update date="12/30/2010"> Added a note about pre-release versions of Windows causing this error as well. </update>
<update date="7/27/2011"> Added a note about using SFC to repair Windows files, as suggested in Peter Marcu's blog. </update>
<update date="11/8/2011"> Added a direct link to Peter Marcu's blog post about this issue. </update>
Question:
I used the instructions and the cleanup tool in this blog post to remove all versions of the .NET Framework from my computer, and now I want to re-install them. Do I need to re-install them in any specific order?
Answer:
In general, the versions of the .NET Framework allow you to install in any order you choose. However, I recommend installing in reverse order from newest to oldest, like this:
Most programs do not specifically require the .NET Framework 1.0 so I didn't list it above. If you do need the .NET Framework 1.0, you will have to install it before installing the .NET Framework 4 because .NET Framework 4 setup blocks future installation attempts for the .NET Framework 4. If you need the .NET Framework 1.0, I recommend installing in this order:
Even though it is a little counter-intuitive, there are a couple of reasons that I recommend installing in reverse order:
<update date="1/31/2011"> Added a separate set of installation instructions for cases where the .NET Framework 1.0 is required because .NET Framework 4 setup prevents the .NET Framework 1.0 from being installed after it. </update>
My colleague Shawn Hargreaves wrote a helpful blog post last week that gives more detailed information about how to use isolated storage APIs in an XNA Game Studio Windows game. It includes some settings that you can change in the Visual Studio IDE so that you can use the GetUserStoreForApplication API during debugging without needing to deploy your game using ClickOnce.
If you are using isolated storage APIs in a Windows game, I strongly encourage you to check out Shawn’s post at http://blogs.msdn.com/b/shawnhar/archive/2010/12/16/isolated-storage-windows-and-clickonce.aspx for more information to help you during development and debugging of your game.
A little while ago, I wrote a blog post with a list of steps that you can use to create native resource DLLs so that you can localize the title of your Windows Phone game created with XNA Game Studio 4.0. Today, I found a blog post about a tool that automates the process of creating these native resource DLLs. This tool provides 2 really nice benefits:
You can find the tool in this blog post. Here is a set of steps that use this tool that you can use in place of the ones I posted in my earlier blog post to enable title localization for your Windows Phone game created with XNA Game Studio 4.0:
Step 0 – Create a Windows Phone game project
Step 1 – Create native resource DLLs using the Windows Phone 7 Title Localizer tool
Step 2 – Add native resource DLLs to your Windows Phone game project
Note - the name of the native resource DLL is important in this scenario. It must be named AppResLib.dll, and the localized versions must be named AppResLib.dll.*.mui. If they are named differently, your game will be rejected by the Windows Phone Marketplace certification process.
Step 3 – Update your Windows Phone game to load title strings from the resource DLLs
Update the application title by doing the following:
Update the tile title by doing the following:
The tile title is the name that is displayed if you click and hold on your application/game in the Windows Phone OS and choose to pin it to the start menu. There is some additional information about these properties and how to configure them in XNA Game Studio games in this documentation topic. Depending on the scenarios you want to support for your game, it may not be necessary to create separate strings for your application title and tile title. If you plan to use the same string for both, you do not need to create separate entries in the string table in each of your native resource DLLs in the instructions above.
Step 4 – Rebuild your Windows Phone game solution
Rebuild the solution that contains your Windows Phone Game project.
<update date="1/18/2011"> Added a warning about the naming of the DLL needing to exactly match what is listed in the documentation. </update>
Rob Mensching announced on his blog last week that WiX v3.5 is now in escrow mode, which means that there were zero active bugs when the v3.5.2325 build was produced, and the final release of WiX v3.5 will be happening very soon. If no showstopper bugs are found and fixed, this build will be the final build of WiX v3.5.
If you are using WiX to create Windows Installer packages for your products, I strongly encourage you to upgrade to this build of WiX v3.5 and help the WiX virtual team validate that this build is ready to be declared the final WiX v3.5 build. Here are a couple of links to help get you started: