2016年4月20日

Disable Light Bulb

Visual Studio 2015 Update 2 の C++ のプロジェクトですが、緑の下線と共に電球が表示されて、関数定義が無いとのメッセージが表示されることがあります。




これ、Visual Studio 2015 の新機能だそうで、light bulb (電球?)と呼ぶそうです。

Perform quick actions with light bulbs
https://msdn.microsoft.com/en-us/library/dn872466.aspx

しかし、まだあまり賢くないようなので無効にしました。

Option → Text Editor → C/C++ → Advanced → Refactoring → Disable Create Declaration/Definition Light Bulbs を、False から True に変更します。




 警告が消えました。


2016年4月11日

Universal CRT in Wix Bootstrapper (2)

前回、Universal CRTを含めたWiXのBootstrapperwxsファイルを作ってみましたが、インストール条件が長ったらしくなってしまいました。
そこで、ucrtbase.dllファイルのチェックをSystem32ディレクトリに限定し、MsuPackage要素にDetectCondition属性を使ってみました。
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
  xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
  xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">

  <Bundle Name="Example Product" Version="1.2.3.4" Manufacturer="John Doe"
    Copyright="© 2016 John Doe" AboutUrl="https://example.com/"
    UpgradeCode="01234567-89AB-CDEF-0123-456789ABCDEF" Condition="VersionNT &gt;= v5.1">

    <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
      <bal:WixStandardBootstrapperApplication
        LicenseFile="license.rtf" ShowVersion="yes" SuppressOptionsUI="yes" />
    </BootstrapperApplicationRef>

    <!-- v6.0 Service Pack 2 -->
    <bal:Condition Message="This application requires Service Pack 2 for Windows Vista / Server 2008.">
      (VersionNT &lt;&gt; v6.0) OR (VersionNT = v6.0 AND ServicePackLevel &gt;= 2)
    </bal:Condition>

    <!-- v6.1 Service Pack 1 -->
    <bal:Condition Message="This application requires Service Pack 1 for Windows 7 / Server 2008 R2.">
      (VersionNT &lt;&gt; v6.1) OR (VersionNT = v6.1 AND ServicePackLevel &gt;= 1)
    </bal:Condition>

    <!-- v6.3 KB2919355 -->
    <util:FileSearch Id="HAL.DLL" Path="[WindowsFolder]System32\hal.dll"
      Result="version" Variable="NT603HALVER" Condition="VersionNT = v6.3" />
    <bal:Condition Message="This application requires S14 Update (KB2919355) for Windows 8.1 / Server 2012 R2.">
      (VersionNT &lt;&gt; v6.3) OR (VersionNT = v6.3 AND NT603HALVER &gt; v6.3.9600.16500)
    </bal:Condition>

    <!-- ucrtbase.dll version -->
    <util:FileSearch Id="UCRTBASE.DLL" Path="[WindowsFolder]System32\ucrtbase.dll"
      Result="version" Variable="UCRTBASEVER" />
    <!-- universal crt version -->
    <Variable Name="UCRTVER" Type="version" Value="10.0.10586.0" />

    <Chain>

      <!-- Windows Vista / Windows Server 2008 (x86) -->
      <MsuPackage Name="Windows6.0-KB3118401-x86.msu"
        DisplayName="Universal CRT" KB="KB3118401" Cache="no" Compressed="yes" Permanent="yes"
        SourceFile="Windows6.0-KB3118401-x86.msu" InstallCondition="VersionNT = v6.0 AND NOT VersionNT64"
        DetectCondition="VersionNT = v6.0 AND NOT VersionNT64 AND UCRTBASEVER &gt;= UCRTVER" />

      <!-- Windows Vista / Windows Server 2008 (x64) -->
      <MsuPackage Name="Windows6.0-KB3118401-x64.msu"
        DisplayName="Universal CRT" KB="KB3118401" Cache="no" Compressed="yes" Permanent="yes"
        SourceFile="Windows6.0-KB3118401-x64.msu" InstallCondition="VersionNT = v6.0 AND VersionNT64"
        DetectCondition="VersionNT = v6.0 AND VersionNT64 AND UCRTBASEVER &gt;= UCRTVER" />

      <!-- Windows 7 (x86) -->
      <MsuPackage Name="Windows6.1-KB3118401-x86.msu"
        DisplayName="Universal CRT" KB="KB3118401" Cache="no" Compressed="yes" Permanent="yes"
        SourceFile="Windows6.1-KB3118401-x86.msu" InstallCondition="VersionNT = v6.1 AND NOT VersionNT64"
        DetectCondition="VersionNT = v6.1 AND NOT VersionNT64 AND UCRTBASEVER &gt;= UCRTVER" />

      <!-- Windows 7 / Windows Server 2008 R2 (x64) -->
      <MsuPackage Name="Windows6.1-KB3118401-x64.msu"
        DisplayName="Universal CRT" KB="KB3118401" Cache="no" Compressed="yes" Permanent="yes"
        SourceFile="Windows6.1-KB3118401-x64.msu" InstallCondition="VersionNT = v6.1 AND VersionNT64"
        DetectCondition="VersionNT = v6.1 AND VersionNT64 AND UCRTBASEVER &gt;= UCRTVER" />

      <!-- Windows 8 (x86) -->
      <MsuPackage Name="Windows8-RT-KB3118401-x86.msu"
        DisplayName="Universal CRT" KB="KB3118401" Cache="no" Compressed="yes" Permanent="yes"
        SourceFile="Windows8-RT-KB3118401-x86.msu" InstallCondition="VersionNT = v6.2 AND NOT VersionNT64"
        DetectCondition="VersionNT = v6.2 AND NOT VersionNT64 AND UCRTBASEVER &gt;= UCRTVER" />

      <!-- Windows 8 / Windows Server 2012 (x64) -->
      <MsuPackage Name="Windows8-RT-KB3118401-x64.msu"
        DisplayName="Universal CRT" KB="KB3118401" Cache="no" Compressed="yes" Permanent="yes"
        SourceFile="Windows8-RT-KB3118401-x64.msu" InstallCondition="VersionNT = v6.2 AND VersionNT64"
        DetectCondition="VersionNT = v6.2 AND VersionNT64 AND UCRTBASEVER &gt;= UCRTVER" />

      <!-- Windows 8.1 (x86) -->
      <MsuPackage Name="Windows8.1-KB3118401-x86.msu"
        DisplayName="Universal CRT" KB="KB3118401" Cache="no" Compressed="yes" Permanent="yes"
        SourceFile="Windows8.1-KB3118401-x86.msu" InstallCondition="VersionNT = v6.3 AND NOT VersionNT64"
        DetectCondition="VersionNT = v6.3 AND NOT VersionNT64 AND UCRTBASEVER &gt;= UCRTVER" />

      <!-- Windows 8.1 / Windows Server 2012 R2 (x64) -->
      <MsuPackage Name="Windows8.1-KB3118401-x64.msu"
        DisplayName="Universal CRT" KB="KB3118401" Cache="no" Compressed="yes" Permanent="yes"
        SourceFile="Windows8.1-KB3118401-x64.msu" InstallCondition="VersionNT = v6.3 AND VersionNT64"
        DetectCondition="VersionNT = v6.3 AND VersionNT64 AND UCRTBASEVER &gt;= UCRTVER" />

      <!-- x64 modules -->
      <MsiPackage Id="X64" DisplayName="x64 modules" ForcePerMachine="yes" Compressed="yes"
        SourceFile="x64.msi" InstallCondition="VersionNT64" />

      <!-- x86 modules -->
      <MsiPackage Id="X86" DisplayName="x86 modules" ForcePerMachine="yes" Compressed="yes"
        SourceFile="x86.msi" After="X64" />

    </Chain>

  </Bundle>

</Wix>

ちょっとすっきり。