网页表单的打字稿 [英] typescript for web forms

查看:17
本文介绍了网页表单的打字稿的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

网络表单支持打字稿吗?

Is typescript supported on web forms?

我有一个现有的 asp.net 4.5 web 表单项目,其中 typescript 似乎无法正常工作.我无法创建新文件,但即使我将现有文件重命名为 .ts,它似乎也不起作用.没有构建,没有智能,什么都没有!

I have an existing asp.net 4.5 web forms project where typescript does not seem to be working. I cannot create a new file, but even if I rename an existing to .ts it does not seem to be working. No build, no intellisense, nothing!

推荐答案

找到了我的问题的答案:

Found the answers to my problems:

  1. 我试图在添加新项目"对话框的 Web 文件夹中找到Typescript 文件",尽管它位于Visual C#"文件夹中......为什么?

  1. I was trying to find "Typescript file" in Web folder of the "Add New Item" dialog, although it is in the "Visual C#" folder ..... Why?

除非您在项目中使用添加新项目"创建了 .ts 文件,否则文件属性构建操作"上的TypeScriptCompile"选项不可用和它引发了一个例外.创建第一个文件后,找到此选项,可以手动将其设置为 .ts 文件.

Unless you have a .ts file created with "Add New Item" in your project, the option "TypeScriptCompile" on the "Build Action" of the file properties is not available and it raises an exception. After the first file is created, then you find this option and can manually set it to a .ts file.

添加文件"选项中不提供Typescript 文件"选项,除非您在项目中使用添加新项目"创建了 .ts 文件并且一个脚本"文件夹(如果您要添加此文件的文件夹的名称不同,则此选项将不可用).当然,您可以从添加新项目"添加 .ts 文件.

The option "Typescript file" is not available in the "Add File" options unless you have a .ts file created with "Add New Item" in your project and you are in a "Scripts" folder (if you name differently the folder where you want to add this file, this option wont be available). Of course you can add a .ts file from "Add New Item".

您不能轻松自己创建 ts 文件,您必须使用菜单中的新建 Typescript 文件".那是因为:A) 文件的代码页 不能是 Unicode(我想解决这个问题好几个小时).如果你尝试用 tsc 编译一个 unicode .ts 文件,什么都不会发生!!在我将 .ts 文件保存为希腊语(Windows)后 - 就我而言 - 一切正常!B) 必须为每个文件设置才能正常工作的 .csproj 属性非常复杂.(我试图从 .js 文件开始创建一个 .ts 文件,然后重命名......然后使用 .csproj)

You cannot easily create a ts file by your own, you must use "New Typescript file" from menu. That is because: A) The code page of the file must not be Unicode (I was trying to figure out that problem for many hours). if you try to compile a unicode .ts file with tsc, nothing happens!! After I saved the .ts file as Greek(Windows) - in my case-, everything worked fine! B) The .csproj properties that must be set for each file to work correctly are quite complex. (I was trying to create a .ts file starting from a .js file and renaming afterwards.... and then playing with .csproj)

这篇关于网页表单的打字稿的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆