Archive for the ‘windows’ Category

Add Eclipse’s Open Resource to Visual Studio 2010

One of my favorite features of the Eclipse IDE is ‘Open Resource’ ( Ctrl + Shift + R  ).

Ctrl + Shift + R > opens this sweet timesaver

Don't point and click to your files, just type their name

If you’re unfamiliar with this, it’s a File Open dialog that let’s you type the name of the file you’re looking for, instead of requiring you to point and click your way to the file. This is one of the few features I still can’t believe Visual Studio doesn’t have built in. Now I’ve had other MS experts show me similar “quick find” features of Visual Studio, but it’s still not as easy as Ctrl+Shift+R > type the filename.

When I was using Visual Studio 2008 I came across the Sonic File Finder plugin and I was hooked.  Then I upgraded to Visual Studio 2010 and my plugin went away.  Today I solved my quick open plugin issue by browsing the Visual Studio Gallery and installing Quick Open File.  This quick open plugin does exactly what Eclipse’ Open Resource does, and it’s a good bit simpler than Sonic File Finder.  Now that I’ve got the plugin installed, the next step is to configure Visual Studio to open this plugin when I hit the Ctrl + Shirt + R keyboard combination.

Add Ctrl+Shift+R to Visual Studio

  1. Fire up Visual Studio
  2. Click Tools > Options > Environment > Keyboard
  3. You should now be at the window for assigning keyboard shortcuts

    This is where you edit keyboard shortcuts in Visual Studio

  4. Type “Quick” into the Show commands containing box
  5. Click inside the “Press shortcut keys” box, and then press Ctrl + Shift + R on your keyboard
  6. Assuming you’ve set this to Global, you are now good to go.

**NOTE : When assigning a keyboard shortcut in Visual Studio, you want to make sure your new shortcut isn’t already assigned to a different command.  If this is the case, you should remove your shortcut assignment from the other command before assigning to your new command.  This dialog will show you what is already assigned to a keyboard combination like so.

Make sure your new shortcut isn't already assigned

Assuming you made it this far, pressing Ctrl + Shift + R in Visual Studio should now show you this Quick File Open dialog.

Visual Studio 2010 plugin, 'Quick Open File' dialog box

There you go, quick open in Eclipse and Visual Studio!

Weird, that bat file path doesn’t jive from the toolbar

I just noticed something when running some batch files on Windows 7. If I launch the file from Windows Explorer, the path in the command window matches the location of the batch file.

Bat file path and cmd paths match when you double click it

The paths, they match!

However, I typically launch my batch files from a toolbar on my taskbar that points to the same folder.  The batch file still works, but the path shown in the command window is weird.  I have no idea how an Adobe Version Cue path could get injected, but it does.

Launching a bat from a toolbar injects a path to Adobe Version Cue?

Weird paths

To capture both shots of the command window I had to hit Pause.  These aren’t faked, they’re just completely random.

Coldfusion and ASP.NET coexisting on IIS, where’d WebResource.axd go?

My Monday morning WTF comes from IIS7 on Windows 7.  I recently installed Coldfusion9 on this machine which has a handful of existing ASP.NET 3.5 web applications.  The problem I ran into came after installing Coldfusion9 and electing to configure all IIS websites to work with CF.  While that is convenient, it ended up breaking one of my ASP.NET applications that was using ASP Validation controls on a login form.  Now that things are figured out, here are the details.

Firing up my ASP.NET application gives me the error message :

The WebResource.axd handler must be registered in the configuration to process this request

Misleading web handler error message

WebResource.axd handler must be registered

Obviously all I could think is WTF?!?!? since this application worked on Friday and now it is broken.  The first thing I want to point out is that in my situation, the suggested solution of mapping WebResource.axd in the httpHandlers section of my web.config did not help this problem.  After some googling I cam across this post on the IIS.NET forums which put me on the right track.  You can read the details there if you want a good background on MS’ response and other users running CF and ASP.NET on the same box.

I’m happy to say I have three workarounds for this issue.  Hopefully these will help you as well.

1. Change your AppPool to run in Classic Mode

  1. In inetmgr, put your web application into it’s own Application Pool ( unless it’s already in it’s own pool )
  2. Change that AppPool’s Managed pipeline mode to “Classic”
  3. You should be good to go
Change Managed Pipeline Mode to Classic

Classic mode is for compatibility ( think IIS6 )

2. Stop using ASP Validation controls

All ASP.NET Validation controls are hosted by WebResource.axd.  If you stop using ASP Validator controls, the server will stop asking for WebResource.axd.

Comment out ASP Validator controls

Removing ASP Validator controls should remove this error

3. Remove Coldfusion handler mappings from your ASP.NET site

If your ASP.NET app isn’t using Coldfusion, I would suggest doing this as your solution.  Even if you do need Coldfusion in your ASP.NET app, you could still host your CF app in it’s own Virtual Directory and request if via ASP.NET.

  1. Open inetmgr
  2. Select your web app on the left ( under Default Web Site )
  3. In Features View on the right, double click Handler Mappings
  4. Sort your Handler Mappings by Name, and remove all entries titled “AboMapperCustom-*”
  5. Now your ASP.NET should work like a champ.
IIS7 inetmgr Handler Mappings

IIS7 Handler Mappings

Coldfusion9 Handler Mappings

Coldfusion9 Handler Mappings

Monday WTF solved.  Now to get back to pushing buttons.

Invalid token ‘void’ in class, struct, or interface member declaration

EDIT :

After finishing this post I ran into all sorts of other strange issues and restarted using a Web Appliction instead of a plain old Website.  Between IntelliSense not showing any classes, to project reference issues, I couldn’t figured it out in time.  I’m sure there’s a way, I just had to move on.  So maybe this ramble below will be helpful for someone.

EF

Just ran into something quirky with Visual Studio 2008′s new ADO.NET Entity Data Model wizard.  While working on an ASP.NET 3.5 website ( not a codebehind web application ) I was trying to get the ADO.NET Entity Data model wizard to work with MySQL and ran into a probable Visual Studio bug.  To sum up the issue, if you are going to add a new edmx to your project, do NOT save it to the App_Code folder initially.  Put it in your root folder, compile your project, then move the edmx where you’d like.

Assuming you’ve already created your ASP.NET Website project, here’s how you reproduce this issue.

Right click your project and left click ‘Add New Item’

Right click your project, left click Add New Item

Add New Item

Select ADO.NET Entity Data Model, name it, select your language of preference

New ADO.NET Entity Data Model

ADO.NET Entity Data Model

Click Yes to the ‘Store in App_Code’ prompt

Place your edmx in App_Code folder

Place file in 'App_Code' folder

Complete the new Entity Data Model wizard

See this tutorial if you have not done this before

Compile project after completing wizard

Invalid token 'void' in class, struct, or interface member declaration

Invalid token 'void' in class, struct, or interface member declaration

At this point your project should have a new.edmx file located inside of the App_Code folder, but the project won’t build without failing.  If you are stuck in this predicament, follow this workaround.

Move .edmx to root folder and rebuild

Move edmx to root and recompile, no errors!

WORKAROUND : move edmx to root folder, then recompile

After moving your edmx file to the root folder you should be able to compile without problem.  Assuming this solves your problem, you should be able to move your edmx file to the App_Code folder without problem.  Seems like an initial compile problem.