Skip to content
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

tsconfig.json does not work with VS 2015 #3124

Closed
OnurGumus opened this issue May 12, 2015 · 35 comments
Closed

tsconfig.json does not work with VS 2015 #3124

OnurGumus opened this issue May 12, 2015 · 35 comments
Assignees
Labels
Committed The team has roadmapped this issue Suggestion An idea for TypeScript Visual Studio Integration with Visual Studio

Comments

@OnurGumus
Copy link

I am trying to give options to typescript namely trying tell how to load modules from VS. For new ASP.NET 5 templates this option simply not available, worse typescript 1.5 does not honor tsconfig.json either so what should I do ?

@CyrusNajmabadi
Copy link
Contributor

tsconfig.json files are not currently working in VS2015. It's something @paulvanbrenk is working on.

@OnurGumus
Copy link
Author

Any work around for the time being? I need to specify modules to AMD.

@paulvanbrenk
Copy link
Contributor

No guaranteed workaround, you can try adding a TypeScriptModuleKind element to a propertygroup, with amd or commonjs specified.. not sure if that gets correctly communicated to the compiler.

@paulvanbrenk paulvanbrenk added this to the TypeScript 1.5.2 milestone May 12, 2015
@paulvanbrenk paulvanbrenk added the Bug A bug in TypeScript label May 12, 2015
@paulvanbrenk paulvanbrenk self-assigned this May 12, 2015
@OnurGumus
Copy link
Author

Thanks that seems to work.

@JohnFlyIII
Copy link

+1 for this to work in VS2015 RC without workarounds.
I really enjoy the experience from VS Code

@paulvanbrenk
Copy link
Contributor

This will work in the final release of VS 2015.

@paulvanbrenk paulvanbrenk added the Visual Studio Integration with Visual Studio label May 18, 2015
@mhegazy mhegazy added Suggestion An idea for TypeScript Committed The team has roadmapped this issue and removed Bug A bug in TypeScript labels May 19, 2015
@mhegazy
Copy link
Contributor

mhegazy commented May 19, 2015

Updating the label to suggestion as this is not a bug level change; this does not change the plan of shipping this in the next public VS release.

@paulvanbrenk
Copy link
Contributor

Checked in the code to enable this scenario in VS 2015

@afaayerhan
Copy link

just got VS 2015 RTM now but the tsconfig is not working. and when you change module system it just does not work. it defaults to commonjs. and if you remove TypeScriptModuleKind it cannot compile without --module flag

@paulvanbrenk
Copy link
Contributor

What kind of project are you using? For VS 2015 RTM tsconfig.json based configuration is only supported for ASP.NET v5 and Cordova Projects.

@afaayerhan
Copy link

njsproj

@paulvanbrenk
Copy link
Contributor

Yes, that's a currently unsupported project type. The behavior you're seeing is expected. We are planning support for additional project types, but nothing concrete at the moment.

@afaayerhan
Copy link

thanks. it would be great if njsproj would be supported and also for tsconfig files sync with ItemGroup typescriptCompile includes.

@paulvanbrenk
Copy link
Contributor

That's exactly one of the problems we run into.. we don't want to have to keep the 2 files in sync. As long as the files are edited in Visual Studio we would be ok, but the moment one of the files is edited outside of Visual Studio the files would be out of sync and we would have a problem getting them back in agreement.

@Jak3b0
Copy link

Jak3b0 commented Jul 24, 2015

I'm trying to use the tsconfig.json inside an empty ASP.NET vNext project and it is not being used. I have to set the properties inside a PropertyGroup in the .xproj file... Is there any steps I need to do in order to make it work? @paulvanbrenk, as you mentionned in a previous reply, this should work right?

@paulvanbrenk
Copy link
Contributor

What does your project look like?
The following setup should work:

/project root
    /wwwroot
    /scripts
        -tsconfig.json
        -*.ts

@jannavarro
Copy link

@paulvanbrenk you mentioned "For VS 2015 RTM tsconfig.json based configuration is only supported for ASP.NET v5 and Cordova Projects."

In VS 2015 there is a project for Html Application with TypeScript. Will this be supported?

@paulvanbrenk
Copy link
Contributor

We are looking at making the experience better for all projects, including the Html App with TypeScript.. not sure about the time line though.

@dazinator
Copy link

tsconfig.json is not being honored for me (new ASP.NET v5 project.)
I have had to add the ms build properties to the xproj.
Does the tsconfig.json file have to be placed under a /scripts directory as suggested?

@mhegazy
Copy link
Contributor

mhegazy commented Sep 15, 2015

@dazinator, for now it needs to be under the scripts folder. but we have a fix for this in the next release. so bear with us for a little bit longer.

@dazinator
Copy link

@mhegazy ok thats fine - will give that a try. Thanks :)

@oryol
Copy link

oryol commented Nov 4, 2015

I use latest (1.6.3 TypeScript language services), VS 2015 and ASP .Net Betta8. I have FrontendApp folder in the root of web project with tsconfig.json. It contains compiler options and links to files with TS definitions. I also use WebPack + ts-loader to build frontend application and it builds successfully.

But Visual Studio code analyzer shows errors in the TypeScript files for imports of modules which are declared in the definition files. If I add references like

/// <reference path="typings/tsd.d.ts" />

then errors are disappearing. But all these files are already declared in the tsconfig.json so I don't want to have two sources of these files. What is even more interesting that I have several modules (external) and I added reference comments only to one of them (the main one). If I reopen project and open some other TypeScript file (not main) - Visual Studio shows errors. If I open main TS file after that and wait a few seconds then errors disappear (in all TS files). And after each project reopen I need to open main TS file and wait few seconds.

Is it possible just to use files list with definitions from tsconfig.json without including reference comments?

@paulvanbrenk
Copy link
Contributor

@oryol Please see this wikipage about using tsconfig.json and ASP.NET 5. https://github.com/Microsoft/TypeScript/wiki/Using-TypeScript-With-ASP.NET-5

I think the reason you're seeing what you're seeing is that we only check for tsconfig.json files in the scripts folder.

@oryol
Copy link

oryol commented Nov 4, 2015

So, is it possible to use tsconfig.json in other folders (not in "Scripts")? If not - are you going to support such scenarios and when can we expect such feature?

@paulvanbrenk
Copy link
Contributor

@oryol No, not in TypeScript 1.7 (or earlier). However I'm right now working on making the tsconfig.json support a lot better in VS 2015, you should see that in the 1.8 release.

Caveat: Any features don't actually exist until they're checked-in/shipped, and schedules can change at a moments notice.

@oryol
Copy link

oryol commented Nov 4, 2015

Thank you for reply!

@defyjoy
Copy link

defyjoy commented Mar 6, 2016

Does this still work for *.csproj files ? I opened a new blank asp.net application and tried to make it work with tsconfig.json .The project I chose in 2015 was

image

But it seems the VS completely ignores the tsconfig.json.

image

My project structure somewhat looks like this

image

Note : I am using typescript v1.8.2

@mhegazy
Copy link
Contributor

mhegazy commented Mar 7, 2016

@defyjoy can you try the latest (https://github.com/Microsoft/TypeScript/releases/tag/v1.8.7), and if you run into issues, please file a new issue and provide a project we can look at.

@paulvanbrenk
Copy link
Contributor

@defyjoy Can you make sure TypeScript shows in Help > About

@dehghani-mehdi
Copy link

Doesn't work here, I'm using VS 2015.3 and latest version of TypeScript

@dazinator
Copy link

When using VS2015, put the tsconfig file in a "Scripts" folder. Otherwise I don't think VS will find it or honour it.

@dehghani-mehdi
Copy link

@dazinator that isn't really good way to deal with config file, I always rename Script folder to js, personally prefer to use commad-line to deal with this issue.

@dazinator
Copy link

dazinator commented Jan 18, 2017

@dehghani-mehdi - yep I know. I also think it's a poor, but that is how the VS project system (vs2015) supports typescript projects as far as I know. This should help @defyjoy. If you want to handle typescript project compilation outside VS using tsc that will of course work.

@dazinator
Copy link

Also - if you do decide to use command line tsc to handle typescript project compilation, then you will want to disable VS from automatically transpiling ts files to js files (as it will to do that depending on your VS configuration settings for typescript language). To prevent VS from doing this in VS2015, add the following to your .csproj file:

<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>

@dehghani-mehdi
Copy link

@dazinator Thanks for the note, for now I just add tsconfig.json to the project for disabling auto generate JS file by VS :), of course the correct solution is what you mentioned.

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Committed The team has roadmapped this issue Suggestion An idea for TypeScript Visual Studio Integration with Visual Studio
Projects
None yet
Development

No branches or pull requests