typescript-go icon indicating copy to clipboard operation
typescript-go copied to clipboard

TypeScript for .Net Projects

Open joj opened this issue 2 weeks ago • 0 comments

Overview

We heard from people wanting to try TypeScript 7 in their .Net Projects. We're actively working on updating the Microsoft.MSBuild.TypeScript package to support TypeScript 7. In the meantime, I have created a new targets file you can use to get started now.

How to Use it

  1. Place this targets file next to your solution. Rename to Directory.Build.targes or if you already have a Directory.Build.targets file, you can rename to something else and import it directly in your csproj.
  2. Install tsgo globally from npm (you can also get it from your own build):
npm install -g tsgo
  1. Configure the TsgoExe property in your project file. The sample uses the default location, but your configuration may be different:
<PropertyGroup>    
	<TsgoExe>$(UserProfile)\AppData\Roaming\npm\node_modules\@typescript\native-preview\node_modules\@typescript\native-preview-win32-x64\lib\tsgo.exe</TsgoExe>
</PropertyGroup>
  1. That's it! TS files will be compiled as part of your build process

Known Issues

  • The TypeScript nuget includes Language Services. This approach will not replace that functionality. If you want to try TypeScript 7 for Language Services in VS, you can go to Tools->Options and find "Enable JavaScript/TypeScript Native Language Service Preview" in Preview Features.
  • This targets files only supports building loose .ts files or tsconfig.json based projects. If using tsconfig.json, it must be in the same folder as the project file.
  • Cleaning behavior is only supported when using loose .ts files.

Feedback

Please provide feedback! For feedback on Language Services in VS, use Help->Send Feedback->Report a Problem. For build related feedback, please open an issue on github.com/microsoft/typescript-go.

joj avatar Dec 10 '25 00:12 joj