I'm sorry if this question has been asked before but I couldn't find an answer so far.
Let's say I have a asp.net mvc5 project, and I have included a external script file in my cshtml file using razor.
like so:
<script src="#Url.Content("~/Scripts/Path/File.js")"></script>
is there any way to easily open that file from the include statement? Or is there a different way to include the script that would allow such functionality?
plug-ins are also welcome.
Thanks everyone.
I don't think there's such extension nor feature in Visual Studio unfortunately. There'are extension for Visual Studio Code (e.g. Open file), but not for the "big" Visual Studio.
You can try to create your own extension to do that, it shouldn't be so complicated.
Or you can try to create a feature request on UserVoice and wait if it's accepted and implemented.
Related
I've been using Notepad++ for editing CSS, and for just plain text. In Notepad++ I can paste a block of text and specify if I want the file to be highlighted as HTML, CSS, etc.
How do I set the language that Visual Studio will use to interpret a block of text I pasted from my clipboard? What about when I open a plain TXT file?
Am I using the wrong tool for the job? I've been hearing about "Visual Studio Code". Is that what I should use instead?
In general, Visual Studio works with "Project". It is designed to work with the relevant files for the project, and it will recognize them according to the extension.
In Visual Studio, you can override the default config for the file extension with this docs.microsoft. This configuration will work against all files with this extension, but not against a specific file.
I guess there are plugins that can help on the subject, but as you said, Visual Studio Code is more like a file editor like Notepad++, with very powerful plugins and capabilities. So yes, in case you want an enhanced Notepad++, you need to use the Visual Studio Code and not the Visual Studio.
After using both Visual Studio and Visual Studio Code I can confidently tell you VS Code is so much swifter to open and use while also being very easy to navigate.
VS Code automatically detects the language of your code but you can also switch languages by clicking on the existing language at the bottom.
I highly recommend you use it: https://code.visualstudio.com/
I hope someone can point me in the right direction. I have two separate piece of code that functions outside of Visual Studio.
The last step performed by the second piece of code currently creates a new c# source file. I would like to combine both pieces of code into a single VSIX extension.
Unfortunately I have never worked with VS Extensions and I am a bit lost. I have worked through various VSIX examples, but none of these create files.
Can anyone perhaps point me to a working example of how to add new source files to a project via an extension?
I have seen some examples, but they all refer to old Add-In style plugins and not VSIX.
Create a VS 2017 extension to add new code file
As we know the Visual Studio Extensions is:
Extensions are add-ons that allow you to customize and enhance your
experience in Visual Studio by adding new features or integrating
existing tools. An extension can range in all levels of complexity,
but its main purpose is to increase your productivity and cater to
your workflow.
So, the Visual Studio extension is service for Visual Studio IDE to customize and enhance your experience in Visual Studio, rather than serving a specific project.
What I suspect the Project and item templates should be helps.
Hope this helps.
I have a fairly large ASP MVC project which I am running in visual studio 15.4.5. Whenever I view .cshtml files Visual Studio incorrectly highlights the file for example:
We are making use of compiled razor views.
The project compiles and runs correctly
What I've tried
Deleting all bin, obj & .vs folders
Running .\devenv.exe /ResetUserData
Running .\devenv.exe /UpdateConfiguration & .\devenv.exe /ClearCache
I found this question whilst trying to solve the nuisance that is the highlighting myself so thought I'd share my findings. Apparently this is the intentional behaviour as it referred to as "Razor Syntax Highlighting" and through both this post on MSDN and another question on here: How do you turn off Razor highlighting in VS 2013? I was able to determine how to turn it off on my machine.
Quote from MSDN post:
This highlighting is the built in support for Razor syntax highlighting. If you do not like it, you can open your .cshtml files in Visual Studio using the HTML editor
Screenshot of what I changed that worked for me:
First of all i want to say that I'm still a beginner in ASP.NET development. I think this is a simple question but I cant find an answer anywhere. The following is my problem:
I have a big ASP.NET project develped in .NET 2.0 . Now I have to update thisProject to .NET 4.0. I think it worked quite well when I loaded and converted it to .NET 4.0 with VS2010 but there is this missing reference.
The missing reference is MSutil.dll and I don't have any clue what that reference is for an I cant find the dll anywhere either. In the cs code its used like this:
using LogQuery = MSUtil.LogQueryClassClass;
using IisW3cLogInputClass = MSUtil.COMIISW3CInputContextClassClass;
using LogRecordSet = MSUtil.ILogRecordset;
using LogRecord = MSUtil.ILogRecord;
Can anyone tell me...
what this reference is for?
where I can find/download it?
how I can include/install it in my solution?
This is used to read the IIS log files and parse them.
To get that DLL follow those steps:
Download the Log Parser package, here. (free download, small .msi file)
Install the Log Parser on the machine with the your project and Visual Studio.
Browse to the location of the installed program and you will see file called "LogParser.dll" in there. Copy the file to some easy location e.g. "C:\Temp" see below why.
Go to All Programs --> Microsoft Visual Studio 2010 --> Visual Studio Tools and right click "Visual Studio Command Prompt" then choose Run as administrator.
From within the console type:
tlbimp "C:\temp\LogParser.dll" /out:"C:\temp\Interop.MSUtil.dll"
That's it - after this you will have the lost Interop.MSUtil.dll back on your machine, copy it to your project location and add reference to it like you add to any other external DLL file.
Interop.MSutil.dll is a .NET interface to LogParser.dll, primarily used to parse IIS logs.
To use it, you will need LogParser 2.2 installed and LogParser.dll registered on your machine.
Interop.MSUtil is now available via nuget so you no longer have to create it yourself, but after installation you will have to manually add a reference to the DLL in your solution's packages folder.
After adding the reference, right-click it and set Embed Interop Types to false to avoid receiving an error that the classes cannot be embedded.
It seems is an Interop object.
An Interop object is a bridge between a .Net dll and a COM object
Perhaps this link helps you
http://www.fixdllexe.com/Interop.MSUtil.dll-149085.html
Using code example in free ebook Moving to visual studio 2010. I am unable to get the code to run. Getting error copied in below.
The code example and ebook is downloadable here
Link
This is the code I am trying to get to run: 'the correct solution can be found at Documents\Microsoft Press\Moving to Visual Studio 2010\Chapter 6\ in a folder called UserInterface-Start.'
Thanks
I can give you some advise when it comes to using samples and example code from a book.
Read the code, understand what is being done from a conceptual understanding, given some knowledge of the programming language and the framework they might be using, you should be able to start a new project and type out the code and use the example code, only as a reference.
I personally find it difficult to work any other way. I have always had problems opening up solutions from a couple of years ago, and sure, this solution might be in visual studio 2010, I just don't find it beneficial.
The problem is that you might find yourself struggling getting the solution to open instead of actually learning the topic at hand.
I suggest you open up a blank solution using the ASP.NET template and press F5 to build and run and then work with the example code from there.