YAFLogo

johnyjj2
  • johnyjj2
  • 51.4% (Neutral)
  • YAF Forumling Topic Starter
7 years ago
Hello,

I have just downloaded "YAF.NET v2.2.3 Sample Web Application" and successfully built it with Microsoft Visual Studio Community 2017 (Version 15.2). I had this error "Could not load file or assembly 'System.Web.Helpers, Version=2.0.0.0" so I have used "Install-Package microsoft-web-helpers" in NuGet console. Now I'm trying to fix "Could not load file or assembly 'System.Web.Mvc, Version=4.0.0.0" but then I have this error:

Server Error in '/' Application.

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Could not load file or assembly 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Source Error:

Line 42:

Line 43:

Line 44:

Line 45:

Line 46:

Source File: C:\Users\myuser\Downloads\YAF.SampleWebApplication-v2.2.3-C\YAF.SampleWebApplication\web.config    Line: 44

Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.

=== Pre-bind state information ===

LOG: DisplayName = System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

(Fully-specified)

LOG: Appbase = file:///C:/Users/myuser/Downloads/YAF.SampleWebApplication-v2.2.3-C/YAF.SampleWebApplication/

LOG: Initial PrivatePath = C:\Users\myuser\Downloads\YAF.SampleWebApplication-v2.2.3-C\YAF.SampleWebApplication\bin

Calling assembly : (Unknown).

===

LOG: This bind starts in default load context.

LOG: Using application configuration file: C:\Users\myuser\Downloads\YAF.SampleWebApplication-v2.2.3-C\YAF.SampleWebApplication\web.config

LOG: Using host configuration file: C:\Users\myuser\OneDrive\Dokumenty\IISExpress\config\aspnet.config

LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.

LOG: Post-policy reference: System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

LOG: Attempting download of new URL file:///C:/Users/myuser/AppData/Local/Temp/Temporary ASP.NET Files/vs/551eec6e/5af4a661/System.Web.Mvc.DLL.

LOG: Attempting download of new URL file:///C:/Users/myuser/AppData/Local/Temp/Temporary ASP.NET Files/vs/551eec6e/5af4a661/System.Web.Mvc/System.Web.Mvc.DLL.

LOG: Attempting download of new URL file:///C:/Users/myuser/Downloads/YAF.SampleWebApplication-v2.2.3-C/YAF.SampleWebApplication/bin/System.Web.Mvc.DLL.

LOG: Attempting download of new URL file:///C:/Users/myuser/Downloads/YAF.SampleWebApplication-v2.2.3-C/YAF.SampleWebApplication/bin/System.Web.Mvc/System.Web.Mvc.DLL.

LOG: Attempting download of new URL file:///C:/Users/myuser/AppData/Local/Temp/Temporary ASP.NET Files/vs/551eec6e/5af4a661/System.Web.Mvc.EXE.

LOG: Attempting download of new URL file:///C:/Users/myuser/AppData/Local/Temp/Temporary ASP.NET Files/vs/551eec6e/5af4a661/System.Web.Mvc/System.Web.Mvc.EXE.

LOG: Attempting download of new URL file:///C:/Users/myuser/Downloads/YAF.SampleWebApplication-v2.2.3-C/YAF.SampleWebApplication/bin/System.Web.Mvc.EXE.

LOG: Attempting download of new URL file:///C:/Users/myuser/Downloads/YAF.SampleWebApplication-v2.2.3-C/YAF.SampleWebApplication/bin/System.Web.Mvc/System.Web.Mvc.EXE.

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.2046.0

I've tried to solve it like this:

PM> Install-Package Microsoft.AspNet.Mvc

Attempting to gather dependency information for package 'Microsoft.AspNet.Mvc.5.2.3' with respect to project 'YAF.SampleWebApplication', targeting '.NETFramework,Version=v4.0'

Gathering dependency information took 1,71 sec

Attempting to resolve dependencies for package 'Microsoft.AspNet.Mvc.5.2.3' with DependencyBehavior 'Lowest'

Install-Package : Unable to resolve dependencies.

At line:1 char:1

+ Install-Package Microsoft.AspNet.Mvc

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception

+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdl

ets.InstallPackageCommand

Time Elapsed: 00:00:02.4767138

And similar attempt:

PM> install-package microsoft.aspnet.mvc -version 4.0

Attempting to gather dependency information for package 'microsoft.aspnet.mvc.4.0.0' with respect to project 'YAF.SampleWebApplication', targeting '.NETFramework,Version=v4.0'

install-package : Package 'microsoft.aspnet.mvc 4.0' is not found in the following primary source(s

): 'https://api.nuget.org/v3/index.json,C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'. Plea

se verify all your online package sources are available (OR) package id, version are specified corr

ectly.

At line:1 char:1

+ install-package microsoft.aspnet.mvc -version 4.0

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception

+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdl

ets.InstallPackageCommand

Time Elapsed: 00:00:00.6849268

Could you, please, suggest the correct way?

Thank you!

Sponsor
tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.0 rc 2
7 years ago
Please open the web.config file and remove the lines...


        <!-- MVC Integrtation -->
        <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <!-- MVC Integrtation -->

and...

<!-- MVC Integrtation -->
      <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      <!-- MVC Integrtation -->

and...

<!-- MVC Integrtation -->
        <add namespace="System.Web.Mvc"/>
        <add namespace="System.Web.Mvc.Ajax"/>
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing"/>
        <add namespace="System.Linq"/>
        <add namespace="System.Collections.Generic"/>
        <!-- MVC Integrtation -->