簡體   English   中英

如何使用Visual Studio 2010安裝TypeScript

[英]How Can I Install TypeScript with Visual Studio 2010

這是一個很受歡迎的問題,我將為此提供答案。

TypeScript版本0.9.1.1

Typescript 0.9.5+依賴於Microsoft.VisualStudio.Shell.11.0.dll。 因此,這些說明將不再更新。

以下內容僅供教育之用。 請遵守所有許可和再分發要求。 對於TypeScript的早期版本,請參閱此答案的編輯歷史記錄。

  1. 關閉Visual Studio
  2. 輸入Wix工具集
  3. 下載VisualScript 2012版本0.9.1.1的TypeScript ,並將安裝程序可執行文件放在其自己的臨時目錄中。
  4. 在臨時目錄中打開命令窗口。
  5. 執行命令"%wix%\\bin\\dark.exe" -x .\\TypeScriptSetup TypeScriptSetup.0.9.1.1.exe
  6. 轉到目錄。\\ TypeScriptSetup \\ AttachedContainer \\ packages \\ TypeScript_CORE
  7. 執行以下命令

     IF NOT DEFINED ProgramFiles(x86) SET ProgramFiles(x86)=%ProgramFiles% SET VSDir=%ProgramFiles(x86)%\\Microsoft Visual Studio 10.0\\Common7\\IDE SET Devenv=%VSDir%\\devenv.exe 

對於Windows 7用戶

執行命令:

TypeScript_CORE.msi /l* log.txt VS11_EXTENSIONS_DIR="%VSDir%\\Extensions\\Microsoft" VS11_NEWSCRIPTITEMS_DIR="%VSDir%\\NewFileItems" VS11DEVENV="%Devenv%" VS11_TARGETSINSTALLFOLDER="%ProgramFiles(x86)%\\MSBuild\\Microsoft\\VisualStudio\\v10.0\\TypeScript"

對於Windows Vista用戶

您需要使用Wix構建新的安裝程序

  1. 執行命令"%wix%\\bin\\dark.exe" -x .\\TypeScript_CORE TypeScript_Core.msi
  2. (可選)將TypeScript_CORE.wxs復制到TypeScript_CORE.wxs.bak(建議)
  3. 編輯TypeScript_CORE.wxs替換下面顯示的行。 為避免可能的版權問題以及StackOverflow的大小限制,尚未發布整個更新的文件。 我能做的最好的就是發布差異報告。 第一列中的數字是原始文件的行號。 第二列中的數字是編輯文件中的行號。 由於刪除了行,編輯文件中的行號將會更低。
------------------------------------------------------------------------
3           <Product Id="{5A908D89-0620-4CC0-A8B8-2CB4A7B0772C}" Codepage="1252" Language="1033" Manufacturer="Microsoft Corporation" Name="TypeScript for Microsoft® Visual Studio® 2012" UpgradeCode="{F15B62A0-4478-4924-876A-867617EC4B8C}" Version="0.9.1.1">
4               <Package Comments="This installer database contains the logic and data required to install TypeScript for Microsoft® Visual Studio® 2012." Compressed="yes" Description="TypeScript for Microsoft® Visual Studio® 2012" InstallerVersion="500" Languages="1033" Manufacturer="Microsoft Corporation" Platform="x86" />
    3       <Product Id="{5A908D89-0620-4CC0-A8B8-2CB4A7B0772C}" Codepage="1252" Language="1033" Manufacturer="Microsoft Corporation" Name="TypeScript for Microsoft® Visual Studio® 2010" UpgradeCode="{F15B62A0-4478-4924-876A-867617EC4B8C}" Version="0.9.1.1">
    4           <Package Comments="This installer database contains the logic and data required to install TypeScript for Microsoft® Visual Studio® 2010." Compressed="yes" Description="TypeScript for Microsoft® Visual Studio® 2010" InstallerVersion="405" Languages="1033" Manufacturer="Microsoft Corporation" Platform="x86" />
------------------------------------------------------------------------
------------------------------------------------------------------------
15(delete)              <CustomAction Id="VS11_CAUpdateConfig" Property="VS11DEVENV" ExeCommand="/updateConfiguration" Return="ignore" Execute="deferred" Impersonate="no" />
16(delete)              <CustomAction Id="VWD11_CAUpdateConfig" Property="VWD11EXPRESS" ExeCommand="/updateConfiguration" Return="ignore" Execute="deferred" Impersonate="no" />
------------------------------------------------------------------------
------------------------------------------------------------------------
222                                 <Directory Id="MSBuild_Microsoft_VisualStudio_11" Name="v11.0">
    220                             <Directory Id="MSBuild_Microsoft_VisualStudio_11" Name="v10.0">
------------------------------------------------------------------------
------------------------------------------------------------------------
293             <Feature Id="TypeScriptInstallation" Level="1" Title="TypeScript for Microsoft&® Visual Studio® 2012 Setup">
    291         <Feature Id="TypeScriptInstallation" Level="1" Title="TypeScript for Microsoft&® Visual Studio® 2010 Setup">
------------------------------------------------------------------------
------------------------------------------------------------------------
427(delete)             <Property Id="WixPdbPath" Value="D:\nightly\release-0.9.1.1\srcSetup\wix\outs\x86ret\enu\cooked\TypeScript_CORE_net.wixpdb" />
------------------------------------------------------------------------
------------------------------------------------------------------------
663                 <ProgressText Action="CAIsVSRunning">Checking if Microsoft® Visual Studio® 2012 is running</ProgressText>
    660             <ProgressText Action="CAIsVSRunning">Checking if Microsoft® Visual Studio® 2010 is running</ProgressText>
------------------------------------------------------------------------
------------------------------------------------------------------------
712                     <Control Id="VSRunningStatus" Type="Text" X="25" Y="110" Width="320" Height="110" Text="Microsoft® Visual Studio® 2012 is running, It is recommended that you close it before proceeding [ProductName] Setup." TabSkip="yes" />
    709                 <Control Id="VSRunningStatus" Type="Text" X="25" Y="110" Width="320" Height="110" Text="Microsoft® Visual Studio® 2010 is running, It is recommended that you close it before proceeding [ProductName] Setup." TabSkip="yes" />
------------------------------------------------------------------------
------------------------------------------------------------------------
739(delete)                     <Control Id="LaunchScreenAgreeLine" Type="Hyperlink" X="25" Y="138" Width="320" Height="14" Text="You must agree to the <a href="[EulaURLName]">License Terms</a> before you can install TypeScript" TabSkip="yes">
740(delete)                         <Condition Action="hide">Installed</Condition>
741(delete)                     </Control>
------------------------------------------------------------------------
------------------------------------------------------------------------
799                 <Custom Action="WindowsFolder_x86_VC.F9D0B380_EB85_31D4_96AC_C6CB40086A55" Sequence="1" />
    793             <Custom Action="WindowsFolder_x86_VC.F9D0B380_EB85_31D4_96AC_C6CB40086A55" Sequence="2" />
------------------------------------------------------------------------
------------------------------------------------------------------------
803(delete)                 <Custom Action="VS11_CAUpdateConfig" Sequence="6598">VS11DEVENV</Custom>
804(delete)                 <Custom Action="VWD11_CAUpdateConfig" Sequence="6599">VWD11EXPRESS</Custom>
------------------------------------------------------------------------
------------------------------------------------------------------------
830                 <InstallFinalize Sequence="6600" />
    822             <InstallFinalize Sequence="6500" />
------------------------------------------------------------------------
------------------------------------------------------------------------
834                 <Custom Action="SystemFolder_x86_VC.F9D0B380_EB85_31D4_96AC_C6CB40086A55" Sequence="1" />
    826             <Custom Action="SystemFolder_x86_VC.F9D0B380_EB85_31D4_96AC_C6CB40086A55" Sequence="2" />
------------------------------------------------------------------------
------------------------------------------------------------------------
860                 <Custom Action="SystemFolder_x86_VC.F9D0B380_EB85_31D4_96AC_C6CB40086A55" Sequence="3" />
    852             <Custom Action="SystemFolder_x86_VC.F9D0B380_EB85_31D4_96AC_C6CB40086A55" Sequence="4" />
------------------------------------------------------------------------
------------------------------------------------------------------------
874                 <Custom Action="WindowsFolder_x86_VC.F9D0B380_EB85_31D4_96AC_C6CB40086A55" Sequence="3" />
    866             <Custom Action="WindowsFolder_x86_VC.F9D0B380_EB85_31D4_96AC_C6CB40086A55" Sequence="4" />
------------------------------------------------------------------------
------------------------------------------------------------------------
889                 <Custom Action="WindowsFolder_x86_VC.F9D0B380_EB85_31D4_96AC_C6CB40086A55" Sequence="3" />
    881             <Custom Action="WindowsFolder_x86_VC.F9D0B380_EB85_31D4_96AC_C6CB40086A55" Sequence="4" />
------------------------------------------------------------------------
  1. 執行命令"%wix%\\bin\\candle.exe" TypeScript_CORE.wxs
  2. 執行命令"%wix%\\bin\\light.exe" -o TypescriptVista TypeScript_CORE.wixobj
  3. 執行命令TypeScriptVista.msi /l* log.txt VS11_EXTENSIONS_DIR="%VSDir%\\Extensions\\Microsoft" VS11_NEWSCRIPTITEMS_DIR="%VSDir%\\NewFileItems" VS11DEVENV="%Devenv%"

配置文件

現有項目需要將以下元素添加到項目文件的底部。 請注意在BeforeBuild元素之前添加的元素。

  <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
    <TypeScriptTarget>ES3</TypeScriptTarget>
    <TypeScriptIncludeComments>true</TypeScriptIncludeComments>
    <TypeScriptSourceMap>true</TypeScriptSourceMap>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)' == 'Release'">
    <TypeScriptTarget>ES3</TypeScriptTarget>
    <TypeScriptIncludeComments>false</TypeScriptIncludeComments>
    <TypeScriptSourceMap>false</TypeScriptSourceMap>
  </PropertyGroup>
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
     Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">  
  </Target>
  <Target Name="AfterBuild">
  </Target>-->

雜項

在“ 程序和功能”列表中不再顯示TypeScript之前,可能需要執行兩次卸載。 首次卸載后,按F5刷新應用程序列表。 卸載后,某些文件可能仍然存在。

TypeScript_CORE.msi中的調試器路徑還有其他自定義屬性。 我假設在這一點上VS 2010與腳本調試不兼容回到不同的源文件。 但是,其他人可能希望嘗試使其正常工作。 其他自定義屬性名稱為:VS11_DEBUGGER_DIR,VS11_DEBUGGER_X64_DIR和VS11_REMOTEDEBUGGER_DIR

還有其他自定義屬性可以使用可視Web開發人員或可視Web開發人員表達中的一個或兩個來安裝。 我無法使用這些產品測試安裝。 與此安裝相關的TypeScript_CORE.msi文件中的自定義屬性為:VWD11_EXTENSIONS_DIR,VWDExpress11和VWD11_NEWSCRIPTITEMS_DIR

功能

  • 新項目類型和項目類型可用。
  • Tools \\ Options菜單下的TextEditor \\ TypeScript部分。
  • Intellisense編輯.ts文件。
  • .js文件是在構建或保存時構建的(當在文本編輯器選項中設置了保存時構建)。
  • .js文件在解決方案資源管理器中顯示為.ts文件的子文件,但保存在與.ts文件相同的路徑中。 (v 0.9.1.1默認情況下不包括項目中的.js文件)
  • 發布時不包括.ts文件,僅包含.js文件。
  • .ts文件有自己的圖標,並與visual studio相關聯。

修訂記錄

  • TypeScript版本0.9.1.1的更新
  • 針對TypeScript版本0.8.3.1進行了更新
  • 修復了丟失指令以復制MSBUILD目錄為0.8.3

截圖

項目模板截圖編輯截圖Solution Explorer截圖TypeScript選項截圖FileIcon截圖

按照Richard Collette的Windows 7說明操作后 ,安裝程序應該產生以下錯誤,然后完成:

無效的命令行。 未知的開關:updateConfiguration。 使用:devenv [solutionfile | projectfile | anyfile.ext] [開關]

如果這導致任何問題,運行以下命令可能會有所幫助

"%Devenv%" /Setup

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM