Visual Studio的智能感知搞乱 [英] Visual studio intellisense messing up
问题描述
所以,我是新来MVC4和C#中,我一直在约2周设计这个网站,再也没有出现过与智能感知的任何问题。
用于2天了Visual Studio是告诉我,@Viewbag和其他@命令是不是我的项目的一部分,我可能失去了一些东西,或者告诉我,Viewbag不会在当前的背景下存在的。
我不能确定如何解决这一问题(我已经重新启动该项目,并在机器IM工作)仍然显示下划线,并告诉我,它不会在上下文存在
由于我当我看着还很新/尝试新的code这是非常困难的,因为的所有的是错的..
例如图片:
块引用>
长错误,您可以勉强读完指出,
System.Web.WebPages.Html.htmlHelper'不包含定义'ActionLink的失踪....集引用?
块引用>我得到这个错误任何@ codeS中的Razor视图藏汉exept C#@的
WebConfig文件
块引用><?XML版本=1.0编码=UTF-8&GT?;
<! -
有关如何配置ASP.NET应用程序的更多信息,请访问:
http://go.microsoft.com/fwlink/?LinkId=169433
- >
<结构>
< configSections>
<! - 有关Entity Framework的配置的详细信息,请访问http://go.microsoft.com/fwlink/?LinkID=237468 - >
<节名称=的EntityFrameworkTYPE =System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection,的EntityFramework,版本5.0.0.0 =文化=中性公钥= b77a5c561934e089requirePermission =FALSE/>
< / configSections>
<&是connectionStrings GT;
<添加名称=DefaultConnection的connectionString =服务器= ANE-SQL \\ ANESQLSERVER;数据库= OilGas;用户ID =软件;密码= GLvp $ 102,的providerName =System.Data.SqlClient的/>
< /&是connectionStrings GT;
<&的appSettings GT;
<添加键=网页:版本值=2.0.0.0/>
<添加键=网页:启用VALUE =FALSE/>
<添加关键=preserveLoginUrlVALUE =真/>
<添加键=ClientValidationEnabledVALUE =真/>
<添加键=UnobtrusiveJavaScriptEnabledVALUE =真/>
< /的appSettings>
<&的System.Web GT;<的customErrors模式=仅限远程>< /&的customErrors GT;
<编译调试=真targetFramework =4.5/>
<的httpRuntime targetFramework =4.5/>
<身份验证模式=表格>
<形式loginUrl =〜/帐号/登录超时=180/>
< /认证>
<网页和GT;
<&命名空间GT;
<添加命名空间=System.Web.Helpers/>
<添加命名空间=System.Web.Mvc/>
<添加命名空间=System.Web.Mvc.Ajax/>
<添加命名空间=System.Web.Mvc.Html/>
<添加命名空间=System.Web.Optimization/>
<添加命名空间=System.Web.Routing/>
<添加命名空间=System.Web.WebPages/>
< /命名空间>
< /页>< /system.web>
< system.webServer>
&所述;! - &下;模块runAllManagedModulesForAllRequests =真/&GT - →;
<验证validateIntegratedModeConfiguration =FALSE/>
<&处理GT;
<清除NAME =ExtensionlessUrlHandler-ISAPI-4.0_32bit/>
<清除NAME =ExtensionlessUrlHandler-ISAPI-4.0_64bit/>
<清除NAME =ExtensionlessUrlHandler - 集成 - 4.0/>
<添加名称=ExtensionlessUrlHandler-ISAPI-4.0_32bitPATH =*。动词=GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS模块=IsapiModulescriptProcessor =%WINDIR%\\ Microsoft.NET \\框架\\ v4.0.30319 \\ ASPNET_ISAPI.DLLpreCondition = classicMode,runtimeVersionv4.0,bitness32responseBufferLimit =0/>
<添加名称=ExtensionlessUrlHandler-ISAPI-4.0_64bitPATH =*。动词=GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS模块=IsapiModulescriptProcessor =%WINDIR%\\ Microsoft.NET \\ Framework64 \\ v4.0.30319 \\ ASPNET_ISAPI.DLLpreCondition = classicMode,runtimeVersionv4.0,bitness64responseBufferLimit =0/>
<添加名称=ExtensionlessUrlHandler - 集成 - 4.0PATH =*。动词=GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONSTYPE =System.Web.Handlers.TransferRequestHandlerpreCondition =integratedMode,runtimeVersionv4.0/>
< /处理器>
< /system.webServer>
<&运行GT;
< assemblyBinding的xmlns =瓮:架构 - 微软COM:asm.v1>
< dependentAssembly>
< assemblyIdentity名称=DotNetOpenAuth.Core公钥=2780ccd10d57b246/>
< bindingRedirect oldVersion =1.0.0.0-4.0.0.0NEWVERSION =4.1.0.0/>
< / dependentAssembly>
< dependentAssembly>
< assemblyIdentity名称=DotNetOpenAuth.AspNet公钥=2780ccd10d57b246/>
< bindingRedirect oldVersion =1.0.0.0-4.0.0.0NEWVERSION =4.1.0.0/>
< / dependentAssembly>
< dependentAssembly>
< assemblyIdentity名称=System.Web.Helpers公钥=31bf3856ad364e35/>
< bindingRedirect oldVersion =1.0.0.0-2.0.0.0NEWVERSION =2.0.0.0/>
< / dependentAssembly>
< dependentAssembly>
< assemblyIdentity名称=System.Web.Mvc公钥=31bf3856ad364e35/>
< bindingRedirect oldVersion =1.0.0.0-4.0.0.0NEWVERSION =4.0.0.0/>
< / dependentAssembly>
< dependentAssembly>
< assemblyIdentity名称=System.Web.WebPages公钥=31bf3856ad364e35/>
< bindingRedirect oldVersion =1.0.0.0-2.0.0.0NEWVERSION =2.0.0.0/>
< / dependentAssembly>
< dependentAssembly>
< assemblyIdentity名称=WebGrease公钥=31bf3856ad364e35/>
< bindingRedirect oldVersion =1.0.0.0-1.3.0.0NEWVERSION =1.3.0.0/>
< / dependentAssembly>
< / assemblyBinding>
< /运行>
<&的EntityFramework GT;
< defaultConnectionFactory TYPE =System.Data.Entity.Infrastructure.LocalDbConnectionFactory,的EntityFramework>
<&参数GT;
<参数值=11.0/>
< /参数>
< / defaultConnectionFactory>
< /&的EntityFramework GT;
< /结构>
解决方案创建一个新的互联网web应用程序拿出你的变化(从旧code)将新创建的互联网Web应用程序的配置文件,添加老变回(跳过一行全部看完线看是否有任何真正被搞乱了)
希望帮助
So I'm new to MVC4 and C#, I have been designing this website for about 2 weeks now and there have not been any issues with the intelisense.
For 2 days now Visual studio is telling me that @Viewbag and other @ commands are not part of my project and i may be missing something or it tells me that Viewbag doesn't exist in the current context.
I'm unsure how to fix this ( i have restarted the project and the machine im working on ) still showing up underlined and tells me it doesn't exists in the context
Since I'm still new when i look / try new code this is very difficult since everything is wrong..
Example Images :
The long error you can barely read states that
System.Web.WebPages.Html.htmlHelper' does not contain a definition for 'Actionlink' .... missing assembly reference ?
I get this error for any @codes in the Razor view aswell exept C# @'s
WebConfig File
<?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=169433 --> <configuration> <configSections> <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> </configSections> <connectionStrings> <add name="DefaultConnection" connectionString="Server=ANE-SQL\ANESQLSERVER;Database=OilGas;User Id=software;Password=GLvp$102;" providerName="System.Data.SqlClient" /> </connectionStrings> <appSettings> <add key="webpages:Version" value="2.0.0.0" /> <add key="webpages:Enabled" value="false" /> <add key="PreserveLoginUrl" value="true" /> <add key="ClientValidationEnabled" value="true" /> <add key="UnobtrusiveJavaScriptEnabled" value="true" /> </appSettings> <system.web> <customErrors mode="RemoteOnly"></customErrors> <compilation debug="true" targetFramework="4.5" /> <httpRuntime targetFramework="4.5" /> <authentication mode="Forms"> <forms loginUrl="~/Account/Login" timeout="180" /> </authentication> <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.Optimization" /> <add namespace="System.Web.Routing" /> <add namespace="System.Web.WebPages" /> </namespaces> </pages> </system.web> <system.webServer> <!--<modules runAllManagedModulesForAllRequests="true" />--> <validation validateIntegratedModeConfiguration="false" /> <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> </system.webServer> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" /> <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" /> <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-1.3.0.0" newVersion="1.3.0.0" /> </dependentAssembly> </assemblyBinding> </runtime> <entityFramework> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> <parameters> <parameter value="v11.0" /> </parameters> </defaultConnectionFactory> </entityFramework> </configuration>
解决方案Create a new Internet web app take out your changes ( from the old code ) Insert the newly created Internet Web App config file, Add old changes back ( skip all the reading line by line see if any of that really was messing up )
Hope that helps
这篇关于Visual Studio的智能感知搞乱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!