Brosteins

Developers, Technology Evangelists, Bros.

Publishing Your Typescript Project to Azure

So you want to deploy your new Typescript web application to Windows Azure using the publish option within Visual Studio but when you preview the files you notice that the Javascript files created from created when you built your project are missing.  Unfortunately Typescript has a few kinks to work out with its integration and this is one of them.

image

The Javascript files are missing because technically they are not added to your project.  One work around would be to add them to your project, however, if you are using source control (shame on you if you are not) the Typescript compiler will not check out the files and overwrite them automatically during builds and fail to update them.

Another solution to the problem is to manually add them to the project by editing the project file.  To do this right click on your project and select unload.  Then right click on the unloaded project and select edit YourProject.csproj.  You should see a section that looks like the following:

<ItemGroup>
     <Content Include="app.css" />
     <Content Include="index.html" />
     <Content Include="web.config" />
</ItemGroup>
<ItemGroup>
   <TypeScriptCompile Include="app.ts" />

</ItemGroup>

We are going to add lines to one of the item groups to manually include our .js files.  The result will look something like:

<Content Include=”*.js” />

If you can include as many lines and wildcards as needed depending on how how your application is structured.  Now right click and reload your project, build, and publish to Azure again!

Share

2 comments for “Publishing Your Typescript Project to Azure

  1. Avatar
    Ramkumar
    April 6, 2018 at 8:42 am

    Thank you so much… You saved lot of my time. !

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.