使用Visual Studio 2013从mvc4升级到mvc5

时间:2013-11-21 19:52:08

标签: visual-studio asp.net-mvc-4 web-config nuget asp.net-mvc-5

我切换到升级并更新了正确的nuget包,在我的web.config中设置了条目等,但是我的视图中存在一个问题,显然是由于机器上仍有两个版本的mvc 4 &安培; 5.

当我为我的项目管理nuget包时,它说要重新启动visual studio以便它可以卸载它(它没有)。它还说我可以在我的activitylog.xml文件中找到更多关于它的信息,在搜索整个驱动​​器时我没有这个信息。

问题是,如何从我的机器手动卸载以下内容? 的 Microsoft.AspNet.MVC.4.0.20710.0

下面是我的packages.config文件的内容:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="CodeContracts.Unofficial" version="1.0.0.2" targetFramework="net45" />
  <package id="DataAnnotationsExtensions" version="1.1.0.0" targetFramework="net45" />
  <package id="DataAnnotationsExtensions.MVC3" version="1.1.0.0" targetFramework="net45" />
  <package id="DotNetOpenAuth.AspNet" version="4.0.3.12153" targetFramework="net45" />
  <package id="DotNetOpenAuth.Core" version="4.0.3.12153" targetFramework="net45" />
  <package id="DotNetOpenAuth.OAuth.Consumer" version="4.0.3.12153" targetFramework="net45" />
  <package id="DotNetOpenAuth.OAuth.Core" version="4.0.3.12153" targetFramework="net45" />
  <package id="DotNetOpenAuth.OpenId.Core" version="4.0.3.12153" targetFramework="net45" />
  <package id="DotNetOpenAuth.OpenId.RelyingParty" version="4.0.3.12153" targetFramework="net45" />
  <package id="EntityFramework" version="6.0.1" targetFramework="net45" />
  <package id="Glimpse" version="1.8.0" targetFramework="net45" />
  <package id="Glimpse.Ado" version="1.7.0" targetFramework="net45" />
  <package id="Glimpse.EF6" version="1.6.0" targetFramework="net45" />
  <package id="Glimpse.MiniProfiler" version="1.2.3" targetFramework="net45" />
  <package id="jQuery" version="1.7.1.1" targetFramework="net45" />
  <package id="jQuery.Validation" version="1.11.1" targetFramework="net45" />
  <package id="Microsoft.AspNet.Mvc" version="5.0.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.Razor" version="3.0.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.Web.Optimization" version="1.0.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi" version="4.0.20710.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi.Client" version="4.0.20710.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi.Core" version="4.0.20710.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi.WebHost" version="4.0.20710.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebPages" version="3.0.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebPages.Data" version="3.0.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebPages.OAuth" version="2.0.30506.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebPages.WebData" version="3.0.0" targetFramework="net45" />
  <package id="Microsoft.jQuery.Unobtrusive.Ajax" version="3.0.0" targetFramework="net45" />
  <package id="Microsoft.jQuery.Unobtrusive.Validation" version="3.0.0" targetFramework="net45" />
  <package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net45" />
  <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
  <package id="MiniProfiler" version="2.1.0" targetFramework="net45" />
  <package id="Modernizr" version="2.6.2" targetFramework="net45" />
  <package id="Newtonsoft.Json" version="4.5.6" targetFramework="net45" />
  <package id="Twitter.Helper" version="1.0" targetFramework="net45" />
  <package id="WebGrease" version="1.3.0" targetFramework="net45" />
</packages>

下面是我的web.config文件的内容:

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=152368
  -->
<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
  </configSections>
  <connectionStrings configSource="Configs\Prod\connectionStrings.config" />
  <appSettings configSource="Configs\Prod\appSettings.config" />
  <system.web>
    <authorization>
      <allow roles="Admin" />
      <allow roles="AdminStage" />
    </authorization>
    <compilation debug="true" targetFramework="4.5">
      <assemblies>
        <add assembly="System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      </assemblies>
    </compilation>
    <authentication mode="Forms">
      <forms loginUrl="~/Account/LogOn" timeout="60" />
    </authentication>
    <membership>
      <providers>
        <clear />
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
      </providers>
    </membership>
    <profile>
      <providers>
        <clear />
        <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="LocalSqlServer" applicationName="/" />
      </providers>
    </profile>
    <roleManager enabled="true">
      <providers>
        <clear />
        <add connectionStringName="LocalSqlServer" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" />
        <add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" />
      </providers>
    </roleManager>
    <httpRuntime targetFramework="4.5" executionTimeout="720" maxRequestLength="1048576" />
    <trust level="Full"></trust>
    <sessionState mode="SQLServer" allowCustomSqlDatabase="true" sqlConnectionString="data Source=s07.winhost.com;database=DB_36079_yeagertech;user id=DB_36079_yeagertech_user;password=Bellay58" cookieless="false" timeout="60" />
    <machineKey compatibilityMode="Framework45" validationKey="C63E672C62DC06F295AAACD40F41A0340F37C5D28477FA01D90DEAFBE90E163BDF56ECF72DFD9B09D89B3A1E080DCD82712F87B5A7E328EB3AB2F79572F65F2D" decryptionKey="837239C11FF36D980633F216C2AD9CD977527B15D631803712B4DFD3891606F0" validation="SHA1" decryption="AES" />
    <pages>
      <namespaces>
        <add namespace="System.Web.Helpers" />
        <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.Web.WebPages" />
        <add namespace="Kendo.Mvc.UI" />
      </namespaces>
    </pages>
  </system.web>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"></modules>
    <handlers>
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
    <security>
      <authentication>
        <basicAuthentication enabled="false" />
      </authentication>
    </security>
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
                <dependentAssembly>
                    <assemblyIdentity name="System.Web.Helpers" culture="neutral" publicKeyToken="31bf3856ad364e35" />
                    <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
                </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Web.WebPages" culture="neutral" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Web.WebPages.Razor" culture="neutral" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
            </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="PostSharp" publicKeyToken="b13fd38b8f9c99d7" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.32.9" newVersion="3.0.32.9" />
      </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Mvc" culture="neutral" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="5.0.0.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Razor" culture="neutral" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="WebMatrix.Data" culture="neutral" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="WebMatrix.WebData" culture="neutral" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Web.WebPages.Deployment" culture="neutral" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
            </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v11.0" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
  <system.serviceModel>
    <serviceHostingEnvironment minFreeMemoryPercentageToActivateService="0">
      <serviceActivations>
        <add relativeAddress="~/yeagerte/YeagerTechWcfService.YeagerTechWcfService.svc" service="YeagerTechWcfService" />
      </serviceActivations>
    </serviceHostingEnvironment>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IYeagerTechWcfService" />
        <binding name="BasicHttpBinding_IYeagerTechWcfService1" />
      </basicHttpBinding>
    </bindings>
    <diagnostics wmiProviderEnabled="true">
      <messageLogging logMessagesAtTransportLevel="true" logMessagesAtServiceLevel="true" logMalformedMessages="true" logEntireMessage="true" maxSizeOfMessageToLog="2147483647" maxMessagesToLog="500" />
    </diagnostics>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, 
          set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="True" />
          <!-- To receive exception details in faults for debugging purposes, 
          set the value below to true.  Set to false before deployment 
          to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="True" />
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services configSource="Configs\Prod\system.serviceModel.services.config" />
    <client configSource="Configs\Prod\system.serviceModel.client.config" />
  </system.serviceModel>
  <system.net>
    <mailSettings>
      <smtp from="postmaster@yeagertech.com">
        <network host="m05.internetmailserver.net" password="Bellay58" userName="postmaster@yeagertech.com" port="587" />
      </smtp>
    </mailSettings>
  </system.net>
</configuration>

我将connectionstrings和system.servicemodel配置文件保留了,因为他们不应该这样做。

我的appsettings.config文件如下:

<?xml version="1.0"?>
<appSettings>
  <add key="webpages:Version" value="2.0.0.0" />
  <add key="webpages:Enabled" value="true" />
  <add key="PreserveLoginUrl" value="true" />
  <add key="ClientValidationEnabled" value="true" />
  <add key="UnobtrusiveJavaScriptEnabled" value="true" />
  <add key="Env" value="Prod"/>
  <add key="Domain" value="yeagertech.com"/>
  <add key="UserName" value="yeagerte"/>
  <add key="Password" value="Bellay58"/>
  <add key="microsoft.visualstudio.teamsystems.aspnetdevserver:/" value="4514;True;15712;1;-8588719243754423046" />
  <add key="microsoft.visualstudio.teamsystems.backupinfo" value="1;web.config.backup.16312425-023f-49eb-a968-4e0afc4a422a" />
</appSettings>

1 个答案:

答案 0 :(得分:0)

(在问题编辑中回答。转换为社区维基回答。请参阅What is the appropriate action when the answer to a question is added to the question itself?

OP写道:

  

当我签入我的项目并重新启动visual studio时,我在输出窗口中收到以下消息:在您的工作区中找不到项C:\Users\byeager\Documents\Visual Studio 2013\Projects\YeagerTechSolution\packages\Microsoft.AspNet.Mvc.4.0.20710.0,或者您无权访问它

     

在完成上述检查后,我相信已经解决 ....