Build error “Cannot find name 'Record'” with bootstrap 4

后端 未结 6 1990
逝去的感伤
逝去的感伤 2021-02-01 03:31

Today, I decided to migrate my ASP .NET MVC 5 project from bootstrap 3 to bootstrap 4 (the sass version).

After the migration, I got an error after the compilation of my

相关标签:
6条回答
  • 2021-02-01 03:49

    After some research, I found this link to have a better understanding of typescript and visual studio. If you want to improve your skills, you can go to this official page and have some readings.

    The solution You just have to update the typescript plugin for Visual studio. You can download the latest version here for visual studio 2015.

    Here for visual studio 2017

    Enjoy!

    0 讨论(0)
  • 2021-02-01 03:52
    • open your project in visual studio 2017 and it will ask you to upgrade the typescript just press upgrade

      OR

    Upgrade your Typescript version

    0 讨论(0)
  • 2021-02-01 03:58

    Out of the box, for me it has been fixed by update VS 17 to latest version!!

    0 讨论(0)
  • 2021-02-01 04:04

    I uninstalled jpopper.cs and went to the Web.config file and added these lines of code

    <appSettings>
        <add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
    </appSettings>
    

    to deal with that validation error.

    0 讨论(0)
  • 2021-02-01 04:06

    For Visual Studio 2015:

    I downloaded TypeScript, installed and restarted Visual Studio. While restarting it prompted me the TypeScript my solution uses is older than what is installed(2.9.2) and whether I want to update it to the supported version, I clicked Yes and that fixed the issue.

    My guess is TypeScript 2.9.2 is for VS 2017 maybe.

    0 讨论(0)
  • 2021-02-01 04:07

    If, for some reason you are unable to update your Visual Studio with the updated TypeScript .exe file (company/business IT policy, non-admin account, etc...), you can try this solution:

    1. Single-click on the "index.d.ts" file in Visual Studio Solution Explorer.
    2. Look in the Properties panel, under "Build Action".
    3. Switch it from "TypeScriptCompile" to "Content".

    Now, you'll be able to build your project without these errors.

    Update 2019 I have found another workaround/solution that hasn't had any noticeable effects and still allows me to compile without erroring on index.d.ts. Just comment line 68 in your index.d.ts file as such:

    //[name: string]: (BaseModifier & Record<string, any>) | undefined; 
    
    0 讨论(0)
提交回复
热议问题