Upgrading Microsoft.TypeScript.MSBuild to v7.0.0

Posted July 23, 2026 in asp.net-core typescript msbuild dotnet
Reading time: 2 minutes

Microsoft recently announced the release of TypeScript 7.0, which was quickly followed by the release of the Microsoft.TypeScript.MSBuild v7.0.0 NuGet package. Unfortunately, the upgrade wasn’t completely seamless. Updating my ASP.NET Core projects required two edits to the Web Application’s .csproj file.

After upgrading to v7.0.0, I had two issues:

  • When building in Visual Studio 2026, even though I have a tsconfig.json that specifies a target of ES2020, VS gave me a compilation error telling me that “Option ’target=ES5’ has been removed.”
  • When building in Azure DevOps Pipelines and GitHub Actions, dotnet build was always invoking tsc, even though I had TypeScriptCompileBlocked set in my .csproj

I should tell you that I am by no means an MSBuild expert. I leaned heavily on Claude to find solutions to these issues. If any of these details are inaccurate, please let me know so that I can fix them.

Fixing the target issue

The fix: in a PropertyGroup tag, add a blank TypeScriptTarget tag:

1
2
3
<PropertyGroup>
    <TypeScriptTarget></TypeScriptTarget>
</PropertyGroup>

The Why: I’ll just post Claude’s comment verbatim:

Microsoft.TypeScript.MSBuild 7.0 mirrors a target flag ($(TypeScriptTarget)) onto the tsc command line, even when compiling with “-p tsconfig.json”, and a command-line value overrides tsconfig. Visual Studio’s project system seeds the legacy default TypeScriptTarget=ES5, which TypeScript 7 has removed, so a VS build fails with “Option ’target=ES5’ has been removed.” Forcing this property blank suppresses the flag entirely, letting tsconfig.json’s “target”: “ES2020” be the single source of truth (verified: the tsc command line then omits the target flag)

Fixing the dotnet build in Azure DevOps Pipelines and GitHub Actions issue

The fix: in a PropertyGroup enabled only when running in one of the CI build environments, add an empty TscExe tag.

Azure DevOps Pipelines:

1
2
3
<PropertyGroup Condition="'$(TF_BUILD)' == 'true'">
    <TscExe></TscExe>
</PropertyGroup>

GitHub Actions:

1
2
3
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
    <TscExe></TscExe>
</PropertyGroup>

The Why: Again, from Claude’s comment:

Microsoft.TypeScript.MSBuild 7.0 replaced the old compile targets with a new RunTscCompile target that ignores TypeScriptCompileBlocked entirely (that property now only silences the legacy v6-era targets). RunTscCompile’s own Condition is ‘$(TscExe)’!=’’ AND Exists(’$(TscExe)’), so the only supported way to skip it is to blank out TscExe, which the package docs call out as an intentional override point (“Users can override TscExe in their project file if needed”).

If, like me, you don’t want the TypeScript compiler running in CI build environment, this will prevent it from happening.

Hope this helps.



Comments

comments powered by Disqus