WPF ClickOnce Bootstrap Dection Failure on One Machine
I've decided to use ClickOnce technology to deploy my new WPF application. By and large, ClickOnce works as advertised but I've hit a minor glitch regarding Bootstrapping and framework detection.
Some background: - I'm using the standard Visual Studio-generated publish.htm page as my launch page. - The only prerequisite is the .NET Frame开发者_C百科work 4.0 Client Profile. - All clients using IE 8. - All clients already have the .NET 4.0 Client Profile installed.
ClickOnce works as advertised on the vast majority of machines. The VS-generated JScript correctly detects that the framework is installed and presents the user with a Run button. The app launches just fine.
I'm getting odd results on one of the machines, however. On the offending machine, the VS-generated JScript tells the user that the prereqs may not be installed -- or rather, it FAILS to detect that the framework is already installed. The "launch" link successfully launches the application but the Run link points to the bootstrapper setup.exe. Why is it failing to detect the framework on this one machine?
It occurred to me that framework detection is largely a matter of examining the useragent string that's submitted by the browser. So, what you see below are two UserAgent strings. The first is from a machine where things are working properly. The second is from the offending machine.
THIS ONE WORKS: 2011-01-11 15:14:14 W3SVC1 192.168.0.36 GET /publish.htm - 80 - 72.130.187.100 Mozilla/4.0+(compatible;+MSIE+8.0;+Windows+NT+6.0;+Trident/4.0;+SLCC1;+.NET+CLR+2.0.50727;+Media+Center+PC+5.0;+.NET+CLR+3.5.21022;+.NET+CLR+3.5.30729;+.NET+CLR+3.0.30729;+.NET4.0C) 304 0 0
THIS ONE DOESN'T: 2011-01-11 18:49:12 W3SVC1 192.168.0.36 GET /publish.htm - 80 - 76.212.204.169 Mozilla/4.0+(compatible;+MSIE+8.0;+Windows+NT+6.1;+WOW64;+Trident/4.0;+GTB6.6;+SLCC2;+.NET+CLR+2.0.50727;+.NET+CLR+3.5.30729;+.NET+CLR+3.0.30729;+Media+Center+PC+6.0;+.NET4.0C) 200 0 0
The useragent string of both machines clearly states, "hey the .NET 4.0 client profile is installed here" -- yet the second machine seems unable to detect it. I don't know enough about useragent strings to understand why the former works and the latter fails. The only difference as far as I can tell is that the offending machine is running 64bit. But that shouldn't make a difference. Should it? Any ideas?
Dexter Morgan
PROBLEM SOLVED!
I took a close look at the publish.htm file that VS.NET generates. There's an error in the JScript code. The offending line is:
checkClient=false;
I changed the line to read:
checkClient=true;
Unless this line of code is changed, the browser won't bother to check if the .NET 4.0 Client Profile is installed and as a result, a user who already has installed the 4.0 Client Profile will always be presented with an unnecessary list of prerequisites.
The bad line of code must be the result of some error in the VS.NET publishing logic. Hopefully MSFT will fix. Until then, you'll have to correct it by hand every time you run the publish wizard. Ugh.
精彩评论