In the Visual Studio, do we have a tool to find a file based on file name insdie a project, like typing a few letters of beginging of a file, it will autocomplete to show all files starting with that letters. In the Java Eclipse, we can use Ctrl+Shift+R , do we have similar in the VS ?
Thanks
Yes, there is something like that.
You can use the Find text box you use for normal searches as input for the Command Window. Then in the Command Window you have the of command to search files.
To do it:
CTRL + /to select the Find text box.
Type > of then the file name (or part of) you want to search for.
A dropdown list will show all files that match your typing (so you do not have to know the full file name as with CTRL + SHIFT + R).
If file list is pretty long you may use the normal Find in Files dialog, simply set Use to Wildcards, in Find what type * and write the search pattern in Look at these file types. Check the Display file name only option. Using the Look in field you can limit the search to current project, entire solution or whatever you need.
Try ctrl-spacebar, it's the normal shortcut for intelisense. If it doesn't work for file path and name, there is surely a plugin out there just for this.
I use VS with only resharper as a plugin and I can do this, I don't know if its resharper that does it or if its prebuilt.
EDIT: It is resharper that does it. I would recommend using it if you intent to work with VS as it greatly helps out on a lot of refactoring and shortcuts.
Related
I am using Visual Studio 2015, creating my first Windows UWP app. I am trying to create the layout and as such, I have added a blank xaml page to my project. When I double click, it does take me to the designer. The question is, there are preset (common) devices such as a 5" phone, 6" phone, etc... and the resolution for each.
However, I am targeting a specific device as well and I want to make sure the layout looks good on my device. I need to add a device to this list which has my screen size and resolution. It appears that there is no built in way to do this in Visual Studio. How can I add or edit a device?
Thanks!
The only way I have found to do this so far is to do the following:
Navigate to the Windows Kits Devices folder. Mine was located at
C:\Program Files (x86)\Windows Kits\10\DesignTime\UAP\Devices\1033
In that folder, you will find several xml files basically one for each device. Pick the file/device that is closest to what you need and edit it. I use Notepad++ but regular Notepad or Wordpad will work.
Change attributes to what you need. You can give it a "name", "width" and "height" are the pixel width and height of your device. This can be found several ways if you don't already know it. Either search online, check the specifications or data sheet for the device or sometimes you can even find it in the device settings/info. For the "size" attribute, this is the physical size of the screen, again you can find that out if you don't already know it. This attribute does accept decimals. So, if your screen is 4.7", just type "4.7" for size.
Those are the key things to change. You can also lock orientation by changing the Orientation Qualifier if you want.
When you are done, I recommend you save a copy so you don't overwrite the original one you started editing. When you save a copy, I would rename the file as well. The first three numbers, before the underscore, is just used to sort the item in the drop down list of the designer. For example, 100_5inchphone.xml is going to show at the top of the drop down list in the designer. Therefore, give your file name a number according to where you want it to show in the list and make sure it is unique. They are also grouped, so 100 numbers are phones. Therefore, one good practice is, if you are adding a phone, start at the end and keep incrementing from there. For example, 102_MyPhoneName.xml. Last, give your file a nice name, after the number and underscore.
When you try to save, you may get a notice that you do not have permission to save in this folder and would you like to save in My Documents instead? This is dependent on the OS version and settings. If this is the case, go ahead and save to My Documents or wherever the notice has recommended. You can then grab that file and copy/paste it into the correct folder (indicated on item 1 above) and when you do, you will then be asked to give Administrator rights and the paste will then be allowed. Once complete, you should now see your new file in this folder.
Finally, you must restart Visual Studio completely for it to pick up the new file/device. After Visual Studio starts up, open you xaml file in designer and you should now have your new device in the drop down list.
That is all there is to it. Not too bad to do, though it would have been nice to have a way to do this simply from within Visual Studio.
NOTE: If you have errors starting up Visual Studio or with the Designer starting when you click on your xaml file, you may have gotten the xml format wrong. Double check your xml file that you created/edited in the process.
Hope this helps!
I can use the Ctrl+, shortcut to search for methods but will search among the entire project:
This lists all the classes in all files that have this method, and I want to search only in the current file, similar to Alt+M in VAssistX. Is there a shortcut for that?
I found Is there an easy way to jump right to a method within a file?, but it's for VS2012, and they only suggest Ctrl+F or Ctrl+,.
Note: I'm looking for true navigation, not Ctrl+F, and only within the current file, unlike Ctrl+,.
To expand on the answer by Matt Schley:
Ctrl + F2 -> Tab -> then start typing and it'll sift through the functions in the file.
I know you were probably looking for something else, but this is as good as it gets for what's built into Visual Studio. Maybe there's extensions available.
EDIT
This is a mapping for C#. The command name is Window.MovetoNavigation
For C++, it's default is Ctrl + F8
Not sure if this is what you're looking for, but there is a dropdown menu right above the code editor window that lists all methods and properties in the current file.
Try Ctrl + F2 to active the navigation bar, then tab over twice and you can scroll through the dropdown.
For VS2019 you can use Alt + \ for object search.
From https://learn.microsoft.com/en-us/visualstudio/ide/go-to?view=vs-2019, it says Ctrl+1, Ctrl+M for Go to the specified member. You can add your own combination to this command by going to Tools -> Options -> Keyboard and choosing Edit.GoToMember. For me it works just perfect.
I'm trying to write a regex to be used within Visual Studio or an external program without success. What I want that expression to do is:
Match rows containing quoted text like var myString = "This shall be moved out of here"
Do not match rows within comments like ///<summary>This method has some "quoted text"</summary> or //This is "just a comment", which may have tabs at their beginning due to indentation.
From within Visual Studio I'm able to include files by extension, say *.cs, so I can easily skip xml files and so on. I'm not able to exclude those *.Designer.cs files however, so I found that FileSeek does a pretty good job being able to include and exclude files by extension or regex; anyway if there's a way to accomplish the same from VS, that would be great.
Any help would be much appreciated, thank you.
The below regex would match all the lines that won't start with // and contains " present inside that.
^(?!\s*\/\/).*(?=\").*$
DEMO
In my application the user can select reference to file, for example a image file. I would like to make button with a arrow that opens a list with the programs installed on the system witch can open this file type.
I know that I can get the program names from the registry "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts", but how can I filter the entries out that have no meaning - "DllHost.exe, miaui.exe, etc."
And how can I open the file with program that the user choose?
# Lars Tech If I look in registry "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" and then "OpenWithList" for the extension ".jpg" I see more entries that if if rigt click on jpg file and choose Open With ( see my first images) and I only want those.
And yes there is program's entries that I properly self have added, but that have no meaning to a jpg file. And Windows can filter them out so will I.
I think you can use this article to validate and find out which of them are applicable and valid in your application
If running on Vista or better, you can use
'SHOpenWithDialog'
http://msdn.microsoft.com/en-us/library/bb762234(v=vs.85).aspx
- it's quite straightforward...
Jens
I need to create a resource file for a .net project (by hand) and compile it using the ResGen.exe tool provided by the .NET framework. I can't find any documentation for this. I need to write the resource file by hand because I'm in a situation where I don't want to download/buy extra tools (like VS) to generate this resource file, and also I feel more productive through the command-line (helps me understand how things really work).
So I need to write a resource file by hand to store an ICON in the executable and use it from within my program. I would also like to use this icon to represent my executable in Windows Explorer.
Any references would be great!
Visual C# Express Edition will do what you want for free. If nothing else you can download that, create the resource file and then use that as a subject for your admirable curiosity about 'how it really works'. This may also save you some time in manual experimentation to get it right the first time around.
These 2 links in conjunction provide information on using that tool to create and embed an icon file, it seems specific to C#. Of course i'm guessing at your full intention, let me know if this points you in the proper direction.
http://www.xtremedotnettalk.com/showthread.php?t=75449
specifically there is a post which states;
I think you should first create a *.resources-File from the Icon with the tool named "Resgen.exe"...
resgen App.ico App.ico.resources
the next step would be compiling...
csc /t:winexe /out:Keygen.exe /res:App.ico.resources /r:Crypto.dll /win32icon:App.ico Keygen.cs AssemblyInfo.cs
I'm sure you were here already.
http://msdn.microsoft.com/en-us/library/ccec7sz1(VS.80).aspx
You should check this link:
http://msdn.microsoft.com/en-us/library/ekyft91f.aspx
It explains what formatter is used and gives some code samples to generate one from code. You could then write a small wrapper app that you can call from the command line. No downloads needed!