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

Support building TypeScript projects #556

Closed
tamasarpad opened this Issue Apr 8, 2013 · 13 comments

Comments

Projects
None yet
7 participants
@tamasarpad

tamasarpad commented Apr 8, 2013

Build fails on a solution with a typescript project (Location: West Europe).
The error message:

C:\DWASFiles\Sites\typescripttest\VirtualDirectory0\site\repository\TypeScriptHTMLApp1.csproj(67,3): error MSB4019: The imported project "D:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\TypeScript\Microsoft.TypeScript.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

The repo I'm testing with: https://github.com/tamasarpad/azurewstypescripttest.git

@davidebbo

This comment has been minimized.

Show comment
Hide comment
@davidebbo

davidebbo Apr 8, 2013

Member

What are the setup steps on a build machine for this to work? Isn't there a way to set up the project so it works without any machine level installs (e.g. via getting relevant bits from npm)?

Member

davidebbo commented Apr 8, 2013

What are the setup steps on a build machine for this to work? Isn't there a way to set up the project so it works without any machine level installs (e.g. via getting relevant bits from npm)?

@tamasarpad

This comment has been minimized.

Show comment
Hide comment
@tamasarpad

tamasarpad Apr 8, 2013

I haven't tried it on build server yet, but just found this: http://devlicio.us/blogs/derik_whittaker/archive/2012/12/10/getting-typescript-setup-on-your-build-server.aspx
It can be installed on the server (not under the solution) with npm install –g typescript
And found this question with your answer on SO :)
Is there a way to run the TypeScript compiler as part of the Azure Git Deploy
I will try it tomorrow and write the solution here.

tamasarpad commented Apr 8, 2013

I haven't tried it on build server yet, but just found this: http://devlicio.us/blogs/derik_whittaker/archive/2012/12/10/getting-typescript-setup-on-your-build-server.aspx
It can be installed on the server (not under the solution) with npm install –g typescript
And found this question with your answer on SO :)
Is there a way to run the TypeScript compiler as part of the Azure Git Deploy
I will try it tomorrow and write the solution here.

@davidebbo

This comment has been minimized.

Show comment
Hide comment
@davidebbo

davidebbo Apr 8, 2013

Member

I'm not sure that's enough, because your build error complains about a missing msbuild target file, which doesn't sound like something that would come with the npm package.

@joewood, maybe you have wisdom to share here, since it sounds like you got this working? Thanks!

Member

davidebbo commented Apr 8, 2013

I'm not sure that's enough, because your build error complains about a missing msbuild target file, which doesn't sound like something that would come with the npm package.

@joewood, maybe you have wisdom to share here, since it sounds like you got this working? Thanks!

@joewood

This comment has been minimized.

Show comment
Hide comment
@joewood

joewood Apr 8, 2013

I didn't use msbuild to build the TypeScript. it's easier to just run the typescript compiler on the top-level .ts file. This will build all referenced typescript files. As the TypeScript compiler is written in node.js, this is as simple as running kudu. Just have to watch out for the installed version of node.js on the server.

joewood commented Apr 8, 2013

I didn't use msbuild to build the TypeScript. it's easier to just run the typescript compiler on the top-level .ts file. This will build all referenced typescript files. As the TypeScript compiler is written in node.js, this is as simple as running kudu. Just have to watch out for the installed version of node.js on the server.

@tamasarpad

This comment has been minimized.

Show comment
Hide comment
@tamasarpad

tamasarpad Apr 18, 2013

I don't have a top level .ts file, so I needed to compile them the same way as VS and msbuild does it (ts files are referenced from the project file).
I've got it working with msbuild this way:
In the web project file in beforebuild target the typescript package is downloaded and the typescript target file is conditionally imported:

  <Target Name="BeforeBuild" >
    <Exec Command="&quot;D:\Program Files (x86)\nodejs\0.8.2\node.exe&quot; &quot;D:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js&quot; install -g typescript" Condition="!Exists('$(VSToolsPath)\TypeScript\Microsoft.TypeScript.targets')"/>
  </Target>
  <Import Project="$(VSToolsPath)\TypeScript\Microsoft.TypeScript.targets" Condition="Exists('$(VSToolsPath)\TypeScript\Microsoft.TypeScript.targets')" />
  <Import Project="Microsoft.TypeScript.targets" Condition="!Exists('$(VSToolsPath)\TypeScript\Microsoft.TypeScript.targets')" />

I copied the original typescript target file (Microsoft.TypeScript.targets) from c:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\TypeScript\ to the project's directory and modified the exec command to use node version 0.8.2:

<Exec Command="&quot;D:\Program Files (x86)\nodejs\0.8.2\node.exe&quot; &quot;$(APPDATA)\npm\node_modules\typescript\bin\tsc&quot; $(TypeScriptBuildConfigurations) @(TypeScriptCompile ->'&quot;%(fullpath)&quot;', ' ')" />

Unfortunately it can't be tested locally and it's ugly because of the hard coded paths but at least it works on the server.
Tried to experiment with %NODE_EXE% environment variable according to Amit's comment, but I couldn't figure out how to use it (it was empty when tried to use instead of the hard coded paths).
Thanks for the help, I think the issue can be closed.

tamasarpad commented Apr 18, 2013

I don't have a top level .ts file, so I needed to compile them the same way as VS and msbuild does it (ts files are referenced from the project file).
I've got it working with msbuild this way:
In the web project file in beforebuild target the typescript package is downloaded and the typescript target file is conditionally imported:

  <Target Name="BeforeBuild" >
    <Exec Command="&quot;D:\Program Files (x86)\nodejs\0.8.2\node.exe&quot; &quot;D:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js&quot; install -g typescript" Condition="!Exists('$(VSToolsPath)\TypeScript\Microsoft.TypeScript.targets')"/>
  </Target>
  <Import Project="$(VSToolsPath)\TypeScript\Microsoft.TypeScript.targets" Condition="Exists('$(VSToolsPath)\TypeScript\Microsoft.TypeScript.targets')" />
  <Import Project="Microsoft.TypeScript.targets" Condition="!Exists('$(VSToolsPath)\TypeScript\Microsoft.TypeScript.targets')" />

I copied the original typescript target file (Microsoft.TypeScript.targets) from c:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\TypeScript\ to the project's directory and modified the exec command to use node version 0.8.2:

<Exec Command="&quot;D:\Program Files (x86)\nodejs\0.8.2\node.exe&quot; &quot;$(APPDATA)\npm\node_modules\typescript\bin\tsc&quot; $(TypeScriptBuildConfigurations) @(TypeScriptCompile ->'&quot;%(fullpath)&quot;', ' ')" />

Unfortunately it can't be tested locally and it's ugly because of the hard coded paths but at least it works on the server.
Tried to experiment with %NODE_EXE% environment variable according to Amit's comment, but I couldn't figure out how to use it (it was empty when tried to use instead of the hard coded paths).
Thanks for the help, I think the issue can be closed.

@davidebbo

This comment has been minimized.

Show comment
Hide comment
@davidebbo

davidebbo Apr 18, 2013

Member

@amitapl may be able to help on getting the env variable to work.

Member

davidebbo commented Apr 18, 2013

@amitapl may be able to help on getting the env variable to work.

@amitapl

This comment has been minimized.

Show comment
Hide comment
@amitapl

amitapl Apr 18, 2013

Contributor

The %NODE_EXE% variable only exists for node.js sites, this is probably the reason you don't see it, to get it you can generate a custom deployment script for a node web site using azure-cli and --node flag azure site deploymentscript --node (if it tells you you're missing a server.js file just create an empty one).

In the generated deploy.cmd you'll have the %NODE_EXE%, of course it doesn't build your msbuild project so you'll need to add this step, basically merging between asp.net wap deployment and node deployment.

I know it's very non trivial work but currently we don't support this hybrid scenario for build both using msbuild and node.js

Also make sure the %NODE_EXE% environment variable is passed correctly to msbuild.

Contributor

amitapl commented Apr 18, 2013

The %NODE_EXE% variable only exists for node.js sites, this is probably the reason you don't see it, to get it you can generate a custom deployment script for a node web site using azure-cli and --node flag azure site deploymentscript --node (if it tells you you're missing a server.js file just create an empty one).

In the generated deploy.cmd you'll have the %NODE_EXE%, of course it doesn't build your msbuild project so you'll need to add this step, basically merging between asp.net wap deployment and node deployment.

I know it's very non trivial work but currently we don't support this hybrid scenario for build both using msbuild and node.js

Also make sure the %NODE_EXE% environment variable is passed correctly to msbuild.

@tamasarpad

This comment has been minimized.

Show comment
Hide comment
@tamasarpad

tamasarpad Apr 19, 2013

Thanks Amit, I think I'm fine with the hard coded path now.

tamasarpad commented Apr 19, 2013

Thanks Amit, I think I'm fine with the hard coded path now.

@davidebbo

This comment has been minimized.

Show comment
Hide comment
@davidebbo

davidebbo May 14, 2013

Member

Closing since workaround works well enough. We can reconsider adding more support if more people run into this.

Member

davidebbo commented May 14, 2013

Closing since workaround works well enough. We can reconsider adding more support if more people run into this.

@davidebbo davidebbo closed this May 14, 2013

@smithkl42

This comment has been minimized.

Show comment
Hide comment
@smithkl42

smithkl42 Jul 30, 2013

For what it's worth, I'm running into this as well. Given that MS is pushing TS big-time, it would be really nice if Kudu supported projects that include TS files without these workarounds, which are either ugly or non-trivial or both.

smithkl42 commented Jul 30, 2013

For what it's worth, I'm running into this as well. Given that MS is pushing TS big-time, it would be really nice if Kudu supported projects that include TS files without these workarounds, which are either ugly or non-trivial or both.

@dariagrigoriu

This comment has been minimized.

Show comment
Hide comment
@dariagrigoriu

dariagrigoriu Jul 31, 2013

Thank you for the feedback! We appreciate gathering ideas for future improvements via http://www.mygreatwindowsazureidea.com/forums/169385-web-sites as well.

dariagrigoriu commented Jul 31, 2013

Thank you for the feedback! We appreciate gathering ideas for future improvements via http://www.mygreatwindowsazureidea.com/forums/169385-web-sites as well.

@ManfredLange

This comment has been minimized.

Show comment
Hide comment
@ManfredLange

ManfredLange Jan 13, 2014

When developing an ASP.NET MVC application I think it is not an uncommon scenario if people choose to add a TypeScript file where they used a JavaScript file in the past. Therefore supporting TypeScript out of the box would be a very valuable feature. Please consider for inclusion soon. The workarounds that require custom deploy scripts are complex and error prone. It would be great if JavaScript that is produced as output from TypeScript was treated like other intermediate files, e.g. assemblies generated from C#. The latter are included in the deployment of a web site.

ManfredLange commented Jan 13, 2014

When developing an ASP.NET MVC application I think it is not an uncommon scenario if people choose to add a TypeScript file where they used a JavaScript file in the past. Therefore supporting TypeScript out of the box would be a very valuable feature. Please consider for inclusion soon. The workarounds that require custom deploy scripts are complex and error prone. It would be great if JavaScript that is produced as output from TypeScript was treated like other intermediate files, e.g. assemblies generated from C#. The latter are included in the deployment of a web site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment