4

我正在编译Windows 7 64位上的Visual Studio 2010中的MVC2应用程序。我运行下面的生成后事件命令:aspnet_compiler在C#mvc2应用程序上寻找jsharp代码提供者

aspnet_compiler.exe -v/-p \ 

它导致以下错误: -

The CodeDom provider type "Microsoft.VJSharp.VJSharpCodeProvider, VJSharpCodeProvider, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" could not be located 

我在我的解决方案没有J#。我已经下载了J#2.0可再发行组件包第二版,但这没有帮助。

有趣的是,我在一个全新的MVC2解决方案中运行了它,并得到了相同的错误!所以它与我的应用程序无关。

我错过了什么导致这个错误?

我已经阅读了许多其他职位,说你需要安装可再发行,在web.config等添加引用,但他们没有帮助。

任何想法??

+1

也许这个博客文章可以帮助你:http://blogs.telerik.com/manoldonev/posts/07-12-01/the_codedom_provider_type_microsoft_vjsharp_vjsharpcodeprovider_could_not_be_located.aspx – 2011-02-21 14:24:31

回答

1

@Adrian - 我今天有这个问题,并且几乎马上修复它,它试图在C#项目中编译J#,奇怪的错误。但问题是我复制了一个.java文件到我的项目文件夹中,并出现问题。一旦我删除了它,这一切都编译得很好。

+0

你刚刚救了我的屁股,谢谢。 – 2011-10-14 13:08:19

3

我今天有这种事情,并找到了各种解决方案。

我使用VS 2010和ASP.NET MVC 3站点,使用Razor,在IIS(不是IIS Express或Cassini)中运行。

在我的情况下,这个错误在我的.cshtml视图中突然出现。对于我打开的任何观点,第一@using线被强调与错误:

C:\PathToMyCode\PathToMyViews\Index.cshtml: ASP.NET runtime error: Could not load file or assembly 'VJSharpCodeProvider, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. An error relating to security occurred. (Exception from HRESULT: 0x8013150A)

也有整个页面离奇失误,如具有相同名称的两个组件之间的暧昧引用(例如之间所谓的冲突“ System.Web.Helpers“和”System.Web.Helpers“)。

原因:我在没有足够权限的用户帐户下运行该网站。该帐户具有IIS_IUSRS角色,但显然还有一些其他角色或访问需要使其工作,或者它可能需要访问它无法访问的特定文件夹。

不幸的是,我不知道它是什么,我也不高兴浪费时间弄明白的想法后,我已经花了太多时间试图找出如何发生摆在首位。

但是给该用户管理员角色解决了错误

我意识到这不是一个理想的解决方案,但我希望至少它会让一些人失去知觉。如果有人确切知道需要什么权限来防止此错误,请在下面评论,也许我们可以缩小它的范围。

+0

有趣。我从来没有找到解决这个问题的办法,而且我已经搬到了一个新项目,所以我没有机会。很高兴你有一些工作。 – Thomas 2011-05-11 17:07:36

1

@Kyralessa:我的确切的同样的错误。将管理员角色添加到网站正在运行的用户“固定”的问题,但正如你所说,它不是一个理想的解决方案。

所以我摆弄IIS设置,并在网站的基本设置下,我切换到“应用程序用户(传递身份验证)”,问题消失了。应用程序池仍然在同一个(非管理员)用户下运行,所以没有安全问题。

0

当我将csproj中的MvcBuildViews属性设置为true时,我遇到了同样的错误。经过大量研究和试验/错误,我了解到问题是因为我们的网站在网站结构中有.java文件。这些java文件不是解决方案的一部分,只是松散的文件。 Aspnetcompiler任务从项目根目录运行,因此它可以找到所有类型的问题,如重复的web.configs和* .java文件。

为了解决这个问题,我创建了以下目标在MVC项目文件,我试图调试:

<Target Name="MvcBuildViews" AfterTargets="Build" Condition="'$(MvcBuildViews)'=='true'"> 
    <!-- This task performs compilation of the CSHTML files in the web structure 
    and will generate compiler errors if there are issues in the views, such as missing 
    resource strings, broken class locations, etc. 
    Due to an issue with the AspNetCompiler task identifing .java files as candidates for 
    compilation, we will temporarily rename all of the java files in the project to .xyz 
    so they are skipped by aspnet compiler. Then we rename them back. 
    Extra web.configs also cause an error, so those are temporarily moved. --> 
    <CreateItem Include="$(ProjectDir)**\*.java"> 
     <Output TaskParameter="Include" ItemName="JavaFolderA"/> 
    </CreateItem> 
    <CreateItem Include="$(ProjectDir)obj\**\web.config"> 
     <Output TaskParameter="Include" ItemName="ExtraWebConfigsA"/> 
    </CreateItem>  
    <Move SourceFiles="@(JavaFolderA)" DestinationFiles="@(JavaFolderA->'$(ProjectDir)%(RecursiveDir)%(FileName).xyz')"/> 
    <Move SourceFiles="@(ExtraWebConfigsA)" DestinationFiles="@(ExtraWebConfigsA->'$(ProjectDir)%(RecursiveDir)%(FileName).ccc')"/> 

    <AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" /> 

    <CreateItem Include="$(ProjectDir)**\*.xyz"> 
     <Output TaskParameter="Include" ItemName="JavaFolderB"/> 
    </CreateItem> 
    <CreateItem Include="$(ProjectDir)obj\**\web.ccc"> 
     <Output TaskParameter="Include" ItemName="ExtraWebConfigsB"/> 
    </CreateItem> 
    <Move SourceFiles="@(JavaFolderB)" DestinationFiles="@(JavaFolderB->'$(ProjectDir)%(RecursiveDir)%(FileName).java')"/> 
    <Move SourceFiles="@(ExtraWebConfigsB)" DestinationFiles="@(ExtraWebConfigsB->'$(ProjectDir)%(RecursiveDir)%(FileName).config')"/> 
</Target> 

希望这样可以节省别人3个小时的我花了找出...

更新: 因为这样做更多的时间添加到构建,你可以选择在顶部加入到条件发布在款式只能执行此项检查建立:

<Target Name="MvcBuildViews" AfterTargets="Build" Condition="'$(MvcBuildViews)'=='true' AND '$(Configuration)' == 'Release'"> 
相关问题