简体   繁体   中英

GIT based asp.net web app fails to deploy to Azure with typescript compile error

I have this asp.net (4.6.2) web application which compiles and runs fine on my local machine.

The project is in a Git repo in VSTS.

I want this site deployed to Azure web sites. So I make a Webapp and set the deployment option to my VSTS Git repo.

This will automatically trigger a deployment... which fails.. with this error:

All packages listed in packages.config are already installed. D:\\home\\site\\repository\\FormBuilder\\Scripts\\typings\\knockout\\knockout.d.ts(335,13): error TS1110: Build: Type expected. [D:\\home\\site\\repository\\FormBuilder\\FormBuilder.csproj] D:\\home\\site\\repository\\FormBuilder\\Scripts\\typings\\knockout\\knockout.d.ts(338,11): error TS1109: Build: Expression expected. [D:\\home\\site\\repository\\FormBuilder\\FormBuilder.csproj] D:\\home\\site\\repository\\FormBuilder\\Scripts\\typings\\knockout\\knockout.d.ts(339,1): error TS1128: Build: Declaration or statement expected. [D:\\home\\site\\repository\\FormBuilder\\FormBuilder.csproj] Failed exitCode=1, command="D:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\MSBuild.exe" "D:\\home\\site\\repository\\FormBuilder\\FormBuilder.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="D:\\local\\Temp\\8d3e9219d2f6f3b";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release;UseSharedCompilation=false /p:SolutionDir="D:\\home\\site\\repository.\\" An error has occurred during web site deployment.

It looks to me like it's compiling my .d.ts files. Don't know why..VS2015 does not do that.

I tried to exclude this file in a tsconfig but that does not work.

How can I make this build succeed?

So the problem is that the Azure build machine is not equipped with typescript 2.0 (yet) and knockout.d.ts uses a 2.0 syntax for something. See the comments below the question.

GitHub issue here

You need to compile type script files before deploying to azure. In deploy.cmd file on azure you can add this code to Compile TypeScript right after the npm packages are installed.

echo Transpiling TypeScript in %DEPLOYMENT_TARGET%...call :ExecuteCmd node %DEPLOYMENT_TARGET%\\node_modules\\typescript\\bin\\tsc -p "%DEPLOYMENT_TARGET%"

You can find the deploy.cmd file on KUDU in site->deployments->tools section.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM