msbuild not compiling typescript in docker build, but works in azure pipeline

I’m in the process of attempting to containerize an asp.net .net framework web application.

I’ve mostly got it working. However I’ve found that for some reason it’s not compiling my .ts files.

The build works correctly in an Azure DevOps Pipeline, but not in docker.

When I check the logs for the Azure DevOps build, I can see the following…

Processing resource file "My ProjectResources.resx" into "objProdResources.resources".
PreComputeCompileTypeScriptWithTSConfig:
C:Program Files (x86)Microsoft SDKsTypeScript.1tsc.exe   --project "D:asMyProjecttsconfig.json" --listEmittedFiles --listFiles --noEmit
CompileTypeScriptWithTSConfig:
C:Program Files (x86)Microsoft SDKsTypeScript.1tsc.exe   --project "D:asMyProjecttsconfig.json" --listEmittedFiles
WebCompile:
...

However in my docker build, I’m seeing…

Processing resource file "My ProjectResources.resx" into "objProdResources.resources".
WebCompile:
...

So it’s obviously skipping the typescript bit.

I’m not sure what I’m supposed to do to make this run, as in Azure Devops it seemed to work automatically without me doing any extra configuration.

This is the msbuild command that Azure DevOps Pipeline is running…

"C:Program Files (x86)Microsoft Visual Studio17EnterpriseMSBuild.0Binamd64msbuild.exe" "D:asMyProject.sln" /nologo /nr:false /dl:CentralLogger,"D:a_tasksMSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824.166.0ps_modulesMSBuildHelpersMicrosoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId=|SolutionDir=D:as"*ForwardingLogger,"D:a_tasksMSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824.166.0ps_modulesMSBuildHelpersMicrosoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /m /p:MvcBuildViews=true /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="D:aa" /p:platform="any cpu" /p:configuration="prod"

And this is what I’m using in my Dockerfile

msbuild ./MyProject.sln -target:MyProject -p:TargetFrameworkVersion=v4.7.2  -p:Configuration=prod -p:DeployIisAppPath='Default Web Site' -m -p:MvcBuildViews=true -p:DeployOnBuild=false -p:PackageAsSingleFile=true /p:OutDir=/artifacts /t:Package

Obviously the Azure DevOps command has a lot of extra stuff declared, but I’m not sure what specifically in this causes the typescript to build, or if it’s even related to do with the msbuild options.

My Dockerfile uses the following base image…

mcr.microsoft.com/dotnet/framework/sdk:4.7.2

Just in case it’s relevant, this is my tsconfig.json

{
  "compilerOptions": {
    "typeRoots": ["scripts/typings"],
    "noImplicitAny": false,
    "noEmitOnError": true,
    "removeComments": false,
    "sourceMap": true,
    "target": "es5",
    "module": "none"
  }
}

If there’s any other information I need to include to make the question make sense, let me know. My project file is much too large to include, but if there are bits that would be relevant, I can add them.

Source: StackOverflow