New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Azure Web App doesn't build typescript files in ASP.NET Core project #2156
Comments
Kudu itself doesn't know anything about TypeScript files. Instead, it relies on msbuild to do the right this. Here, you can look at the deployment script that gets generated for your App. You can download it from Kudu Console, in the Tools menu. The key part looks like this (trimmed a bit to focus on essential):
If you were to run the same steps on your own machine, presumably the same thing would happen and typescript files would not get built either. So the question becomes: is there an issue with your xproj file that causes this? What happens if you go to VS and do a local Publish to File System? If you get the same files as with Kudu, then we will have confirmed that the issue is not directly related to Kudu. |
When I Publish this project to File System I still get my Typescript files compiled in single JS file (wwwroot/app/app.js), even if I remove "compileOnSave: true" option from tsconfig.json. |
I guess the key is to figure out what you'd have to run from the command line on your local machine to turn your source repo into a read-to-run artifact folder. @vijayrkn: do you know why Typescript files don't get processed with the build/publish sequence above? And why does it work when doing a Publish to File System? |
File System publish also triggers the same target as mentioned in step (3) above. So, it should ideally be the same behavior in both cases. While running the file system publish, VS should print the "dotnet publish" command executed. Can you compare the "dotnet publish" command in the case of file system publish and below to see if there are any differences?
|
I've tried to run "dotnet build" and it indeed hasn't compiled Typescript files. I guess, there is something with Visual Studio that it compiled TS files before "dotnet build" or before "dotnet publish", though I can't tell this by looking to a log (see below). Any ideas on what has triggered compilation or what can I do to trigger it on Azure? VS Build log (there is something with encoding, but I guess that there is just text "Copying file ..." because compiled TS file is already there): |
This is the typescript target used for compiling. It seems like for some reason, this is not getting imported while trying to build from commandline (2nd step above) but it is imported from VS. Looking at the repro project so see what is going wrong. |
I tried running build step 2 & 3 from above from commandline and it is working
This means the agent machine running the build and publish are somehow missing all the required typescript components. |
I do see If you go to the Kudu Console for any Web App, you can look around at what's installed. |
The VS version is right. Let me verify what typescript component is missing. |
Compile typescript target is getting skipped.
On the machine where I verified it working had typescript 2.0 while Kudu has 1.5 Log where it works
|
Got it, so we're missing TypeScript 2.0. We'll work to get it up there. Thanks Vijay! As an aside, it would be nicer if that caused a build failure instead of quietly doing nothing :) |
The webproject system just imports the typesscript targets and typesscript targets take care of compiling it. I agree it would be nice to get some errors in scenarios like these. May be we should create a bug for typescript - https://github.com/Microsoft/TypeScript I don't know typescript much to know if the app is using ts features available only in 1.5+ or it is something else. |
So look at sample project https://github.com/Dia6lo/LongStoryShort, what/where are the files that are missing when deploying on Azure? This will help us verify that it works correctly after we put in a fix. |
@vijayrkn I can share details about my app. At least that it uses TS 2.0 features |
Sure, any test repo such that it fails without the fix and works with the fix would be perfect to help validate. |
Once it is fixed, there should be this file present - wwwroot/app/app.js. |
@ahmelsayed is going to look at this one. |
Possibly related issue: http://stackoverflow.com/questions/39790290/git-based-asp-net-web-app-fails-to-deploy-to-azure-with-typescript-compile-error But I'm still rather confused. When I deploy using Kudu, I don't even get a |
Looks like there are more things we're missing. We'll investigate. |
I've come up with more simple repro: https://github.com/Dia6lo/TSTest |
Thanks @Dia6lo I'm taking a look at this now! |
There is a TypeScript compiler bug on Windows Server 2012, which is what we use. I opened microsoft/TypeScript#11339 |
I have the same issue, gitlab based deployment, I have the correct tools version in the csproj. When i see the errors (which i don't get on my local machine)
Seems that its the typescript compiler version? navigated to Is there a workaround to manually get typescript v2 installed? or a way to skip the typescript compile, and then run a npm based typescript compile (prior to typescript being installed in slots automatically?) Hope that makes sense? |
We're waiting on the typescript team to give us a build of the compiler that works on Windows Server. microsoft/TypeScript#11339 was closed and is marked for 2.0.6. At the moment even if you get the v2 compiler on the machine it just won't work. |
is there some workaround then to tell the csproj not to compile the typescript, and do it via the npm compiler, that should work as it seems to work on my development windows2012 server. |
You can try this, then download your deployment script by going to Then after the msbuild step, you can add.
The way the custom build script works is by calling msbuild and setting the output to a temp folder, then copying the result from that temp folder to your app root |
thanks for that suggestion, but it would require me to somehow have two copies of my csproj as i want it to precompile Typescript when developing, just wanted it to skip it when its deploying in an azure slot (until the fixed version of typescript is available). Think ill use webpublishing until the typescript issue is resolved. |
Cool, appreciate this is just released, but :
|
I deployed my angular2 app on Azure today. Even though my deployment was clean but still dont see any js files getting generated. All I have is .ts files. I am getting error "Error app/main.js 404 Not Found" on my console. See my issue: http://stackoverflow.com/questions/40231071/error-app-main-js-404-not-found-on-azure |
@VishalGulati I would assume that typescript hasn't been updated on azure yet. I've just checked in the console on my slot and in |
As I said a above i checked in the console. |
%websitename%.scm.azurewebsites.net |
Thanks @tbertenshaw, @davidebbo can i build the js files on local and upload the same on git along with .ts files till this issue is resolved? Will that work? Is that a legitimate way? |
@tbertenshaw Your scenario (using TypeScript in csproj) should be fixed now. We deployed TypeScript 2.0.6 to VMs. @Dia6lo This however won't quite fix your scenario (xproj based deployment) because we are still missing some target files needed by msbuild to build ts in these projects. That's on track to be deployed in about 3 weeks. |
Good to know that, thanks. |
@ahmelsayed Thanks for the update. I tried deploying my angular2 project on Azure but still dont see the ts files being compiled to js. However if I use this command in package.json then the ts files are compiled to js but with errors and deployment is not successful. Command to be used in scripts section:
However it gives a lot of error. Please see the issue I raised for this here : Azure/azure-sdk-for-node#1946 . Looking forward to hear from you. TIA. |
|
Ok now typescript v2.* is installed the site succeeds in deploying. However with a few strange issues which didn't occur previously (when it used typescript 1)
I did see these two lines (I've omitted the typescript files)
|
Is this different from running msbuild on your local machine? I think msbuild just doesn't copy these directories when outputing your build result so we don't copy them. @vijayrkn would know more how to get msbuild to work. |
The typescript build is certainly different to my local build. The local build does use the I'm trying to use
Error |
that's odd. Do you have a custom build locally, or does msbuild use tsconfig? I thought msbuild skips tsconfig if you are using a csproj I actually don't think the node_modules is under
or if you want to remove extra files in the destination, you can use
note: I haven't tried these commands :) if you have a sample repo that doesn't work I can give that a try |
@ahmelsayed the last error was with my syntax of mv ( tested it in powershell kudu console, but its evident that it runs using the other console. (there is a node modules as i have already customised my deploy.cmd to resolve the issues above I'm installing npm,bower and typings to Still not sure why/how to get the deploy process to run |
This should be fully fixed now. @Dia6lo your repo should be working as is. |
I can confirm that my repo (https://github.com/Dia6lo/LongStoryShort) is now processed by TSC, but I still get an error about TypeScript version. Text of this error is: "error TS5023: Build: Unknown compiler option 'strictNullChecks'." which means that compiler used is lower than 2.0 version. @ahmelsayed, should I create new issue about it or reopen this one? |
Any updates? |
@ahmelsayed has been out but can take a look after he's back. |
It seems that we have You can override that manually by setting |
I've set |
yep I saw that yesterday but was hoping it might be unrelated error I ran into. It's weird that it's complaining about a file that's clearly there. I'll take another look today. |
okay that turned out to be just needing a {
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-preview2-1-003177"
}
} |
@ahmelsayed tyvm, that worked. I have last couple of questions:
|
Bump |
|
I'm not sure about the current state of this issue, and I don't have the mentioned use-case anymore, so I'm closing it. Feel free to reopen. |
Original question: http://stackoverflow.com/questions/39725656/azure-web-app-doesnt-build-typescript-files
Repo I used: https://github.com/Dia6lo/LongStoryShort
Web app to which I deployed: http://longstoryshort.azurewebsites.net/
The text was updated successfully, but these errors were encountered: