0

Cuando ejecuto la app y compila, al momento de mostrar todo. Me muestra un error en tal línea con el mensaje de error:

CS0012: The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

Lo cual no me deja y me marca el rojo la línea del html.raw()

<h3 class="box-title">
    Solicitudes
    @Html.Raw(@Html.ActionLink("Agregar", "Create", null, new { @class = "btn btn-info float-right" }).ToHtmlString().Replace("Agregar", "<i class=\"fas fa-plus\"></i>"))
</h3>

Y esto es lo que tengo en mi web.config

<configSections>
    <section name="entityFramework"
      type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
      requirePermission="false"/>
</configSections>
<system.web>
    <globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="es-MX" uiCulture="es-MX"/>
    <authorization>
      <allow users="*"/>
    </authorization>
    <authentication mode="None"/>
    <compilation debug="true" targetFramework="4.5.2"/>
    <httpRuntime targetFramework="4.5.2"/>
</system.web>
<system.webServer>
    <modules>
      <remove name="FormsAuthentication"/>
      <remove name="RoleManager"/>
    </modules>
    <httpProtocol>
      <customHeaders>
        <add name="Access-Control-Allow-Origin" value="*"/>
        <add name="Arr-Disable-Session-Affinity" value="true"/>
      </customHeaders>
    </httpProtocol>
</system.webServer>

Y pues ya después tengo las referencias que uso.

2 respuestas 2

0

Te recomiendo quitar el @Html.Raw y dejarlo como

@Html.ActionLink("Agregar", "Create", new {@class="btn btn-info float-right"})  

o usar simplemente un Link en fin en cuenta al dar click te va redirigir a una nueva vista

4
  • No es eso, me sigue tirando el mismo error.
    – Luis
    el 7 dic. 2022 a las 23:45
  • comparte tu codigo del Web.config y que version estas utilizando del framework lo vez dandole clic izquierdo y propiedades del proyecto el 7 dic. 2022 a las 23:48
  • Uso la version 4.5.2
    – Luis
    el 7 dic. 2022 a las 23:59
  • 1
    @Luis Código en lugar de pantallazos por favor.
    – fredyfx
    el 8 dic. 2022 a las 0:50
0

Busque en el web.config:

<compilation debug="true" targetFramework="4.5.2"/>

Y agregue el System.Runtime en el ensamblaje de la siguiente manera:

<compilation debug="true" targetFramework="4.5.2">
      <assemblies>     
        <add assembly="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />   
      </assemblies>
    </compilation>

Ya con eso ya pudo ejecutarse sin problema alguno.

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.