Razor Generator adding empty comment lines in razor view - c#

I have started using Visual Studio 2017 recently (moved from VS 2015). First thing i noticed my razore views are not compiling changes in generated files (generated cs files stay the same despite changes in cshtml files). When I tried to right click and select Run Custom Tool it showed me message which implies to install Razor Generator (which i did). Now after saving my razor view it's having lots of extra empty comment lines through out the view. Which is causing a bit of issues with final Html. Here is how that empty comments looks like:
Has anyone face this issue before? If yes please kind enough to share solution. Given the time I have, i will manually remove these extra comments as of now and will look at it later when i have more luxury of time to spend on it. Thanks in advance.

Related

Wondering if we could generate code with T4 Template on a builded solution

I'm trying to figure out if we could generate code with a T4 Template file post-build.
In fact, I'm kinda new to c# and I needed to find a solution where I generate class from Xml file that could be edited by the user at anytime and the first solution that come to me is T4 Template.
Then I render those generated classes on a treeView and the according properties on a property grid.
Now, I think that it is only generate code at pre-build time, but I'm not sure about that since I don't really see a lot of stuff about that on the internet. I'm still pretty sure now that it's not possible.
So, a second problem comes to me : I finished my entire project like that, so if you all have an idea or another solution that could be nice, i'll really appreciate that.
The 'T4Executer' extension has an option to attach the execution of each T4 template to build events. Before, during and after build, or not run them at all.
Doesn't work for Visual Studio 2022 yet though.

Visual Studio ASP.NET aspx page empty lines bug

I am creating an ASP.NET app in Visual Studio 2013 which has about 12 pages. However, in one of the page's aspx page in VS, when I save or auto format the page it will insert/create hundreds of empty lines. Most recently it has managed to create over 300,000 lines.
I keep deleting these lines, which is quite time consuming because the lines are spread throughout the code, but they just keep getting inserted.
This bug does not occur on any other page, the only thing that is different about this page is that it uses a DevExpress ASPxPageControl, but I'm not sure how that would have anything to do with it.
I have tried deleting the page and copying the code over to a new page, but the same bug keeps occuring. Does anybody have any idea how I would go about fixing this bug?
UPDATE: I have created another page which also uses the DevExpress ASPxPageControl and it has started to happen on this as well. So I am assuming that this issue has to do with the control.
UPDATE 19/09: This issue no longer happens, but I have no idea why or how it has been fixed.
UPDATE 06/12: The issue appears to happen only when design view is opened. If I only ever look at the source view, it never happens.
There is a question that looks like the same problem you have.
Try checking if you are missing any closing tags.

visual studio does not apply css

I wanted to make a small test site using the Metro UI framework (http://metroui.org.ua/)
So, I started up my newly installed Visual Studio 2013 and started a "new website". I added the neccesary css and js and made a very basic masterpage and default.aspx. But here comes the problem: the css does get loaded, but it doesn't get applied. Not in FireFox, not in IE, not in Chrome and not in the "Page Inspector".
It's quite weird, because in my previous VS2012 this same workflow for testing and experimenting with a framework just worked. I really can't find the problem. Maybe it has to do with my new Windows 8.1, my new Visual Basic 2013, maybe an programming error (although that would be very unlikely, since I checked everything).
I also tried installing the framework using NuGet instead of manually adding it. Same result: it does load, but it doesn't get applied.
Anyone knows what's happening here?
Thanks in advance!
According to MetroUI you have to follow 5 simple steps
Create page with HTML5 DOCTYPE
2.Include metro-bootstrap.css
Include metro.min.js (jquery.js required)
Create main container with class .metro
Use markup, as described in the pages of this site
In your posted images I can't find a container with class .metro . I'd really check the sample code from the posted page.
In case I misunderstood anything please let me know!

MVC3 compiling views is slow

When working on a c# MVC3 app in Visual Studio 2010, I have turned on view compilation by editing my project file and setting the wonderful flag
`<MvcBuildViews>false</MvcBuildViews>`
to true. I love it as it means I can compile my views and catch errors.
The only problem that I have now is that it's not really quick! (I have tried turning it off and then it's back up to full speed.)
It looks like it recompiles every view every time - I have about 50 views at the moment, so ideally it would only compile the pages that have changed since last time. Is this at all possible?
I don't think its possible to compile that way in the same project. You could attempt to pull out the views into a separate project, and set it up that way.
http://www.chrisvandesteeg.nl/2010/11/22/embedding-pre-compiled-razor-views-in-your-dll/
As far as I know, building the views is an all-or-nothing flag.
I recommend turning this option off for development environments, but turning it on for a continuous build system that's pointing at your main development branch. That way you can still get an email if you commit something that breaks a view, without adding a lot of time to each build during development.

Inherited an ASPX site and cannot change a variable

I just inherited an ASPX site from a new customer of mine. I know ASP but I cannot figure this one out. There are two pages that seemingly do exactly the same thing (cause they should) they both read an XML file and pull in the correct child datasets 2010 for the 2010 data and 2011. I need to add a new set for their 2012 line.
I figured I could dupe one of these pages and change the "2011" to "2012." The problem is I cannot find the "2011" ANYWHERE! the only difference between the two files is:
There isn't a "year2011.aspx.cs" to be found via FTP that I can see and changing the 2011 to 2012 just throws an error. Reading up a little on the CodeBehind tag there pointed me to a few DLLs that ARE there BUT I have no idea how to edit them to make them work. Their old developer did not leave anything but what was on the server.
Any ideas on what I can do to make this work?
It seems the code is compiled so there wont be any *.cs files. If you haven't got the source code as you have mentioned you will need to decompile the DLL's to allow you make any necessary edits.
Take a look at http://www.telerik.com/products/decompiler.aspx , it will allow to decompile the dll back to *.cs files to allow you to make any edits.
Once you have the source code you should be able to debug and provide more information about the error you are experiencing

Categories

Resources