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

Support for multiple tsconfig.json files in ASP.NET v5 projects #4714

Closed
paulvanbrenk opened this issue Sep 9, 2015 · 21 comments
Closed

Support for multiple tsconfig.json files in ASP.NET v5 projects #4714

paulvanbrenk opened this issue Sep 9, 2015 · 21 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue Visual Studio Integration with Visual Studio

Comments

@paulvanbrenk
Copy link
Contributor

We want to enable the ability to have more than 1 tsconfig.json file in an asp.net v5 project, this will make the compilation of ts files more flexible.

/Common.Classes
   - tsconfig.json {out: "../Outputs/Common.Classes.js"}
   - Class1.ts
   - Class2.ts

/Common.Plugins
   - tsconfig.json {out: "../Outputs/Common.Plugins.js"}
   - Class3.ts
   - Class4.ts

/Outputs
   - Common.Classes.js
   - Common.Plugins.js

See these comments:
#4161 (comment)
#4161 (comment)

@mjohnsonengr
Copy link

Will this allow me to have my tsconfig.json in some other location?

Currently, our structure has all of our typescript files in /projectroot/client; naturally I created my tsconfig file in that directory originally.

@paulvanbrenk
Copy link
Contributor Author

@mjohnsonengr Yes, that will work for 1.8, further for 1.7 we made a small change to allow the tsconfig.json in the root of your project, so that should work with your project structure.

1.7 is part of Visual Studio 2015 Update 1 (currently available as an RC).

@basarat
Copy link
Contributor

basarat commented Dec 8, 2015

@paulvanbrenk curious what will happen if we have a .ts file in two projects. Show both errors? Show both autocomplete entries?

@paulvanbrenk
Copy link
Contributor Author

Yep, that will give 2 errors.. similar to what happens when you use 'linked files' in C# projects. And you do want two errors, since they are potentially in a different context (e.g. es3, and es5)... the effort to filter out true duplicates is probably not worth it. <insert remark about trade-off between features, value-add, and time>

@basarat
Copy link
Contributor

basarat commented Dec 8, 2015

the effort to filter out true duplicates is probably not worth it

Completely agree 🌹 👍

@lcorneliussen
Copy link

What is the status on this issue? Release date yet known?

@paulvanbrenk
Copy link
Contributor Author

Still planned for 1.8, no concrete date yet.

@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Jan 27, 2016
@mhegazy
Copy link
Contributor

mhegazy commented Jan 27, 2016

Should be fixed in TS 1.8

@mhegazy mhegazy closed this as completed Jan 27, 2016
@ghost
Copy link

ghost commented Feb 23, 2016

Is this actually fixed in 1.8? And is it specifically limited to the ASP.NET v5 project type? I'm using a C# console app with the old .targets manually added but visual studio complains about duplicate definitions and does not seem to be honoring either of my tsconfig.json files' output settings.

(This is for an Electron project that I'm trying to organize and basing it on an ASP.NET web project with a web server and so on is unnecessary overhead. I'm struggling to get a really clean setup going for this in Visual Studio. Preferably I wouldn't have to involve .NET-branded things in this particular project at all but I'm not aware of a way to have a full dev workflow in VS without hacking the C# or VB project types.)

@mhegazy
Copy link
Contributor

mhegazy commented Feb 23, 2016

@MrAndMrsK can you share your project, and/or a build log (msbuild /v:detailed)?

@mhegazy
Copy link
Contributor

mhegazy commented Feb 23, 2016

also what version of TS are you using in VS?

@paulvanbrenk
Copy link
Contributor Author

@MrAndMrsK for a Console App, I would recommend using the NuGet package to get the best experience. https://www.nuget.org/packages/Microsoft.TypeScript.MSBuild/

@ghost
Copy link

ghost commented Feb 23, 2016

@paulvanbrenk - Cool, that's good to know but it didn't fix the problem.

@mhegazy - I already updated my PATH to 1.8 (which I keep having to do manually??) and rebooted. Visual Studio was already using 1.8, yes, and now with the suggested NuGet package I can see the 1.8.4 being used by msbuild.

Here's the project structure, with the newly placed/refreshed files output in the wrong place:

image

Contents of one of the two similar .tsconfig files:

{
    "compilerOptions": {
        "module": "system",
        "target": "es5",
        "noImplicitAny": true,
        "outFile": "main.js",
        "outDir": "../built",
        "rootDir": ".",
        "sourceMap": false,
        "noLib": true
    },
    "exclude": [
        "node_modules"
    ]
}

And the build log:

http://hastebin.com/fuhozojicu.tex

ghost referenced this issue in DefinitelyTyped/DefinitelyTyped Feb 24, 2016
…definitions

because currently github-electron-renderer.d.ts and
github-electron-main.d.ts can't be used with tsd.d.ts at the same
time.  tsd.d.ts includes both definition files.  So I unite them to
resolve it.
@mhegazy
Copy link
Contributor

mhegazy commented Feb 24, 2016

the log indicates that there were no config files, so obviously something went wrong there. can you verify that the content type of your tsconifig.json is "Content", and can you share a sample project?

@mhegazy
Copy link
Contributor

mhegazy commented Feb 24, 2016

also can you file a different issue.

@ghost
Copy link

ghost commented Feb 24, 2016

Ok, they weren't "Content", so I corrected that.

After that it seems like outFile does not get combined with outDir - the files were being generated correctly, but not in the out folder. So I combined them myself into outFile and dropped outDir. Not sure if that represents a bug or not.

If you think there's a bug here, please let me know what it is and I'll be happy to file it. The situation was confusing to me, but I'm not sure how to describe that as a bug.

@mhegazy
Copy link
Contributor

mhegazy commented Feb 24, 2016

@MrAndMrsK this is actually a new feature. module outputs are concatenated using --outFile. i am assuming you are using module.. is that correct?

For more details please see: https://github.com/Microsoft/TypeScript/wiki/What%27s-new-in-TypeScript#concatenate-amd-and-system-modules-with---outfile

@ghost
Copy link

ghost commented Feb 24, 2016

Yes, but the outDir is not being honored. I had:

    "outFile": "combinedOut.js",
    "outDir": "../built",

"combinedOut.js" was being generated, but it wasn't being put in ../built. This works though:

    "outFile": "../built/combinedOut.js",

@mhegazy
Copy link
Contributor

mhegazy commented Feb 24, 2016

aah.. they do not combine. actually it should be an error to specify outFile and outDir in conjunction. this is tracked bu #3305

@Denis535
Copy link

As I understand this feature is named Virtual Project ?
Can I use Virtual Project in HTML with TypeScript project type?

@mhegazy
Copy link
Contributor

mhegazy commented Apr 30, 2016

For the OP. multiple tsconfig.json support is not related to Virtual Projects, multiple tsconfig.json support is enabled for all projects.

As I understand this feature is named Virtual Project ?

this is not true. Virtual Projects are the file tree you get in your solution explorer if you do not have a real project, i.e. if you just open a .ts file in VS without loading a solution or a project file. it looks something like:
image

Can I use Virtual Project in HTML with TypeScript project type?

The virtaul project view is disabled by default when a solution is loaded, just to limit noise, as all the files in the poject will be listed twice. to enable it go to tools\options\text editor\typescript\project and select "Display Virtual Projects when solution is loaded" :
image

@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
Bug A bug in TypeScript Fixed A PR has been merged for this issue Visual Studio Integration with Visual Studio
Projects
None yet
Development

No branches or pull requests

7 participants