Visual Studio 2008 ASMX files - visual-studio

This is not technically a programming question but it does specifically relate to a heavily used programming tool so i think this is the correct place for it.
In Visual Studio 2008 if i have an asmx web service and i double click on the asmx file it opens the asmx.cs file, this is eminently sensible seens as there is just a single line directive in the actual asmx file. However if i click on the asmx.cs file directly, it tries to open it in "design" mode, i.e. the mode for aspx files where it shows you a visual designer rather than the markup. The result is you either get a grey screen saying that this file type cannot be viewed in design mode or you just get a wierd visual studio exception handling page. All i'm doing is double clicking on the asmx.cs page. I can post screen shots if anyone is interested. I have observed this behaviour on my coleagues machines as well so it does not seem to be some wierd quirk on my particular install. Has anyone observed this behaviour? can anyone reproduce it? Is it a bug? Is there a service pack that fixes it? Is it some wierd setting i have been unable to locate. It is not a show stopper becuase double clicking the asmx file opens the relevent code file but I would like to fix it if possible.

The .asmx file is essentially a markup file that points to a code-behind file. Since the markup is never changed, the (pre-VS2008) VS developers thought it was a good idea to display a warning screen instead.
To avoid this warning screen, you can right-click the .asmx file, select Open with... and set the Source Code (Text) editor Editor to be the default. In VS2008 and VS2010, the code-behind will display when you double-click the .asmx file in the future.
If you want to view and/or edit the markup of the .asmx file, simply right-click the .asmx file and choose 'View markup'. Not sure if this works in VS2008 (don't have it here), but it works in VS2010.

Related

Viewing binary files in MSVS under Windows 10

For ages I've been using MS visual studio 15 to view binary files, simply by doing file|open. My files have a custom extension, 'SQ3', but VS seemed to happily infer that they aren't text, and display them as binary. However, Win10 seems to have stopped that. Now if I do the same thing, a popup appears, asking me whether I want to find an application from the shop, or always use this application (presumably MSVS, the one I'm invoking from). There's a proceed button, but it doesn't respond. There seems to be no way that I can get VS to open and display the file.
Is there a way to stop the OS intervening so VS can do its thing?
Incidentally, having to rename files would be extremely inconvenient in this situation. TIA
Thanks, that's perfect.
In Visual Studio go to Tools/Options/Text Editor/File Extensions.
Add new entry to the list:
Extension: sq3
Editor: Binary Editor
Click Add and then OK to close the dialog. Files with .sq3 extension will now open with the hex editor when opening them or dragging them to Visual Studio.

Change Ctrl+Click Behavior in VS Output Window

Is there a way to change how links are opened from the Output Window (not an Editor)?
Meaning, when the Output Windows detects a link, it's Ctrl+Click-able and opens in an Internet Explorer tab.
I'd like to change the target from IE to the Text Editor and still within Visual Studio.
There are solutions for changing the click behavior in an Editor, but I am asking specifically about the Output Window. I understand the answer might just be no.
There's a Visual Studio Extension that lets you open URIs in the browser (https://visualstudiogallery.msdn.microsoft.com/46c0c49e-f825-454b-9f6a-48b216797eb5).
I've forked it and made some updates so that it will handle file:/// URIs as well, opening them in the Visual Studio editor or an external editor. I've published a debug version that hasn't been very heavily tested here. You can peruse the full source of my fork here, or the original source here.
This makes debugging/working with the BizTalk map/schema tools a lot better...

How to preview a VB6 .frm file?

I have an old VB6 project that is still alive and needs some attention at the moment, but I don't know anything about VB6 and I am just wondering how to preview a .frm file from the project.
I also have the .vbp file if that could be of any help.
I know I can open the files in a text editor (e.g. Notepad++) but is there a way to actually preview the form (like the designer in Visual Studio for WinForms)?
EDIT: Is there a way to make changes to a form?
As you say, you can view .frm and .vbp files in a text editor. These include most of the information about the from.
As far as I know however the only way to actually view and edit the forms is with the Visual Basic 6 IDE. I'm not entirley sure how to best go about acquring a copy howvever.
Re: Edit. You can change the .frm files using any text editor. But that's not going to do you any good without the IDE to compile the changed source.

How to configure Visual Studio (2010) to open aspx pages on code behind by default on double click?

The question says it all... its pretty simple, and it can be done by selecting the file and pressing F7 but I'm always double clicking accidentally and visual studio takes forever to open the design view page (even if its almost empty), but I just wanna go straight to the code.
Any tips?
I had this problem too. My solution was to change Visual Studio to open up pages in HTML view by default. Because VS doesn't need to format the page, this is MUCH quicker. You can see how to get Visual Studio to open pages in HTML view at http://www.wiseowl.co.uk/blog/s153/visual-studio-html-view.htm.
To tell Visual Studio 2010 to open files automatically in Source view,
Tools -> Options
Select the General section of the HTML Designer tab.
Choose to start pages in Source View.
Just incase Andy's link dies, the method to make Visual Studio open ASPX pages in HTML view rather than the default designer view:
Go to Tools -> Options. Select HTML Designer from the menu at left. Select "HTML View" for HTML pages, Active Server Pages and Web Form pages. Click OK.
This forces VS to open pages in HTML view, which for developers is usually the view we work in for editing ASPX templates. In addition, it addresses the original issue of this question, which is getting VS to open pages faster, since it doesn't have to render a designer view.
I think you are asking to configure VS2010 to take you to the .cs / .vb file when you double click on the aspx page, but you could also be asking about make it go to the html source view.
If you are wondering about the latter (html source view), here is a screenshot of what setting to change.
http://screencast.com/t/8UluCEUQr
I hope this helps.

Can Visual Studio 2010 do ".inc" file syntax highlighting?

Can Visual Studio 2010 be configured to do syntax highlighting on ".inc" files? We have numerous large projects with tons of these ".inc" files (asp files) and so changing the file extension to ".asp" is not an option. All I want Visual Studio 2010 to do is treat these ".inc" files just like ".asp" files when it comes to syntax highlighting.
I've tried "Open With..." and selected the HTML Editor, which is the ".asp" default, but that did not work. I tried about every other editor in the list and none of them worked.
I know Notepad++ (among others) can do this, but I would prefer this be done in Visual Studio 2010 - using another IDE or text editor is not the answer I'm looking for here.
In Visual Studio...go to Options -> Text Editor -> File Extension. Type in 'inc' as extension and editor as 'Web Form Editor'. You may need to close then re-open your currently open .Inc pages...Hope this helps
I found both the 'Web Form Editor' and 'HTML Editor' to be less than ideal for me. Both of them appeared to highlight the syntax of the HTML ok, but the VBScript keywords were left in standard black text along with everything else.
While not ideal, I followed the instructions from the other answers, but substitude Visual Basic as the editor type and that worked much more to my liking (as they were include files, there is little HTML in them).
Options -> Text Editor -> File
Extension. Type in 'inc' as extension and set editor as 'Visual Basic'.
Close and re-open any '.inc' files and highlighting should be visible.
Antonio's solution worked for me. I did have to close and reopen files, but after I re-opened them the highlighting was visible. Thanks!
Options -> Text Editor -> File Extension.
Type in 'inc' as extension and set editor as 'Web Form Editor'.
Close and re-open any '.inc' files and highlighting should be visible.
Incidentally, this also works in Visual Studio 2005.
Use the File Extension, Text Editor, Options Dialog Box.
http://msdn.microsoft.com/en-us/library/4k7w5e5s.aspx
-update-
I see the same behavior :-( Will let you know if I find anything.
As a workaround, could you rename all your .inc files to .asp?
This has the added advantage that if a request is made for the inc file directly (highly unlikely but possible; and assuming you have the incs in the web directory), your code will be exposed unlike .asp where it is processed and rendered.
I really wanted to add a comment, because this is not a direct answer, but apparently you need 50 reputation for that.
I've found that in Visual Studio 2005 (again, in Tools -> Options -> Text Editor -> File Extension), both "Web Form Editor" and "User Control Editor" highlight both the HTML and the VBScript.
Amadiere mentioned that "Web Form Editor" doesn't highlight the VBScript in 2010, but maybe it's worth trying "User Control Editor", if that's an option in 2010.
In Visual Studio 2010 and 2012 Express it best works for me when I use "Microsoft Visual Basic" with my .inc files. Nevertheless, it's still not the same as with .asp files as there's no Autocomplete nor IntelliSense (Ctrl+Space, Ctrl+Shift+Space etc.) with the .inc files.
It should be made possible defining that .inc files are to be treated just as .asp files.
I agree with Purple Coder:
You should not name the files containing ASP code as .inc. It is a security risk. Anyone who knows/can guess the filename can open it in a browser and view the actual code inside the file.
But, first of all in my case this is an intranet page and therefore not very risky, as most people there would somehow find the files on the server anyway. I'm also not sure where this naming convention came from. It was there before I started. This was started on Visual Studio 6.
But, to avoid this risk there's a simple solution: add .inc in the Application Mapping of the IIS in the same manner as .asp.
You should not name the files containing ASP code as .inc. It is a security risk. Anyone who knows/can guess the filename can open it in a browser and view the actual code inside the file.

Resources