40

We are getting the following "Error" message in our MVC web application in Visual studio 2017 Enterprise.

The language service is disabled for project 'C:\Work\Blackhawk Platform\Platform-DEV-Branch\BlackhawkViewer\BlackhawkViewer.csproj' because it included a large number of .js files. Consider excluding files using the 'exclude' section of a 'tsconfig.json' file.

I have tried turning off the Language service in the options but this does not turn the message off:

enter image description here

This is a rather large web application. Is there a way to turn this message off without disabling any files in the tsconfig.json file as it suggests?

4
  • Some JavaScript files were excluded from your project .csproj file. Aug 26, 2017 at 10:33
  • @iman.Bahrampour No that is not the case here. This was a VS bug which was fixed.
    – TResponse
    Aug 26, 2017 at 22:20
  • As the error shows: because it included a large number of .js files in your BlackhawkViewer.csproj file. A number of .js files included in your project, while they are deleted from your solution. Aug 29, 2017 at 5:25
  • It may look irrelevant but In my case I just didn't have enough disk space
    – Berk Derek
    Dec 4, 2018 at 11:05

9 Answers 9

44

To solve this issue do the following:

  • Create file in root directory of your project and call it tsconfig.json
  • Add this:
{
  "compilerOptions": {
    "allowJs": true, 
    "noEmit": true, 
    "module": "system",
    "noImplicitAny": true,
    "removeComments": true,
    "preserveConstEnums": true,
    "sourceMap": true
  },
  "include": [
    "scripts"
  ],
  "exclude": [

  ],
  "typeAcquisition": {
    "enable": true 
  }
}

Please have a look at the below two links for tsconfig.json explanation, because you may still need to change it according to your setup. This is the only way that worked for me. I hope that will help.
https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
https://developercommunity.visualstudio.com/content/problem/8148/javascript-intellisense-not-working.html

7
  • 5
    Whilst this code snippet is welcome, and may provide some help, it would be greatly improved if it included an explanation of how it addresses the question. Without that, your answer has much less educational value - remember that you are answering the question for readers in the future, not just the person asking now! Please edit your answer to add explanation, and give an indication of what limitations and assumptions apply. Apr 26, 2017 at 8:09
  • 1
    this solution didn't work for me, i have lots of javascript files and even excluding one of the folders with lots of js files did not work for me, using the tsconfig.json
    – inN0Cent
    May 9, 2017 at 0:59
  • 2
    I also have a lot of javascript files and it worked, try to clean the solution, rebuild and restart visual studio might help. May 10, 2017 at 0:36
  • 1
    This is the right answer, and a solid one. Thanks for providing the links too.
    – Neo
    Jun 26, 2017 at 13:54
  • 2
    I added the above file and now get the error: The config file 'project/tsconfig.json' found doesn't contain any source files. Oct 20, 2017 at 2:58
21

This helped me. You can have a try.

 Go to Tools -> Options -> Text Editor -> JavaScript/TypeScript -> Language Service -> General

and uncheck the box: "Enable the new JavaScript language service.

6
  • 2
    yes that's the way but at the time I asked the question VS2017 had a bug where it did not honor that setting. It has since been fixed.
    – TResponse
    Dec 19, 2017 at 20:46
  • 3
    I also had to restart Visual Studio
    – Savage
    Jan 18, 2018 at 15:14
  • 1
    @loan.burger This bug still occurs for me. Apr 19, 2018 at 14:48
  • for me also. Everytime I update VS2017 to a newer version, bug appears again. Apr 21, 2018 at 18:57
  • I also had to reinstall visual studio
    – Moons
    Jul 15, 2019 at 15:28
9

I have found a solution for this problem.

I reset my userData using:

devenv.exe /resetuserdata

Since doing this the JavaScript settings seem to have persisted and I no longer get the language service error above.

TAKE NOTE: This will reset all your user data and customisations.

6
  • 2
    I've found that git clean -fxd also seems to fix the issue.
    – Mike Cole
    Apr 21, 2017 at 15:29
  • This worked for me. Adding the tsconfig did not , especially if you do not add include, it will complain there is nothing to build May 24, 2017 at 14:02
  • Sorry I have to take back my comment. Message just re appeared again :( May 24, 2017 at 14:29
  • I have not had this issue since 3 updates ago. Make sure your running thevlatest version of vs2017 bu running the visual studio installer and pressing updates if the update button appears.
    – TResponse
    May 24, 2017 at 19:15
  • where exactly am I supposed to type this? Jul 9, 2017 at 9:04
2

In My case I just disable TypeScript support on Visual Studio:

Tools > Extensions and Updates > TypeScript for Microsoft Visual Studio > Disable

After that, just restart Visual Studio, and you are good to go.

Hope this will help,

1

I had the same problem after migrating Ionic 1 project from VS2015 to VS2017, first I executed git clean -fxd as sugested above and added this content into tsconfig.json in my ionic project.

{
"compilerOptions": {
    "noImplicitAny": false,
    "noEmitOnError": true,
    "removeComments": false,
    "sourceMap": true,
    "target": "es5"
},
"exclude": [
    "node_modules",
    "www",
    "bower_components"
    ]
}
2
  • This adds nothing that isn't covered in Moustafa's answer
    – Neo
    Jun 26, 2017 at 13:46
  • 1
    I used the solution implemented by Moustafa and it didn`t work for me. He didn't set up the exclude modules. Jun 27, 2017 at 16:40
1

I solved this problem with following solution:

When you have a JavaScript file that is included in the project.csproj file but isn't in the project folder, this error occurred.

For example I have a .csproj file like below:

 <ItemGroup>
     <Content Include="Scripts\Test.js" />
 </ItemGroup>

The Test.js is included in the .csproj file, but it isn't in the Scripts folder:

Delete the <Content Include="Scripts\Test.js" /> line from the .csproj file and rebuild your project

1

Solution that worked for me:

  1. Go to C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE>.
  2. Open command prompt as admin in current folder
  3. Ran devenv /Setup
  4. Ran devenv /ResetSkipPkgs
1

For me is helping the next solution. I've create a tsconfig.json file in root of the my project with "disableSizeLimit": "true" option.

So, my tsconfig.json file is:

{
  "compilerOptions": {
  "disableSizeLimit": "true"
},
"exclude": []
}
0
0

If none of suggested methods worked, try:

npm install -g typescript@latest

and then

Install the latest version of TypeScript for Visual Studio on Get TypeScript.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.