سؤال

لدي تطبيق مع الإصدار رقم: 1.0.0.1، وهو ترقية إلى الإصدار الأقدم 1.0.0.0.

عندما أحاول تثبيت الإصدار الجديد 1.0.0.1، عندما يكون لدى نظامي بالفعل الإصدار القديم، أنا الحصول على الخطأ 2869.

ولكن إذا قمت بإلغاء تثبيت الإصدار الأقدم يدويا وأكثر من محاولة تثبيت الإصدار الأحدث، ثم تثبيته بنجاح.

قمت بتغيير رمز المنتج لإصدار جديد.ولكن لم يغير رمز الترقية.

هل يمكن لأي شخص سمحوا لي أن أعرف السبب وإصلاح هذا؟

هل كانت مفيدة؟

المحلول

In the MSI ProductVersion property only the first 3 fields are significant when comparing versions using the major upgrade logic. So in your case MSI will consider 1.0.0.1 and 1.0.0.0 to both be 1.0.0. FindRelatedProducts will therefore not detect this situation as an upgrade.

The way I approach this is to create a 'packed' version where the 3rd and 4th fields are combined into one using, say (4096*f3 + f4), but this will behove you never to have a 4th field (build number) greater than 4096, and a 3rd field no bigger than 15, since 0xFFFF is the maximum for a version field.

This allows us to perform major upgrades between individual nightly builds, not just service packs, without requiring a bootstrapper to achieve a minor upgrade, and we can have a new productcode for every build so there's no need to have to remember to update it manually when the need arises.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top