# Vista WinSXS issue



## FordGT90Concept (Dec 27, 2009)

I am trying to use C#.NET to get the most recent WinSAT version from %SYSTEMROOT%\system32\WinSAT.exe but when I do this, it actually finds the oldest version (dated in 2006) instead of the newest (2009).  Does anyone know what would cause this behavior and/or how to override it (force most recent)?


----------



## Kreij (Dec 27, 2009)

On Vista I only see one version of the file (2009) and when I check for previous versions it shows nothing. How is your program checking for the version? Is it possible that it is retrieving the correct file but reporting the versioning info wrong?

Just tossing out ideas as I don't know how to test for this on my system with only one version available.


----------



## FordGT90Concept (Dec 27, 2009)

```
FileVersionInfo.GetVersionInfo(WinSAT.FullName).FileVersion.ToString()
```

There is one version at the path I said in the OP.  There is also three or four of them in the winsxs folder (older and current version).  When I do properties on the path in the OP, the version is correct (the most recent); however, when I run my application which grabs the FileVersionInfo, it gets the oldest of all those versions.

Do a search (make sure to include hidden files and folders).  You most likely have more than one instance of WinSAT.exe in the Windows directory.  This issue applies to Vista, not XP.


----------



## Kreij (Dec 27, 2009)

My system shows 3 copies of WinSat. Two are from 2009 (same version), one from 2008.
A test program returns version info that is not either.


----------



## Kreij (Dec 27, 2009)

If I concatonate ProjectMajorPart, MinorPart, BuildPart and PrivatePart it returns the correct numbers for the 2009 file.


----------



## FordGT90Concept (Dec 27, 2009)

So the ToString method may be the problem?  I did notice there was a lot more version numbers there than should be but at the same time, how to know which executable is actually being launched?  I am already not of a fan of WinSXS (especially how much space it is wasting on my laptop).

Hmm, maybe we could find that enumeration number, change it, and see if the change applies to the file.   That would confirm if it is the most recent version running or not.


----------



## Kreij (Dec 27, 2009)

I'm not sure that the ToString method is the problem. It looks like doing a FileVersion.ToString() gives you the RTM version number. The other individual properties seem to be the current builds when they release an update.

It is kind of inconsistent, however, when you view the properties in the file itself it says the File Version is the latest build. More MS shennanigans.


----------



## FordGT90Concept (Dec 28, 2009)

I tried ProjectVersion instead and it was the same numbers as the FileVersion.   Any other ideas?


----------



## Kreij (Dec 28, 2009)

What exactly are you doing with the version information?
Can't you just build a string using the seperate version info?


----------



## FordGT90Concept (Dec 28, 2009)

I'm displaying the version information but the version information itself isn't important.  What is important is that the most recent binary be used.  It is for benchmarking purposes and having the oldest version run isn't exactly a good thing.

That is, if it was using the correct binary but returning the incorect version number, I wouldn't have a problem with that.  The problem is, it is very hard to test if the correct binary is in fact running.


----------



## Kreij (Dec 28, 2009)

Take a look at this inparticularly the updates from the technet blogs at the bottom.

It looks like the files are hardlinked and not copies. The two updates seem contradictory, but maybe you can figure it out. I'm still not 100% clear on the sxs stuff but maybe it will help.


----------



## FordGT90Concept (Dec 28, 2009)

That's the question though: Why is SXS compelled to give my app an older version of the file when it makes absolutely no sense to do so?  I haven't found a way to force it to use a specific version either.

Maybe it has something to do with the application manifest?  I had to put a manifest in the app so that it would get administrator access.  I don't know how that would cause the app the pull the oldest version though.


----------



## Kreij (Dec 28, 2009)

That's what is a little confusing to me. I'm not sure it is giving you an old version.
The FileVersion is older, but the product versions show up as the latest.
I can't find any difinitive answers on that by googling.

Maybe you could post the question on the MSDN boards. Microsoft people are perusing it regularly.


----------



## FordGT90Concept (Dec 28, 2009)

When I ran the app on my Vista laptop, FileVersion and ProductVersion returned the same numbers.  Then again, should it not be FileVersion and AssemblyVersion?  Where's this ProductVersion even coming from?


----------

