zoukankan      html  css  js  c++  java
  • typescript 自动编译 生成js文件

    项目文件

    <?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <Import Project="$(MSBuildExtensionsPath)$(MSBuildToolsVersion)Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)$(MSBuildToolsVersion)Microsoft.Common.props')" />
      <PropertyGroup>
        <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
        <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
        <ProductVersion>
        </ProductVersion>
        <SchemaVersion>2.0</SchemaVersion>
        <ProjectGuid>{942BF143-5F6F-407C-B112-F598D25E001E}</ProjectGuid>
        <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
        <OutputType>Library</OutputType>
        <TypeScriptToolsVersion>1.0</TypeScriptToolsVersion>
        <AppDesignerFolder>Properties</AppDesignerFolder>
        <RootNamespace>website</RootNamespace>
        <AssemblyName>website</AssemblyName>
        <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
        <UseIISExpress>true</UseIISExpress>
        <IISExpressSSLPort />
        <IISExpressAnonymousAuthentication />
        <IISExpressWindowsAuthentication />
        <IISExpressUseClassicPipelineMode />
      </PropertyGroup>
      <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
        <DebugSymbols>true</DebugSymbols>
        <DebugType>full</DebugType>
        <Optimize>false</Optimize>
        <OutputPath>bin</OutputPath>
        <DefineConstants>DEBUG;TRACE</DefineConstants>
        <ErrorReport>prompt</ErrorReport>
        <WarningLevel>4</WarningLevel>
      </PropertyGroup>
      <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
        <DebugType>pdbonly</DebugType>
        <Optimize>true</Optimize>
        <OutputPath>bin</OutputPath>
        <DefineConstants>TRACE</DefineConstants>
        <ErrorReport>prompt</ErrorReport>
        <WarningLevel>4</WarningLevel>
      </PropertyGroup>
      <ItemGroup>
     
        <Reference Include="Microsoft.CSharp" />
        <Reference Include="System.EnterpriseServices" />
      </ItemGroup>
      <ItemGroup>

        <Content Include="ValidateCode.aspx" />
        <Content Include="Web.config">
          <SubType>Designer</SubType>
        </Content>
      </ItemGroup>
      <ItemGroup>
        <Compile Include="Global.asax.cs">
          <DependentUpon>Global.asax</DependentUpon>
        </Compile>
        <Compile Include="index.aspx.cs">
          <DependentUpon>index.aspx</DependentUpon>
          <SubType>ASPXCodeBehind</SubType>
        </Compile>
        <Compile Include="index.aspx.designer.cs">
          <DependentUpon>index.aspx</DependentUpon>
        </Compile>
        <Compile Include="Login.aspx.cs">
          <DependentUpon>Login.aspx</DependentUpon>
          <SubType>ASPXCodeBehind</SubType>
        </Compile>
        <Compile Include="Login.aspx.designer.cs">
          <DependentUpon>Login.aspx</DependentUpon>
        </Compile>
        <Compile Include="PropertiesAssemblyInfo.cs" />
        <Compile Include="ValidateCode.aspx.cs">
          <DependentUpon>ValidateCode.aspx</DependentUpon>
          <SubType>ASPXCodeBehind</SubType>
        </Compile>
        <Compile Include="ValidateCode.aspx.designer.cs">
          <DependentUpon>ValidateCode.aspx</DependentUpon>
        </Compile>
      </ItemGroup>
      <ItemGroup>
        <None Include="Web.Debug.config">
          <DependentUpon>Web.config</DependentUpon>
        </None>
        <None Include="Web.Release.config">
          <DependentUpon>Web.config</DependentUpon>
        </None>
      </ItemGroup>
      <ItemGroup>
        <Folder Include="ico" />
        <Folder Include="JSTemplete" />
        <Folder Include="log" />
      </ItemGroup>
      <PropertyGroup>
        <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
        <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)MicrosoftVisualStudiov$(VisualStudioVersion)</VSToolsPath>
      </PropertyGroup>
      <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
        <TypeScriptTarget>ES5</TypeScriptTarget>
        <TypeScriptRemoveComments>false</TypeScriptRemoveComments>
        <TypeScriptSourceMap>true</TypeScriptSourceMap>
        <TypeScriptModuleKind>AMD</TypeScriptModuleKind>
      </PropertyGroup>
      <PropertyGroup Condition="'$(Configuration)' == 'Release'">
        <TypeScriptTarget>ES5</TypeScriptTarget>
        <TypeScriptRemoveComments>true</TypeScriptRemoveComments>
        <TypeScriptSourceMap>false</TypeScriptSourceMap>
        <TypeScriptModuleKind>AMD</TypeScriptModuleKind>
      </PropertyGroup>
      <Import Project="$(VSToolsPath)TypeScriptMicrosoft.TypeScript.targets" Condition="Exists('$(VSToolsPath)TypeScriptMicrosoft.TypeScript.targets')" />
      <Import Project="$(MSBuildBinPath)Microsoft.CSharp.targets" />
      <Import Project="$(VSToolsPath)WebApplicationsMicrosoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
      <Import Project="$(MSBuildExtensionsPath32)MicrosoftVisualStudiov10.0WebApplicationsMicrosoft.WebApplication.targets" Condition="false" />
      <ProjectExtensions>
        <VisualStudio>
          <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
            <WebProjectProperties>
              <UseIIS>True</UseIIS>
              <AutoAssignPort>True</AutoAssignPort>
              <DevelopmentServerPort>0</DevelopmentServerPort>
              <DevelopmentServerVPath>/</DevelopmentServerVPath>
              <IISUrl>http://localhost:31620/</IISUrl>
              <NTLMAuthentication>False</NTLMAuthentication>
              <UseCustomServer>False</UseCustomServer>
              <CustomServerUrl>
              </CustomServerUrl>
              <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
            </WebProjectProperties>
          </FlavorProperties>
        </VisualStudio>
      </ProjectExtensions>
      <!-- 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>
      -->
    </Project>

    注意的部分

      <TypeScriptToolsVersion>1.0</TypeScriptToolsVersion>  使用1.0版本的ts

    <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
        <TypeScriptTarget>ES5</TypeScriptTarget>
        <TypeScriptRemoveComments>false</TypeScriptRemoveComments>
        <TypeScriptSourceMap>true</TypeScriptSourceMap>
        <TypeScriptModuleKind>AMD</TypeScriptModuleKind>
      </PropertyGroup>
      <PropertyGroup Condition="'$(Configuration)' == 'Release'">
        <TypeScriptTarget>ES5</TypeScriptTarget>
        <TypeScriptRemoveComments>true</TypeScriptRemoveComments>
        <TypeScriptSourceMap>false</TypeScriptSourceMap>
        <TypeScriptModuleKind>AMD</TypeScriptModuleKind>
      </PropertyGroup>
      <Import Project="$(VSToolsPath)TypeScriptMicrosoft.TypeScript.targets" Condition="Exists('$(VSToolsPath)TypeScriptMicrosoft.TypeScript.targets')" />

    以上的代码就是差别的地方

    其实最简单的办法,就是安装完相关的文件后, 新建一个ts的项目(ts类型项目会自动生成js文件)。 然后比较和普通网站项目的不同 (*.csproj文件),添加相关内容就行。

  • 相关阅读:
    uva 10561 sg定理
    二进制下 求分数化小数的循环节问题
    zoj 2562 反素数
    uva 11916 解模方程a^x=b (mod n)
    Android 组件化方案探索与思考
    2018谷歌I/O开发者大会8大看点汇总 新品有哪些
    Glide高级详解—缓存与解码复用
    Android性能优化:手把手带你全面实现内存优化
    Android几种强大的下拉刷新库
    Android app 在线更新那点事儿(适配Android6.0、7.0、8.0)
  • 原文地址:https://www.cnblogs.com/wang2650/p/3733878.html
Copyright © 2011-2022 走看看