问题
I've recently installed vs2012
and I've updated my ClickOnce application. To be more precise, the first time I've opened my C++ project
(on which depends my primary c# project) I've not updated it and everything worked fine. VS 2012
was still able to see the Visual C++ 2010 prerequisite. Later on I've updated my project by changing the Platform Toolset to "Visual Studio 2012 (v110)"
under Properties->Configuration Properties->General
.
In the meantime I've installed even other software
and now I discovered that I'm no more able to add the Visual C++ prerequisite to my project for the ClickOnce publishing. The Visual C++ 2010 Runtime Libraries (x64)
prerequisite is marked with a yellow triangle and it is missing. Ideally I'd like to update to Visual C++ 2012 Runtime Libraries x64 (and x86)
, but even this prerequisite is missing.
I guess it is due to the fact that in the folder C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\Bootstrapper\Packages
the corresponding package (vcredist_x64)
is empty. I've also noticed that in the list of installed programs in the Control Panel I had Microsoft Visual C++ 2010 x64
and x86
installed, both the Redistributable version and the Runtime version (I think they where installed previously with Visual Studio 2010), while I was missing the Visual C++ 2012 files. Hence I'm arguing that the Visual C++ 2012 didn't come together with Visual Studio 2012, isn't it? I've even tried to install the Visual C++ 2012 Redistributable x64 packages by downloading them and now they are listed in my installed programs 8only the Redistributable, not the Runtime version).
However the prerequisite is still missing. How can I solve this? I've even thought about manually copying the bootstrapper package for Visual C++ 2010 located in the...\v7.0A\Bootstrapper\Packages
folder and changing it manually for C++ 2012 but I do not know what I should write in product.xml
under <MsiProductCheck Property="VCRedistInstalled" Product=?>
. It seems that the product GUID to insert this information can be obtained with Bootstrapper Manager, but this program is throwing a lot of exception and I do not know how to do it. As a second solution is it safe to simply copying the package for Visual C++ 2010 from \\v7.0A\Bootstrapper\Packages\Bootstrapper\Packages to \v8.0A\Bootstrapper\Packages
?
回答1:
Go to \v8.0A\Bootstrapper\Packages and make sure you have the vcredist_x86 folder.
In that folder you should have an "en" folder, that should remain there, you are missing
- product.xml
- vcredist_x86.exe
You can download the required .exe from http://go.microsoft.com/fwlink/?LinkID=266495&clcid=0x409
As for the product.xml
<?xml version="1.0" encoding="utf-8" ?>
<Product
xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
ProductCode="Microsoft.Visual.C++.11.0.x86"
>
<!-- Defines list of files to be copied on build -->
<PackageFiles>
<PackageFile Name="vcredist_x86.exe" HomeSite="VCRedistExe"/>
</PackageFiles>
<InstallChecks>
<MsiProductCheck Property="VCRedistInstalled" Product="{6C772996-BFF3-3C8C-860B-B3D48FF05D65}"/>
</InstallChecks>
<!-- Defines how to invoke the setup for the Visual C++ 11.0 redist -->
<!-- TODO: Needs EstrimatedTempSpace, LogFile, and an update of EstimatedDiskSpace -->
<Commands Reboot="Defer">
<Command PackageFile="vcredist_x86.exe"
Arguments=' /q:a '
>
<!-- These checks determine whether the package is to be installed -->
<InstallConditions>
<BypassIf Property="VCRedistInstalled" Compare="ValueGreaterThanOrEqualTo" Value="3"/>
<!-- Block install if user does not have admin privileges -->
<FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
<!-- Block install on Win95 -->
<FailIf Property="Version9X" Compare="VersionLessThan" Value="4.10" String="InvalidPlatformWin9x"/>
<!-- Block install on NT 4 or less -->
<FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.00" String="InvalidPlatformWinNT"/>
</InstallConditions>
<ExitCodes>
<ExitCode Value="0" Result="Success"/>
<ExitCode Value="3010" Result="SuccessReboot"/>
<DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
</ExitCodes>
</Command>
</Commands>
</Product>
回答2:
For those looking for a similar answer for the 2012 x64 vcredist, here's one I cobbled together that seems to work. Note the download link is http://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe
<?xml version="1.0" encoding="utf-8" ?>
<Product
xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
ProductCode="Microsoft.Visual.C++.11.0.x64"
>
<!-- Defines list of files to be copied on build -->
<PackageFiles>
<PackageFile Name="vcredist_x64.exe" HomeSite="VCRedistExe"/>
</PackageFiles>
<InstallChecks>
<MsiProductCheck Property="VCRedistInstalled" Product="{CF2BEA3C-26EA-32F8-AA9B-331F7E34BA97}"/>
</InstallChecks>
<!-- Defines how to invoke the setup for the Visual C++ 11.0 redist -->
<!-- TODO: Needs EstimatedTempSpace, LogFile, and an update of EstimatedDiskSpace -->
<Commands Reboot="Defer">
<Command PackageFile="vcredist_x64.exe"
Arguments=' /q:a '
>
<!-- These checks determine whether the package is to be installed -->
<InstallConditions>
<BypassIf Property="VCRedistInstalled" Compare="ValueGreaterThanOrEqualTo" Value="3"/>
<!-- Block install if user does not have admin privileges -->
<FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
<!-- Block install on any platform other than x64 -->
<FailIf Property="ProcessorArchitecture" Value="AMD64" Compare="ValueNotEqualTo" String="InvalidOS"/>
<!-- Block install on Vista or below -->
<FailIf Property="VersionNT" Compare="VersionLessThan" Value="6.00" String="InvalidPlatformWinNT"/>
</InstallConditions>
<ExitCodes>
<ExitCode Value="0" Result="Success"/>
<ExitCode Value="3010" Result="SuccessReboot"/>
<DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
</ExitCodes>
</Command>
</Commands>
</Product>
来源:https://stackoverflow.com/questions/14497382/missing-prerequisites-for-visual-c-in-visual-studio-2012