问题
EDIT: After even more searching I found a way to complete this. I used This preview page to alter my Product.xml then I copied some of my existing Product.xml to Check if it is installed already.
So I successfully implemented the Sync Framework 2.1 on my system and in my C# Application. However when I publish it and test it on another pc where Sync Framework is not installed, it comes up with errors So I try to include the SyncSDK-v2.1-x86-ENU.msi on install.
After searching I found out that I need to add it to the prerequisites list (Project -> Properties -> Publish -> prerequisites)
I've tried following this link about Creating Custom Packages. However it still points to the BMG (Bootstrapper Manifest Generator) file which does not exists anymore.
Next solution was to create it manually, I think I'm on the right path but just can't complete it. What I did:
- Downloaded dotNetFx45_Full_x86_x64.exe and put it into: C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\Bootstrapper\Packages\DotNetFX45
- Made a new folder called SyncFrame inside C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\Bootstrapper\Packages\
- Added a Product.xml and copied the SyncSDK-v2.1-x86-ENU.msi to the SyncFrame folder. Also added a subfolder "en", in there made a Package.xml and a Eula.rtf file.
- In VS2013, Project->Properties->Publish->Prerequisites I've chosen "Download prerequisites from same the location as my application".
- When published, it successfully adds a 'dotnetfx45' folder to the published folder containing the .exe file. This ofcourse because I checked "Microsoft .NET Framework 4.5 (x86 and x64) in the Prerequisites selection box.
However I still can't manage to get the Sync Framework 2.1 into the Prerequisites selection box.
Here is my (probably rubbish) Product.xml: EDIT: This is now Product.xml that fixed my problem:
<?xml version="1.0" encoding="utf-8" ?>
<Product
xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
ProductCode="Microsoft.Sample.EULA">
<!-- Defines the list of files to be copied on build. -->
<PackageFiles CopyAllPackageFiles="false">
<PackageFile Name="SyncSDK-v2.1-x86-ENU.msi"/>
</PackageFiles>
<InstallChecks>
<MsiProductCheck Product="IsMsiInstalled"
Property="{{4A3EAF2F-F950-4BF2-B0C7-857E0E970E5A}}"/>
</InstallChecks>
<!-- Defines how to run the Setup package.-->
<Commands >
<Command PackageFile = "SyncSDK-v2.1-x86-ENU.msi" Arguments=''>
<InstallConditions>
<BypassIf Property="IsMsiInstalled"
Compare="ValueGreaterThan" Value="0"/>
<FailIf Property="AdminUser"
Compare="ValueNotEqualTo" Value="True"
String="NotAnAdmin"/>
</InstallConditions>
<ExitCodes>
<ExitCode Value="0" Result="Success" />
<ExitCode Value="-1" Result="Fail" String="AU_Unaccepted" />
<DefaultExitCode Result="Fail"
FormatMessageFromSystem="true" String="GeneralFailure" />
</ExitCodes>
</Command>
</Commands>
I've used How to create Product Manifest to make this...
And here is my Package.xml
<?xml version="1.0" encoding="utf-8" ?>
<Package
xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
Name="DisplayName"
Culture="Culture"
LicenseAgreement="Eula.rtf">
<PackageFiles>
<PackageFile Name="Eula.rtf"/>
</PackageFiles>
<Strings>
<String Name="DisplayName">Sync Framework 2.1</String>
<String Name="Culture">en</String>
<String Name="NotAnAdmin">You must be an administrator to install this package. </String>
<String Name="GeneralFailure">
A general error has occurred while
installing this package.
</String>
</Strings>
</Package>
A little side question but not the problem at all at the moment, I also make use of SQL databases, locally included in the project and online databases, Do I need to select more Prerequisites in the Prerequisites selection box. like SQL server express 2012 localDB? Edit: Yes
This works ok, but I would still like to create a product.xml so it automatically downloads from the website instead of putting it within the install folder. It kind of makes the install folder to big for a small app.
回答1:
Finally I finished the bootstrapper based on bootstrappers for sync framework 2.0
here is the package and product xml respectively:
product.xml for SyncFX20Core(x64)
<?xml version="1.0" encoding="UTF-8"?>
<Product xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper" ProductCode="SyncFX20Core(x64)"/>
package.xml for SyncFX20Core(x64)
<?xml version="1.0" encoding="utf-8"?>
<Package Name="DisplayName" LicenseAgreement="synchronizationeula_english.rtf" Culture="Culture" xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper">
<PackageFiles CopyAllPackageFiles="false">
<PackageFile Name="synchronizationeula_english.rtf" />
<PackageFile Name="Synchronization-v2.1-x64-ENU.msi" HomeSite="SyncFX21_64" PublicKey="3082010A0282010100BD72B489E71C9F85C774B8605C03363D9CFD997A9A294622B0A78753EDEE463AC75B050B57A8B7CA05CCD34C77477085B3E5CBDF67E7A3FD742793679FD78A034430C6F7C9BAC93A1D0856444F17080DF9B41968AA241CFB055785E9C54E072137A7EBCE2C2FB642CD2105A7D6E6D32857C71B7ACE293607CD9E55CCBBF122EBA823A40D29C2FBD0C35A3E633DC72C490B7B7985F088EF71BD435AE3A3B30DF355FB25E0E220D3E79A5E94A5332D287F571B556A0C3244EF666C6FF0389CEF02AD9AA1DD9807100E3C1869E2794E4614E0B98CD0756D9CAC009C2D42F551B85AF4784583E92E7C2BBB5DCD196128AD94430AC56A42FFB532AEA42922DE16E8D30203010001" />
</PackageFiles>
<Commands Reboot="Defer">
<Command PackageFile="Synchronization-v2.1-x64-ENU.msi" Arguments="/quiet" EstimatedInstallSeconds="80" EstimatedTempBytes="20000000">
<ExitCodes>
<ExitCode Value="0" Result="Success" />
<ExitCode Value="112" Result="Fail" String="DiskFull" />
<DefaultExitCode Result="Fail" String="Anunexpectedexitcodewasr" FormatMessageFromSystem="true" />
</ExitCodes>
</Command>
</Commands>
<Strings>
<String Name="Culture">en</String>
<String Name="DisplayName">SyncFX21Core (x64)</String>
<String Name="SyncFX21_64">http://download.microsoft.com/download/E/1/E/E1E636E6-AA5C-4052-9927-D722312DB564/Synchronization-v2.1-x64-ENU.msi</String>
<String Name="DiskFull">DiskFull</String>
<String Name="Anunexpectedexitcodewasr">An unexpected exit code was returned from the installer. The installation failed.</String>
</Strings>
</Package>
product.xml for SyncFX20DatabaseProviders(x64)
<?xml version="1.0" encoding="utf-8"?>
<Product ProductCode="SyncFX20DatabaseProviders(x64)" xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper">
<RelatedProducts>
<DependsOnProduct Code="SyncFX20Core(x64)" />
</RelatedProducts>
</Product>
package for for SyncFX20DatabaseProviders(x64)
<?xml version="1.0" encoding="utf-8"?>
<Package Name="DisplayName" LicenseAgreement="databaseproviderseula_english.rtf" Culture="Culture" xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper">
<PackageFiles CopyAllPackageFiles="false">
<PackageFile Name="databaseproviderseula_english.rtf" />
<PackageFile Name="DatabaseProviders-v3.1-x64-ENU.msi" HomeSite="SyncFX21DatabaseProviders_64" PublicKey="3082010A0282010100BD72B489E71C9F85C774B8605C03363D9CFD997A9A294622B0A78753EDEE463AC75B050B57A8B7CA05CCD34C77477085B3E5CBDF67E7A3FD742793679FD78A034430C6F7C9BAC93A1D0856444F17080DF9B41968AA241CFB055785E9C54E072137A7EBCE2C2FB642CD2105A7D6E6D32857C71B7ACE293607CD9E55CCBBF122EBA823A40D29C2FBD0C35A3E633DC72C490B7B7985F088EF71BD435AE3A3B30DF355FB25E0E220D3E79A5E94A5332D287F571B556A0C3244EF666C6FF0389CEF02AD9AA1DD9807100E3C1869E2794E4614E0B98CD0756D9CAC009C2D42F551B85AF4784583E92E7C2BBB5DCD196128AD94430AC56A42FFB532AEA42922DE16E8D30203010001" />
</PackageFiles>
<Commands Reboot="Defer">
<Command PackageFile="DatabaseProviders-v3.1-x64-ENU.msi" Arguments="/quiet" EstimatedInstallSeconds="80" EstimatedTempBytes="20000000">
<ExitCodes>
<ExitCode Value="0" Result="Success" />
<ExitCode Value="112" Result="Fail" String="DiskFull" />
<DefaultExitCode Result="Fail" String="Anunexpectedexitcodewasr" FormatMessageFromSystem="true" />
</ExitCodes>
</Command>
</Commands>
<Strings>
<String Name="Culture">en</String>
<String Name="DisplayName">SyncFX21DatabaseProviders (x64)</String>
<String Name="SyncFX21DatabaseProviders_64">http://download.microsoft.com/download/E/1/E/E1E636E6-AA5C-4052-9927-D722312DB564/DatabaseProviders-v3.1-x64-ENU.msi</String>
<String Name="DiskFull">DiskFull</String>
<String Name="Anunexpectedexitcodewasr">An unexpected exit code was returned from the installer. The installation failed.</String>
</Strings>
</Package>
Please Feel free to contact me if you need more details or the source files... ameser@gmail.com
Cheers!.
回答2:
Xml for x86 version with Installed check:
<?xml version="1.0" encoding="UTF-8"?>
<Product xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper" ProductCode="SyncFX21Core (x86)" >
<PackageFiles CopyAllPackageFiles="false">
<PackageFile Name="synchronization-v2.1-x86-enu.msi" PublicKey="3082010A0282010100BD3089FB4572A8536B9E894F0023C0BED41D3DB1594038F373918226E696120053D91C820E3CCE1DBBBDF7428D97D4FC381AE4B9F9E3ECD36103BFA0D3D6754D5C46A9ED5EF0D2E2695B1A73EAB31C8D04CD2944A064592F1E985D6EC7AB18398265C4A7BCAB758819EA87971426B37F2676A4D4383984E3B326D518F92BE9D2C9165A5421F2978D878629FEF4492CE68BF8043F7DCDCD9692860D7103E2D0FE0C4235FFD7B83FDD8E450A7DF6D74BAD5BF076721D77237D8935C41C5DB250034B476D07A75588980680A681AD544ED881D6FABF42C031BE550D99D553491230EBE5A5887C5EC47A5A148708B43769A0EB32248C08EBF9D414BAE0FCCDEAA4150203010001" />
</PackageFiles>
<InstallChecks>
<RegistryCheck Property="Installed" Key="HKLM\SOFTWARE\Microsoft\Microsoft Sync Framework\v2.1\Setup\SynchronizationX86" Value="Install"/>
</InstallChecks>
<Commands>
<Command PackageFile="synchronization-v2.1-x86-enu.msi" Arguments="/quiet" EstimatedInstallSeconds="80" EstimatedTempBytes="20000000">
<InstallConditions>
<BypassIf Property="Installed" Compare="ValueEqualTo" Value="1" />
<FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired" />
</InstallConditions>
<ExitCodes>
<ExitCode Value="0" Result="Success" />
<ExitCode Value="112" Result="Fail" String="DiskFull" />
<DefaultExitCode Result="Fail" String="Anunexpectedexitcodewasr" FormatMessageFromSystem="true" />
</ExitCodes>
</Command>
</Commands>
<Strings>
<String Name="DiskFull">DiskFull</String>
<String Name="AdminRequired">Administrator permissions are required to install Sync Framework 2.1. Contact your administrator.</String>
<String Name="Anunexpectedexitcodewasr">An unexpected exit code was returned from the installer. The installation failed.</String>
</Strings>
</Product>
来源:https://stackoverflow.com/questions/25331096/bootstrapper-sync-framework-2-1-prerequisites