可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I’m trying to deploy a WPF application using ClickOnce.
The project’s target framework is: “.NET Framework 4.5”.
In the VS project properties -> “Publish” -> “Prerequisites” I have checked two items:
- “Microsoft .NET Framework 4.5 (x86 and x64)”
- “Windows Installer 4.5”
When I try to launch this application on a Windows 7 computer that doesn’t have .NET 4.5 preinstalled I get a popup saying:
The installation does not attempt to download/install the framework for me. It simply gives up displaying this message.
The client user running the ClickOnce installation has administrator privileges on the machine.
Why doesn’t ClickOnce install .NET 4.5 automatically?
回答1:
I left out to mention in my question that I was upgrading from another ClickOnce application with prerequisites on .NET4.
ClickOnce prerequisites are only evaluated on the first installation so to upgrade to .NET4.5 I followed a technique described here. I.e. the old application uninstalls itself and then launches the installation of the new ClickOnce application with the new prerequisites on .NET4.5.
Process.Start("iexplore.exe", newClickOnceApplicationUrl);
Application.Current.Shutdown();
Some machines got the error message (“Please contact your system administrator.”) and some installed ok without any problems. On the machines that got the error it worked ok if the ClickOnce url was launched manually.
All users running the install were part of the Administrators group for their local machine. My theory is that the iexplorer.exe process launched from ClickOnce did not run under administrator privileges on the machines that had the problem.
I did not investigate this any further though.
回答2:
I had the same problem with an application that was set to target .net framework 4.0 in the past. First I just updated the target platform to .net framework 4.5, however the ClickOnce installer did not update its prerequisites.
What I had to do was Project Properties -> Publish -> Prerequisites -> Change from .net framework 4 to .net framework 4.5. Then 4.5 was installed during deployment.
回答3:
The re-installation of your application should solve the problem.
Application's ClickOnce prerequisites are checked, and, if necessary, ran, when you install your application on the machine, and not when you launch an already installed .NET application.
回答4:
Not seen this one before but it sounds like the client already has .NET installed, but the client profile "lite" version?
Two ways around this:
- If you can, change the build target to .NET 4.5 Client and rebuild your product (you will receive errors if you're calling into what Microsoft consider "server" components of the framework)
- If you really can't do without the full version of .NET, remove the client version from the machine and try again?
Does this help at all?
回答5:
Some what this error looks familiar!!!
Did you try to do this ???
In the Prerequisites dialog box, make sure that the Create setup program to install prerequisite components check box is selected.
In the "Specify the install location for prerequisites section", select Download prerequisites from the following location.
Select a location from the drop-down list, or enter a URL, file path, or FTP location, and then click OK.
http://msdn.microsoft.com/en-us/library/8st7th1x(v=vs.100).aspx
回答6:
Do the following
Download .netframework 4.5 fullinstaller here DOTNETFRAMEWORK 4.5
then copy it to this directory
C:\Program Files\Microsoft SDKs\Windows\v8.0A\Bootstrapper\Packages\DotNetFX45
then clean your project and Build again then published.. it will work now.. please let me know if you solve the problem with my answer