2013-09-25 26 views
6

Tôi đang cố gắng triển khai phiên bản tự động để khi tôi xây dựng Bootstrapper, cả phiên bản MyApp và Bootstrapper đều được tự động tăng và đồng bộ. Nếu không, bạn kết thúc với các mục khởi động trùng lặp trong các chương trình thêm/xóa cho mỗi lần cài đặt với các phiên bản phù hợp.Tự động tăng và đồng bộ hóa phiên bản cho sản phẩm và bootstrapper

Khi tôi xây dựng bootstrapper, mục tiêu AfterBuild sử dụng GetAssemblyIdentity để lấy phiên bản MyApp được tạo tự động thành công và tệp đầu ra bootstrapper được đặt tên đúng với số phiên bản tăng lên, ví dụ: MyApp.1.0.5123.1352.exe

Tuy nhiên, khi tôi cài đặt Bootstrapper này, phiên bản hiển thị trong chương trình thêm/xóa luôn là 1.0.0.0.

Tôi đã thử sử dụng các liên kết trong trường Phiên bản gói Bootstrapper nhưng tôi không thể đọc nó để đọc phiên bản MyApp.

Sử dụng !(bind.packageVersion.MyApp) kết quả không bao giờ tăng lên 1.0.0.0.
Sử dụng !(bind.assemblyName.MyApp) kết quả trong các lỗi xây dựng (Biến thời gian ràng buộc chưa được giải quyết).
Sử dụng !(bind.FileVersion.filAAF013CA9B89B07C81031AE69884BF11) kết quả trong các lỗi xây dựng (Biến thời gian ràng buộc chưa được giải quyết). < - Có ý nghĩa như FileID tồn tại trong dự án Setup và đây là dự án Bootstrapper.

What can I do to get my Bootstrapper Bundle to have the same version as the MyApp it is packaging?

===== MyApp \ AssemblyInfo.cs =====

[assembly: AssemblyVersion("1.0.*")] 
[assembly: AssemblyFileVersion("1.0.*")] 

===== ===== Setup.wixproj

<Target Name="BeforeBuild"> 
    <PropertyGroup> 
    <LinkerBaseInputPaths>..\MyApp\bin\$(Configuration)\</LinkerBaseInputPaths> 
    </PropertyGroup> 
    <HeatDirectory OutputFile="MyApp_Files.wxs" Directory="..\MyApp\bin\$(Configuration)\" DirectoryRefId="INSTALLLOCATION" ComponentGroupName="MyApp_Project" SuppressCom="true" SuppressFragments="true" SuppressRegistry="true" SuppressRootDirectory="true" AutoGenerateGuids="false" GenerateGuidsNow="true" ToolPath="$(WixToolPath)" Condition="'%(ProjectReference.PackageThisProject)'=='True'" /> 
</Target> 

= ==== Bootstrapper.wixproj =====

<Target Name="AfterBuild"> 
    <GetAssemblyIdentity AssemblyFiles="..\MyApp\bin\$(Configuration)\MyApp.exe"> 
     <Output TaskParameter="Assemblies" ItemName="AssemblyVersion" /> 
    </GetAssemblyIdentity> 
    <Copy SourceFiles=".\bin\$(Configuration)\$(OutputName).exe" DestinationFiles=".\bin\$(Configuration)\MyApp.%(AssemblyVersion.Version).exe" /> 
    <Delete Files=".\bin\$(Configuration)\$(OutputName).exe" /> 
</Target> 

===== Bootstrapper \ Bundle.wxs =====

<Bundle Name="$(var.ProductName) Bootstrapper v!(bind.packageVersion.MyApp)" 
     Version="!(bind.packageVersion.MyApp)" 
+0

bind.packageVersion. chỉ có thể đọc phiên bản từ một dự án thiết lập vì vậy tôi mong đợi rằng sẽ được bind.packageVersion.Setup. – Neil

Trả lời

6

OK! Tôi không nhận ra bạn có thể khai báo Biến số DefineConstants trong mục tiêu BeforeBuild.

Dưới đây là một ví dụ BeforeBuild Target mà tạo ra một biến BuildVersion

Bundle.wxs:

<Bundle Name="$(var.ProductName) Bootstrapper v$(var.BuildVersion)" 
     Version="$(var.BuildVersion)" 

Bootstrapper.wixproj:

<Target Name="BeforeBuild"> 
    <GetAssemblyIdentity AssemblyFiles="..\MyApp\bin\$(Configuration)\MyApp.exe"> 
     <Output TaskParameter="Assemblies" ItemName="AssemblyVersion" /> 
    </GetAssemblyIdentity> 
    <PropertyGroup> 
     <DefineConstants>BuildVersion=%(AssemblyVersion.Version)</DefineConstants> 
    </PropertyGroup> 
    </Target> 
    <!-- This is extra, not needed: Renames output file with version number --> 
    <Target Name="AfterBuild"> 
    <GetAssemblyIdentity AssemblyFiles="..\MyApp\bin\$(Configuration)\MyApp.exe"> 
     <Output TaskParameter="Assemblies" ItemName="AssemblyVersion" /> 
    </GetAssemblyIdentity> 
    <Copy SourceFiles=".\bin\$(Configuration)\$(OutputName).exe" DestinationFiles=".\bin\$(Configuration)\MyApp.%(AssemblyVersion.Version).exe" /> 
    <Delete Files=".\bin\$(Configuration)\$(OutputName).exe" /> 
    </Target> 
+0

Hmmm ... khi tôi thử điều này, tôi nhận được biến số tiền xử lý không xác định '$ (var.BuildVersion)'. " Tôi đang cố gắng lấy phiên bản, tên công ty, tên sản phẩm, vv từ Hội đồng. (Tôi chỉ sử dụng phần "BeforeBuild" của bạn và thay thế MyApp bằng tên/tên ứng dụng của tôi) –

+0

Đảm bảo đường dẫn đến exe hoặc dll là chính xác, nó liên quan đến nơi dự án Bootstrapper của bạn nằm, điều này làm việc cho tôi 'không chắc chắn lý do tại sao bạn sẽ nhận được rằng lỗi nếu nó có thể tìm thấy các tập tin –

+0

Cảm ơn bụi bẩn, tôi quản lý để có được xây dựng để làm việc. Tôi đã cố gắng để mở rộng kỹ thuật của bạn và cũng lấy công ty, sản phẩm, vv từ siêu dữ liệu lắp ráp, nhưng đã không thể có được rằng để làm việc. –

17

Đây là những gì tôi sẽ làm:

  1. Trong hội đồng của tôi, tôi sử dụng phiên bản tự động: AssemblyVersion("1.0.*")

  2. Trong dự án thiết lập tham chiếu phiên bản bằng cách gắn kết với cụm: !(bind.fileVersion.MyAssembly.dll) (MyAssembly.dll là File/@ Id của hội đồng)

  3. Trong bó sử dụng liên kết với các phiên bản cài đặt: !(bind.packageVersion.Setup) (Setup là tên dự án như được tham chiếu trong các dự án bó)
+0

Tôi đặt * Thiết lập \ Product.wxs * Phiên bản thành ' (bind.fileVersion.MyFileID) 'và * Bootstrapper \ Bundle.wxs * Phiên bản thành'! (bind.packageVersion.Setup) 'và tôi nhận được lỗi' Biến thời gian ràng buộc chưa được giải quyết! (bind.packageVersion.Setup) ' –

+0

Có bạn đã tham chiếu dự án Thiết lập trong dự án Bundle? – Neil

+0

Có ' Thiết lập' –

Các vấn đề liên quan