ReSharper isn't able to resolve Razor - asp.net-mvc-3

I have an ASP.NET MVC 3 Solution within Visual Studio 2010 Premium with Service Pack 1.
In the Web.Config my ReSharper Version (Build 5.1.3000.12) isn't able to resolve System.Web.WebPages.Razor.*
For example
<sectionGroup name="system.web.webPages.razor"
type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup,
System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35">
lets ReSharper mark the error Cannot resolve symbol 'Razor' and error Invalid module qualification: Failed to resolve assembly System.Web.WebPages.Razor
But all views (*.cshtml) are working fine and ReSharper doesn't mark errors there. Also under References I included System.Web.Razor.
This errors also appeared with Visual Studio Premium without Service Pack 1. I'm getting this errors even if I create a new MVC 3 Project out of Visual Studio.
Thanks in advance for any help.

Resharper 5.1 doesn't support Razor, 6.0 will. You can download and use the nightly builds if you like, but they can be somewhat unstable. Use at your own risk.

As others have cited, this is a feature not a bug ;-)
If you would like to avoid annoyance with these errors, you may right click "web.config" in the "Errors in Solution" window (ReSharper -> Windows -> Solution Errors Window) and choose "Ignore Errors." Then they won't bug you any more.
Another plug for the ReSharper EAP program, I used it with 5.0+ and found it to be a reasonable way to get the latest and greatest. As others have said, your stability mileage may vary as these are nightly builds.
http://confluence.jetbrains.net/display/ReSharper/ReSharper+6.0+Nightly+Builds

Related

How can I resolve this error: Loading the include file 'EF.Utility.CS.ttinclude' returned a null or empty string

How can I resolve these errors:
Loading the include file 'EF.Utility.CS.ttinclude' returned a null or empty string.
Value does not fall within the expected range.
Tools Used: VS 2012, Entity Framework 5.0.0, T4MVCExtensions 3.5.0, .NET Framework 4.5
I've been using EF and T4 templates in a project within a large MVC solution without incident. Now, when I right-click on the edmx diagram, EF responds with the message: Value does not fall within the expected range. When I compile the EF project it responds with these messages:
Loading the include file 'EF.Utility.CS.ttinclude' returned a null or empty string. The transformation will not be run. C:\Projects\NSAForms\NSAForms\NSAFormsEDM\NSAFormsEntities.tt
Failed to resolve include text for file:C:\Projects\NSAForms\NSAForms\NSAFormsEDM\EF.Utility.CS.ttinclude C:\Projects\NSAForms\NSAForms\NSAFormsEDM\NSAFormsEntities.tt
Every table in the database has a primary key. I'm struck by how suddenly this issue appeared. Does anyone have some suggestions how to resolve this issue?
Thanks in advance,
Arnold
I had very similar issue and I tried with VS2012 and VS2013.
After reinstalling Entity Framework 6 Tools for Visual Studio 2012
http://www.microsoft.com/en-us/download/confirmation.aspx?id=40762
every thing went back to normal.
In VS 2012, the EF.Utility.CS.ttinclude file will only be installed if the Microsoft Web Developer Tools or Microsoft SQL Server Data Tools component is selected.
Reinstalling Entity Framework 6 Tools for Visual Studio 2012 http://www.microsoft.com/en-us/download/confirmation.aspx?id=40762 work for me
For VS2017, I ended up adding EF6.Utility.CS.ttinclude to model's folder. This resolved my issue with MySql and EF.
File can be found: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\EF6.Utility.CS.ttinclude
UPDATE To avoid doing the above, removing the entities completely then adding back in fixed the issue.
Had this issue with a recent install of VS2017 Enterprise after already having this functionality working in Professional.
The solution for me was to:
Open the Visual Studio Installer program and "Modify" my Enterprise installation.
Select "ASP.NET and web development" under the Web & Cloud section
Click "Modify" in bottom right
It's probably worth noting that I already had EF6 installed and did not need to re-install it to get this to work.
After completing those steps and firing up Visual Studio, the error went away and I was able to generate my classes successfully. Hope this helps!
Visual Studio 2017
was getting the same error but only in a test project. after reviewing the test project and the other project successfully referencing that file i found that adding the following to the app.config of the failing project resolved my issue
<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=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<connectionStrings>
All of the above solutions did not work for me so I created a new project to see if the problem persists but the error did not occur in the newly created project. I then compared the project with the old backup to check recent changes made and found the problem. I recently had upgraded a package Clarius.TransformOnBuild to more recent version after downgrading the package the error went away.
In my case the issue was caused by a bizarre folder name (with %20 instead of spaces). I just made a directory junction to the same folder with spaces instead of %20 and it solved the issue.
Here is the PowerShell command I used to make the junction:
cd "c:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\Microsoft\"
mklink /j "Entity Framework Tools" "Entity%20Framework%20Tools"
Junction created for Entity Framework Tools <<===>> Entity%20Framework%20Tools
You can then use ls look at the directory contents, and you should see these two lines (edited for brevity):
Mode LastWriteTime Length Name
---- ------------- ------ ----
...
d----l 2/27/2019 9:57 AM Entity Framework Tools
d----- 2/26/2019 12:24 PM Entity%20Framework%20Tools
...
Under Mode, the l indicates that it is a "link" (aka junction), and the d indicates it's a directory. By making a junction instead of renaming the folder, you can be sure that both directory names will always work.

Issue when migrating CodedUI test from VS2010 to VS2012

I am having some serious issue when migrating Coded UI test from VS2010 to VS2012. The issue is related to assembly reference. I try to reference the new 11.0 version CodedUI assemblies, but the system keeps looking for the old 10.0 version when VS2012 tries to find all the cases and list in the Test Viewer. Such as:
'Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
I found this MSDN link: http://msdn.microsoft.com/en-us/library/tfs/hh506981(v=vs.110).aspx
It mentions some issue related to assemlby reference. But I don't understand the following quotation:
In Visual Studio 2010, references were added inside a ‘Choose’
statement in the csproj file. In Visual Studio 2012, we are using
a Feedback targets file to include Coded UI Test Assembly references.
What is a Feedback targets file??
I've covered your problem with the answer in this blog post.
You need to open your proj file and check for the logic that has been added to reference properly the version 11.0.0.0 of the testing tools assemblies.
I presume the feedback targets file is the imported msbuild file in the VS 2012 folder for msbuild targets. It is an implementation detail, all you need is to focus in upgrading your project file according to what the "repair" wizard is supposed to do, I give precise steps in my post.
Regards and good luck (if I'm not too late)

Integrating IronScheme into Visual Studio 2010

Is there a way (or can anyone find a way) to import IronScheme into VS2010? I've already taken a look at this question, and I've done everything I could - I even edited the binary files involved to change the version numbers. My question: Does anyone have a solution for getting IronScheme installed into VisualStudio 2010? at present, following the directions to install it into VS2008 does not work for VS2010. Thanks in advance :)
Update 1: I suppose I should post the error I get when I try to follow the directions for installing it via commandline:
C:\Program Files\IronScheme>RegPkg.exe /codebase "C:\Program Files\IronScheme\IronScheme.VisualStudio.dll"
After I run that, I get a Windows 7 popup error:
RegPkg.exe Has Stopped Working - Windows is checking for a solution to
the problem...
When I click out of that, it gives me this error on the console:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Shell.9.0, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.VisualStudio.Shell.9.0, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a'
at Microsoft.VisualStudio.Tools.RegPkg.Main(String[] arguments)
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
I wrote the VS2008 plugin.
When VS2010, the whole API changed again, and if you have ever been in the VS SDK API, you will know it is a maze. I just did not feel like the effort again.
I have a bunch of great ideas but for the life of me I cannot even figure the simple stuff out.
If someone want to actually port my code from VS2008, I would appreciate it. It should not be too hard if you are a bit more familiar with the API than I am.
The source code for the VS2008 plugin is not currently available for the public. Please let me know if anyone is serious about so I can create a github (or similar) repo for it.
Update:
Created a github repo. The code is not the same as the existing DLL I distribute; it contains various half working ideas I was trying.
Update 2:
Here you go :) Very basic, but works on VS2010 and VS11 (should work on Express versions too). Source is in the vs11 branch of above mentioned github repo. It is just a subset of what the VS2008 plugin does as some features seem to be broken or have broken due to bit rot.
Update 3:
Seems the VS2010 plugin fails if only VS2010 is installed. Will have to investigate. Works fine if both VS2010 and VS11 is installed. FIXED :)
I have started rewriting a new plugin.
You can see the github repo for more details:
https://github.com/leppie/IronScheme.VisualStudio2
There is also a download available to try out :)

Legacy Security Policy in Visual Studio 2010 and COM References

I have a project using DevExpress 8.3 (2008.3) which I just recently upgraded to use VS 2010. After doing so, everything compiled fine but I got errors trying to use the designer. I resolved this as described here:
NetFx40_LegacySecurityPolicy in design-time mode
by adding <NetFx40_LegacySecurityPolicy enabled="true"/> to my devenv.exe.config.
Designer works fine now, but some of the projects in the solution which have COM references no longer compile, with the exception:
The "ResolveComReference" task could not be instantiated from "Microsoft.Build.Tasks.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". The security state of an AppDomain was modified by an AppDomainManager configured with the NoSecurityChanges flag.
The COM references for those projects are also flagged with a yellow exclamation mark.
The only google result I found for this error was here:
http://social.msdn.microsoft.com/Forums/en/vsx/thread/197b8dca-5610-4ac5-86fc-c56d5182e46b
which describes the exact same problem but with no resolution. I tried adding
<GenerateResourceNeverLockTypeAssemblies>true<GenerateResourceNeverLockTypeAssemblies>
as the post suggests but that doesn't have any effect for me.
Anyone know anything about this?
Thanks.
I logged into my DX account and found (to my surprise) that DX was offering me an upgrade to a new hotfix version of the same 2008.3 release (even though my subscription is expired). This fixed the problem (and allowed me not to have to use Legacy Security Policy at all).

Why the debugger doesn't work

My debugger is not working,
I'm putting a breakpoint, but in run, time visual studio doesn't stop on the breakPoint.
How to fix it?
There is nothing special in my application, it is a simple web application.
I am using visual studio 2005.
I've created a new web application project, and on the default.aspx page there is a obout grid control, on the default.cs i am filling a datatable and putting it as datatasource for the grid.
I was able to debug it, suddenly the debugger is never hit.
note that the debugger is on the load event.
Find below the steps that solved my problem:
Delete ASP.NET temporary files from C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
Change build configuration to debug from project properties.
Delete bin folder from your project.
Check if compilation debug is set to true in the web.config
iisreset
Rebuild the project.
There are a couple of things that could be wrong:
Your source code and assembly could be out of sync - rebuild the application and try again.
You could be attached to the wrong process - check to see what process you are attached to.
There could be a logical error in your code that is causing your breakpoint to not be hit (i.e. the method you are in is not actually called, logical branching is routing control around the breakpoint, etc.)
Break point was not getting hit, i cleaned and rebuild, but still not hitting, I just reopened the page (In my case Controller) and started working fine ..
When everything failed try this:
Right mouse button on your project -> Build -> untick 'Optimize code'
Or
I had similar problems when I've installed dotPeek and maybe because I don't have Resharper it was loading symbols from dotPeek symbol server but it couldn't hit my breakpoint. In that case Open dotPeek and click on Stop Symbol Server.
The symbols probably aren't loaded, that's why the breakpoint won't be hit. Did you set the website as the startup project?
When debugging, what process it attached? It should be w3wp.exe if you want to debug asp.net code.
You might need to set your application in web config so that it can be debugged..
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
You need to be running in Debug mode, and not Release mode.
Here's a detailed article about How to: Enable Debugging for ASP.NET Applications Basically, you can either set debug mode in project properties or in web.config.
try uncheck "Enable the Visual Studio hosting process"
that in project properties -> debug
worked for me
This can occur when Visual Studio is set to debug Managed code but the code is not managed (managed code is running under the control of the common language runtime (CLR)).
To fix the problem change the debug mode as shown in the right hand side of the figure below to Native only, Mixed, or Auto.
Side note: I recommend not choosing Mixed unless your system has both managed and native code (code that does not run under the CLR) because Visual Studio can't attach to an already running process in mixed mode. To debug an already running code Visual Studio need to be set to debug in Native only or Managed only.
I've seen the already existing answers have listed many possible causes, but I'd like to add one more: if you're using post-compilation tools (such as ILMerge), check whether those tools keep your debugging information (is there a .pdb file? or maybe you have embedded it in your compilation output). For those ones who are actually using AfterBuild tasks in their .csproj I really suggest to check out.
You can enable Debug as below steps.
1) Right click project solution
2) Select Debug( can find left side)
3) select Debug in Configuration dropdown.
Now run your solution. It will hit breakpoint.
Are you debugging using IIS Express instead of IIS Local. I found IIS Express sometime won't hit debug points, IIS Local works fine.
You could be like me to have both a production version (installed via a msi file) and a development version (opened in Visual Studio), and that is why I cannot get some of my breakpoints in the VS triggered today.
If that is the case you need to uninstall the production version as I think some of the dll files are interfering with my debugging session.
Clean and Rebuild your solution afterwards should fix the issue.
if you are using publish and IIS, then check your Publish configuration, make sure it says Debug
Go to publish window
[1]: https://i.stack.imgur.com/X9Dke.png
In Visual Studio 2010
Select Build > Clean {Project Name}
Rebuild Project
Now Try to rebuild project and try debug
All the best
After installing following add-on it started working. After installing, restart visual studio once. Install plug-in as per VS version.
https://download.qt.io/official_releases/vsaddin/

Resources