Include TypeScript files in azure git deploy

六月ゝ 毕业季﹏ 提交于 2019-12-19 07:24:12

问题


I'm trying to include TypeScript files in my automatic git deploy so I can showcase code for a framework I'm building. However, whenever I deploy to azurewebsites the deployments do not include the TypeScript files.

Site in question: http://endgate-samples.azurewebsites.net/Samples/AnimatedSprites/

What I've tried:

  1. Copy all TypeScript files to output folder by setting TypeScript properties to "Copy Always". Issue with this is that I need to change the references to all the files (do not want to do this).

  2. MSBuild pipeline. This works for file system deploy but not web deploy... https://github.com/NTaylorMullen/EndGate/blob/master/EndGate/samples/EndGate.Core.JS.Samples/EndGate.Core.JS.Samples.csproj#L896-L909.

  3. Manual publish to FTP endpoint (works like a charm), but not automatic. Also requires the msbuild pipeline (#2)

What am I doing wrong or what can I do (that I haven't tried) to get my TypeScript files deploying automagically?


回答1:


So after a lot of work it turns out that with the msbuild pipeline piece (#2) it will actually deploy the typescript files. One thing that I was missing was adding the appropriate mime type to handle typescript files.

It turns out by default IIS won't serve the TypeScript files correctly.

To add the Custom mime type I did:

<system.webServer>
    <staticContent>
      <remove fileExtension=".ts"/>
      <mimeMap fileExtension=".ts" mimeType="text/plain" />
    </staticContent>
</system.webServer>

It's important that we remove the existing .ts mime type (if there is one) prior to adding the mime type. If you deploy onto a machine that has the .ts mime type already and you do not remove prior to adding, it will pretty much destroy your existing mappings and will fail to serve any css, js files etc.

This has been a battle but I finally got it working, hope this helps somebody else in the future!



来源:https://stackoverflow.com/questions/16601545/include-typescript-files-in-azure-git-deploy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!