Asp.net MVC Razor view - CS1525: Invalid expression term '.'

后端 未结 3 1216
攒了一身酷
攒了一身酷 2020-12-19 02:51

I have two identical ASP.Net 4.6 MVC project, project 1 is using roslyn complier within the site which is working fine.

c:\\windows\\system32\\inetsrv>C:\\

相关标签:
3条回答
  • 2020-12-19 03:18

    I just faced a similar issue and fixed it by doing as Huzzi suggested by adding the tags into the main web project's web.config and making sure that you have installed 'Microsoft.CodeDom.Providers.DotNetCompilerPlatform' from nuget.

    0 讨论(0)
  • 2020-12-19 03:24

    Try changing the "Target framework" value in your application properties to a newer one.

    0 讨论(0)
  • 2020-12-19 03:26

    Got it working now after adding the following to the web.config

    <system.codedom>
        <compilers>
          <compiler language="c#;cs;csharp" extension=".cs"
            type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
            warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/>
          <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
            type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
            warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
        </compilers>
      </system.codedom>
    
    0 讨论(0)
提交回复
热议问题