3

I have VS2015 and ASP.NET 5 RC1 project with some typescript files. Files are located in scripts folder and tsconfig is in this folder too. When I'm saving typescript file, js file is generated and everything is ok. But js files are not generated during build.

I have VS2013 installed also and some old projects using typescript, so may be there are some problems cause I have many TypeScript versions and many VS versions.

How can I troubleshoot compiling typescript during build? Build log says nothing about typescript. Checkbox 'Compile TypeScript on build' is project settings is enabled. In old ASP.NET projects TypeScript is enabled via custom target in csproj and it's easy to troubleshoot. But in xproj I don't see any typescript related things.

4
  • Do you have a target import to Microsoft.Typescript.targets ? Commented May 17, 2016 at 2:33
  • @mohamedhegazy Nope, only import of Microsoft.DNX.Props and Microsoft.DNX.targets Commented May 17, 2016 at 7:36
  • can you share the build log with /verbosity:diagnostic Commented May 20, 2016 at 0:28
  • @mohamedhegazy Here is 2Mb log of msbuild: drive.google.com/file/d/0B2pS8f3oahxBd29wLTBRY1ZBbVk/view Commented May 26, 2016 at 4:43

3 Answers 3

2

My current working solution is to add postbuild event which manually calls TypeScript compiler.

project.json:

"scripts": {
    "postbuild": ["tsc -p scripts\\tsconfig.json"]
}

(assumes you have tsc in your PATH variable)

Sign up to request clarification or add additional context in comments.

Comments

0

make sure this is added in your solution file "Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"

5 Comments

Do you mean the project file, not the solution file? I have not got this line in xproj file, but adding it changes nothing. Does ASP.NET 5 need this import? I thought only older versions of ASP.NET needs it.
The sln file. These are built in extension for VS-15, but make sure these are not modified. To edit sln file - Go to solution explorer-> unload project ->edit ->reload
There are only links to projects in sln. Where should I add import? pastebin.com/ZBg1TdEA
You can add just below the project tag
Changing my import to this does nothing.
0

I had the exact same issue. Worked for me when I edited tsconfig, and placed compileOnSave BEFORE compilerOptions in tsconfig:

{
    "compileOnSave": true
    "compilerOptions": {
         ....
    },
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.