如何在VS2022中调试.NET6项目中的TypeScript静态页面?
- 内容介绍
- 文章标签
- 相关推荐
本文共计413个文字,预计阅读时间需要2分钟。
1. 创建一个空的web项目
2.设计并建立目录结构,包括:
- ts 存放 TypeScript 源文件 - web 为网站根目录 - scripts/js 存放由 TypeScript 生成的 JavaScript 脚本3.index. 为静态网页文件
4.新建 tsconfig.json 配置 TypeScript,并修改内容
1、新建一个空的web项目
2、设计、建好目录结构
其中ts存放typescript源文件,web为网站根目录,scripts/js存放ts生成的js脚本。
index.html为静态网页。
3、新建ts配置文件tsconfig.json,修改内容为:
{ "compilerOptions": { "noImplicitAny": false, "noEmitOnError": true, "removeComments": false, "sourceMap": true, "target": "es5", "outDir": "web/scripts/js"//ts编译出js的输出目录 }, "include": ["ts/**/*"],//ts所在位置。“**/”为任意层级目录,“?”和“*”为一般通配符。 "exclude": [ "node_modules", "wwwroot" ] }
4、修改program.cs,指定web文件夹,并支持静态内容。
本文共计413个文字,预计阅读时间需要2分钟。
1. 创建一个空的web项目
2.设计并建立目录结构,包括:
- ts 存放 TypeScript 源文件 - web 为网站根目录 - scripts/js 存放由 TypeScript 生成的 JavaScript 脚本3.index. 为静态网页文件
4.新建 tsconfig.json 配置 TypeScript,并修改内容
1、新建一个空的web项目
2、设计、建好目录结构
其中ts存放typescript源文件,web为网站根目录,scripts/js存放ts生成的js脚本。
index.html为静态网页。
3、新建ts配置文件tsconfig.json,修改内容为:
{ "compilerOptions": { "noImplicitAny": false, "noEmitOnError": true, "removeComments": false, "sourceMap": true, "target": "es5", "outDir": "web/scripts/js"//ts编译出js的输出目录 }, "include": ["ts/**/*"],//ts所在位置。“**/”为任意层级目录,“?”和“*”为一般通配符。 "exclude": [ "node_modules", "wwwroot" ] }

