In Visual Studio 2012 where does ClickOnce “Publis

2020-02-14 04:52发布

问题:

The Publish feature stopped working once I installed Visual Studio 2012. Publish cannot find the prerequisite Microsoft .Net Framework 4 Client Profile (x86 and x64). Previously in Visual Studio 2010 this worked fine. I use 64-bit Windows 7.

The exact Visual Studio 2012 error message reads:

Error 104 - To enable 'Download prerequisites from the same location 
as my application' in the Prerequisites dialog box, you must download file
'DotNetFX40Client\dotNetFx40_Client_x86_x64.exe' for item 'Microsoft .NET 
Framework 4 Client Profile (x86 and x64)' to your local machine. For more 
information, see http://go.microsoft.com/fwlink/?LinkId=239883

I placed the file dotNetFx40_Client_setup.exe in the location: C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\Bootstrapper\Packages\DotNetFX40Client

I also left it in it's original location (note the v7.0A):

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\DotNetFX40Client

Edit (after solving the problem): I see that the correct setup file (dotNetFx40_Client_x86_x64.exe) is actually in the v7.0A folder. Had I just copied it from there everything would have worked (rather than downloading the wrong setup).

Publish works fine when I change the option "Download prerequisites from the same location as my application" to "Download prerequisites from the component vendor's website" (at project Properties -> Publish -> Prerequisites...)

I noticed a yellow exclamation point beside the (checked) "Windows Installer 3.1" with the warning: "Prerequisite could not be found for bootstrapping". For that I have the file WindowsInstaller-KB893803-v2-x86.exe in the folder:

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\WindowsInstaller3_1

The application has run fine within my company's network for the past year when published with Visual Studio 2010. I opened the solution file in VS 2012 (for the first time) and it compiles and runs fine locally. Only the Publish feature is broken.

Am I missing something? Where is ClickOnce Publish expecting to find these prerequisites for my WPF application?

回答1:

I'm answering my own question. The problem went away when I used a different .Net 4 Client setup program. The exe that works for me is dotNetFx40_Client_x86_x64.exe found at:

http://www.microsoft.com/en-us/download/details.aspx?id=24872

The wrong setup program is dotNetFx40_Client_setup.exe which I was led to by following the Microsoft MSDN help topic How to: Include Prerequisites with a ClickOnce Application (Visual Studio 2012) which led me to this link to the setup. I use Chrome which downloaded the web installer which I didn't realize was not the file I needed. Had I been using IE none of this would have happened. I was clued into the problem by this StackOverflow question which suggests renaming the setup program. Instead of renaming it I just downloaded the correct one.



回答2:

re: Windows installer: VS2012 doesn't include the same prerequisites as VS2010, but you can copy the package from the previous SDK folders to the new one, and it will magically show up in the prerequisite list in VS2012 and work!