Web Application Build Error: The CodeDom provider type Microsoft.VisualC.CppCodeProvider could not be located

后端 未结 12 757
有刺的猬
有刺的猬 2021-01-31 08:20

I\'m building/packing a web application in a build server, and it fails with the following message:

ASPNETCOMPILER error ASPCONFIG: The CodeDom provider t

相关标签:
12条回答
  • 2021-01-31 08:39

    For me this error was popping up in VS2017 when building the web project. The fix was to make the node_modules directory hidden in File Explorer. Apparently this stops the ASP.NET compiler from scanning all these files and thus prevents the error.

    0 讨论(0)
  • 2021-01-31 08:42

    For me this error was showing when my website's physical path was invalid in IIS. To resolve that right click on website (Manage website -> Advanced settings -> Physical Path).

    0 讨论(0)
  • 2021-01-31 08:43

    In my case the issue was that the web config of a parent solution (root level project) in IIS had this in it's web config (by mistake, not sure how it got there). Took a long time to track down, because nothing I could do in my solution/project could affect it in any way.

    So might be worth checking the web.config of all that might be involved.

    0 讨论(0)
  • 2021-01-31 08:45

    This started happening when I updating to VS2017. The problem for me was node.js, if I deleted the node_modules folder then the project would build without errors. It turns out that changing the value of MvcBuildViews to false in the csproj file as suggested by anders here fixes it. This isn't ideal though since mvc views won't be compiled until IIS renders them. Personally, I just hide the node_modules folder to get around the issue but I wanted to add this answer in case it helps shed some light on the underlying issue for someone else.

    <MvcBuildViews>false</MvcBuildViews>

    0 讨论(0)
  • 2021-01-31 08:45

    My solution to this error was a combination of two pre-existing answers on this page. I had a .h file in my web project directory that had not caused a problem until I tried to build the project on a VS 2017 machine.

    In my case I simply zipped it up, but the upshot seems to be that you can no longer keep unrelated code files in the web directory or VS will trip up trying to compile them.

    0 讨论(0)
  • 2021-01-31 08:46

    For the benefit of those who find this later on google...

    Root Cause

    As the error implies, the assembly "Microsoft.VisualC.CppCodeProvider" couldn't be found.

    This was added to the Global Assembly Cache (GAC) as part of Visual Studio 2015 installation, but not Visual Studio 2017.

    The Fix

    The proper fix is to add the missing reference to the GAC.

    Run the "Developer Command Prompt" as admin, and run the following

    gacutil /i "path to CppCodeProvider.dll" or gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2 017\Professional\Common7\IDE\PublicAssemblies\CppCodeProvider.dll"

    e.g.

    
    C:\Windows\System32>gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2
    017\Professional\Common7\IDE\PublicAssemblies\CppCodeProvider.dll"
    Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.0
    Copyright (c) Microsoft Corporation.  All rights reserved.
    
    Assembly successfully added to the cache
    
    C:\Windows\System32>
    

    On next build the following error is no longer thrown.

    ASPNETCOMPILER error ASPCONFIG: The CodeDom provider type "Microsoft.VisualC.CppCodeProvider, CppCodeProvider, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" could not be located.

    0 讨论(0)
提交回复
热议问题