2012年9月17日 星期一

Create additional registry keys with DSL Tools Setup Projects



I was trying to solve the Custom Tool property issue with .actiw files in ActiveWriter, as suggested by Bogdan Pietroiu months ago, and spent a clear hour trying to figure how to inject my own registry keys into WiX setup project of DSL Tools. I modified the .vstemplate for .actiw files to include the following:

...
<CustomParameters>
  <CustomParameter Name="$itemproperties$" Value="CustomTool" />
  <CustomParameter Name="$CustomTool$" Value="ActiveWriterCodeGenerator" />
</CustomParameters>
...

and thought that the file, when added to the project, will have Custom Tool property already set. I was appearently wrong (documentation says it should work).

Bogdan's suggestion was to have a key named after the file extension under Generators\{Language}, and I manually confirmed that it works great. So, how to automate the process of adding this reg key through the setup? WiX Toolkit documentation shows the way, so I copied Registry.wxs to have my own key registered.
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns='http://schemas.microsoft.com/wix/2003/01/wi'>
  <Fragment Id="CustomToolFragment">
    <FeatureRef Id="DefaultFeature">
      <ComponentRef Id="_ActiveWriterCTReg" />
    </FeatureRef>
    <DirectoryRef Id="TARGETDIR">
      <Component Id="_ActiveWriterCTReg" Guid="{some GUID}">
        <Registry Root='HKLM' Key='Software\Microsoft\VisualStudio\8.0\Generators\{164b10b9-b200-11d0-8c61-00a0c91e29d5}\.actiw' Id='{some GUID}' Type='string'Value='ActiveWriterCodeGenerator' />
        <Registry Root='HKLM' Key='Software\Microsoft\VisualStudio\8.0\Generators\{fae04ec1-301f-11d3-bf4b-00c04f79efbc}\.actiw' Id='{some GUID}' Type='string'Value='ActiveWriterCodeGenerator' />
      </Component>
    </DirectoryRef>
  </Fragment>
</Wix>

<Registry> elements define the key to be added, as you may have guessed. Anyway, although I changed the build action on the .wxs and although it seems that Candle and Light picked up the file, the installer didn't add the registry key. So? Orca to the rescue. You should check Component and Registry tables in .msi file to check if your key slipped in, and Orca shows them quite detailed. In my case, though, it shows the absence of my additions.

Long story (not so) short, it seems that I should examine Registry.tt as the first step, but didn't. To include your ComponentRef in DefaultFeature, you should have your Fragment as FragmentRef in Main.wxs . So, you should add each of your custom fragment in the list defined incustomFragmentIds in InstallerDefinitions.dslsetup as shown below:

<installerDefinitionxmlns="http://schemas.microsoft.com/VisualStudio/2005/DslTools/InstallerDefinitionModel"
  ...
  customFragmentIds="CustomToolFragment">

I hope this info helps someone.

2012年9月7日 星期五

新的Lenovo鍵盤

實在不想批評, 但是新的Lenovo T430 島式鍵盤, 實在不好用, 或許是不習慣.
少了許多按鍵就算了(少了 PrtScr, ScrLk, Pause), 反正也少用, 就算了
ps: 前一頁, 下一頁也沒了

請同事幫忙查到
Pause ==> Fn + P
Break ==> Fn + B
ScrLk ==> Fn + C
SysRq(PrtSc) ==> Fn + S 

可是我常用的滑鼠右鍵(就是App鍵)的位置, 竟然被 PrtSc取代了!!
快瘋了, 原本的工作可以不用滑鼠只靠鍵盤加快捷鍵就能完成, 現在要拖著滑鼠, 才能用右鍵功能!!

找了兩天, 使用了 日本人 Hirofuml 寫的 RemapKey (包在Win2003的resource kit內), 用 右鍵的Alt鍵替代App鍵(因為它找不到PrtSc鍵).
用了一天還是不習慣, 因為Alt也太常用到了, 左右手都會用到Alt, 實在不能沒有它們.
到這裡, 整個工作速度慢的像烏X(tortoise), 還有專案要完成呀!

還是再找, 終於讓我找到 ShaprKeys 我用的是3.5版.

將 Special: PrtSc(E0_37) 指定到 Special; Application(E0_5D) 就把滑鼠右鍵找回來了! 

趕快工作吧 ,沒有藉口了.