projectkudu / kudu

Kudu is the engine behind git/hg deployments, WebJobs, and various other features in Azure Web Sites. It can also run outside of Azure.
Apache License 2.0
3.12k stars 654 forks source link

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

Closed floreseken closed 7 years ago

floreseken commented 7 years ago

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?

I've made de repo to reproduce this: Deploytest this is a simple asp.net template, added knockout typings with nuget, reference typings in a simple ts class, and it fails.

davidebbo commented 7 years ago

The root of the issue is that we don't have TypeScript 2.0 yet on the build machine. So it's falling back on an older version, which breaks because your .ts file uses new 2.0 syntax (e.g. here).

We are working on making 2.0 available. See also #2156

jmarbutt commented 7 years ago

@davidebbo do you have an eta on making TypeScript 2.0 work for azure deploys?

davidebbo commented 7 years ago

Right now, 2.0 is broken because of https://github.com/Microsoft/TypeScript/issues/11339. It sounds like they have it fixed in daily builds, but I'm not sure when that'll turn into an official release we can use.

jmarbutt commented 7 years ago

Is there a workaround for now to get it to work? I tried rolling back the TypeScriptTool version in our project file and it didn't fix it.

davidebbo commented 7 years ago

You can use an older TypeScript (in fact that's already what's happening, as it uses the latest available), but the problem is that the specific .ts file you're trying to build uses some syntax that's new to 2.0 (link in my entry above). If you can avoid new syntax, things should work.

jmarbutt commented 7 years ago

Yeah I don't have anything specific to 2.0, I am not sure why it is not auto compiling. Do I still need a deploy script?

davidebbo commented 7 years ago

Not sure I follow that last question. You do have a typescript file that uses new syntax (here). That's why it's failing with older typescript compilers.

swarvette commented 7 years ago

Hi David,

Please can you provide an update on this one with regards the official release that you can use?

Thanks,

Dave

davidebbo commented 7 years ago

@swarvette see https://github.com/Microsoft/TypeScript/issues/11339 for latest. It looks like they now think it's a different issue from what they thought, and may not have a fix at all yet. Feel free to ask for status there from the TypeScript experts.

ahmelsayed commented 7 years ago

@floreseken @jmarbutt @swarvette TypeScript 2.0 (2.0.6) should be on the VMs now

floreseken commented 7 years ago

Thanks!