For some reason, with the Razor view engine, VS is crashing on me. I copied the CSHTML content over to a VBHTML file and begin reformatting it, and VS has crashed on me twice now as I change a helper or function method syntax from:
#helper SomeHelper(string text)
to
#Helper SomeHelper(text As String)
Is anyone else getting this? The whole machine must be rebooted to get intellisense/markup highlighing to work.
Thanks.
If you are using Visual Studio 2010, I suggest that you install SP1. Support for Razor views is improved.
Link to Download
Link to Change list
Related
I'm running a clean install of VS Enterprise 15.5 and have just disabled R# to see what VS is actually capable of lately (and I was tired of it being so slow).
We do lots of work with ASPNet Core cshtml files. I noticed there are no quick actions when editing the razor file. For example:
The editor can see that a #using tag is unnecessary, but there is no quick action (lightbulb) to suggest that it be removed.
Same with a class that is referenced below (Notification), there is no quick action to suggest that a #using tag be added.
In normal .cs files these actions work nicely, and I am a bit surprised not to see this in razor files. Is something not setup correctly?
Resharper had these suggestions and I figured that VS would as well, but perhaps I am wrong?
A new Razor editor in Visual Studio with support for quick actions (Ctrl+.) is under development. The image below shows you how to enable the preview for this feature:
https://devblogs.microsoft.com/aspnet/wp-content/uploads/sites/16/2020/07/enable-experimental-razor.png
You can read more here:
https://devblogs.microsoft.com/aspnet/new-experimental-razor-editor-for-visual-studio/
Are there no quick actions when editing razor (cshtml) files?
Nothing build in for VS-2015 or VS-2017. Although if you just add a web.config and namespaces you don't need any using statements in razor files.
I have downloaded Visual Studio 2015 Community edition. I have tried to create an MVC project. I have gone through his process:
1) File/New Project/ - C# ASP.NET
2) Select MVC project
3) Project is created
4) Build and click debug
The error I get is this: "0x800a1391 - JavaScript runtime error: 'jQuery' is undefined" Error. I have downloaded Visual Studio 2013 Community edition and followed the instructions above and I am prompted with the same error.
I found this: https://www.youtube.com/watch?v=_yrwhqoT1Bg. I followed the instructions expect I specified: #Scripts.Render("~/Scripts/jquery-1.10.2.min.js") as jquery-1.8.2.min.js does not exist, but jquery-1.10.2.min.js does. I am prompted with the same error after doing this.
What is the problem? This is a new project. I have added nothing.
It seems that #Scripts.Render("~/Scripts/jquery-1.10.2.min.js") doesn't exist
Just render the script this way
#Scripts.Render("~/bundles/jquery")
and make sure that you have it in your BundleConfig.cs this way
bundles.Add(new ScriptBundle("~/bundles/jquery").Include("~/Scripts/jquery-{version}.js"));
Also, if you are using IE browser, then try to use the latest version of JQuery, as the JQuery has some compatibility issues with the IE
In a Siteocre project I want to compile all cshtml files using the MvcBuildViews setting. Unfortunately this also compiles any ascx and aspx files. I get an error like :
32>/temp/Sitecore/admin/Wizard/InstallationLog.ascx(1): error
ASPPARSE: The base class includes the field 'logPanel', but its type
(System.Web.UI.HtmlControls.HtmlGenericControl) is not compatible with
the type of control (System.Web.UI.HtmlControls.HtmlIframe).
Is there a way to restrict the view compilation to cshtml only?
I will transform my comment into an answer.
Your approach to have Sitecore inside your Visual Studio folder is not correct.
You need to separate your Visual Studio and website folder where IIS is mapping your site.
On next link is explained very well how to create a Visual Studio Project for Sitecore MVC .
http://sitecore-community.github.io/docs/sitecore-mvc/creating-project/
I think my problem is that I don't have Angular JS properly configured on my machine or Visual Studio 2015, but I'm not sure. All I know is that my app is showing a blank page and that Visual Studio 2015 is not recognizing Angular tags. Can someone explain what I'm missing and how to add it?
I have been given a Visual Studio solution from a client and need to get it running. I know it uses some kind of Angular JS and seems to be using C# 6.0 and needs Visual Studio 2015 to compile. I have never used VS2015, C#6.0, or Angular before. I usually develop asp.net/C# apps in VS2013.
The project compiles (I can clean and rebuild it), but the initial screen is blank. The page source of that page seems to be the code I want however. In VS, I can see it doesn't recognize certain tags. I thought that I needed to include a reference or download something related to Angular. I re-downloaded the Angular files from https://angularjs.org/. I also tried explicitly reference the angular.js file in the head of the aspx page as shown here: https://www.npmjs.com/package/angular-material. I also tried adding the angular to intellisense as described here: AngularJS intellisense not working on Visual Studio 2015. None of these are working.
In VS, I'm getting warnings on lines like these:
<body ng-cloak ng-controller="litm.xyz.recipes.IndexController">
<div layout="column" layout-fill>
<md-toolbar>
<md-button class="md-icon-button" aria-label="Settings" style="padding: 0">
The errors say that the attributes aren't part of the tag or that the tag is not supported:
I thought this was just intellisense not working, so I tried to run the solution. It compiled and shows me a blank screen. If I look at the page source of the screen, I can see that my code is there, but nothing is displaying:
If I remove the Angular tags, I can get the page to show up. So if I replace the initial body and div tags with this:
<body>
<div>Text
I can see part of the page:
This seems to indicate the problem is with the Angular tags. So how do I get them to work?
Edit 1:
I added these references to angular:
<script src="/lib/angular/angular.js"></script>
<script src="/scripts/angular-aria/angular-aria.js"></script>
<script src="/scripts/angular-animate/angular-animate.js"></script>
<script src="/scripts/angular-material/angular-material.js"></script>
The only place I could find angular in the code is in package.json:
"browser": {
"angular": "../lib/angular.js",
"angular-animate": "../node_modules/angular-animate/angular-animate.js",
"angular-aria": "../node_modules/angular-aria/angular-aria.js",
"angular-cookies": "../node_modules/angular-cookies/angular-cookies.js",
"angular-hammer": "../node_modules/angular-hammer/angular.hammer.js",
"angular-data-table": "../node_modules/angular-data-table/release/dataTable.helpers.js",
"angular-material": "../node_modules/angular-material/angular-material.js",
"angular-messages": "../node_modules/angular-messages/angular-messages.js",
"angular-sanitize": "../node_modules/angular-sanitize/angular-sanitize.js",
"angular-ui-grid": "../node_modules/angular-ui-grid/ui-grid.js",
"angular-ui-router": "../node_modules/angular-ui-router/release/angular-ui-router.js",
The angular js files are in the lib and Script folders:
Hello everyone We have searched this error beforehand, but nothing seemed to be our case, since all of the problems that were mentioned were because of using EF Code first, that we are not using it.
After migrating to MVC5, we ran into a problem. Whenever we want to add a view to our controller, we get the following error:
there was an error running the selected code generator value cannot be null
BTW, we are using LINQ to SQL,and we are not scaffolding the view.
We have left the Template Empty(Without model), and we are not using layout page.
Our project is using ASPX view engine. We had no problem in VS 2012. After migrating to VS 2015 we are running into this problem.
Has ASPX view engine been removed from VS 2015. Could it be the problem?
Any kind of help would be highly appreciated.
If Prompt for
there was an error running the selected code generator values does
not fall selected range in visual studio
web.config has been deleted or renamed.
Please check your web.config file. Might be there were any additional tag would be added.
You can do this by doing the below method
All I had to do is install Web Essentials 2015.1 , restarted Visual Studio, repeated the Add View action, and it worked, don't have an explanation to this, but it worked.