Package did not load correctly on Visual Studio 2012 Startup

August 18, 2014 at 10:21 AMMadestro

My network admin apparently has Windows updates setup to auto-install and reboot if needed so the computer had done that last night and Visual Studio 2012 was reloading upon startup when I came in this morning. 

To my surprise. I was greeted by a series of errors popping up as Visual Studio 2012 fired up, concerning the loading of packages.

In my case it was a number of different packages, one of them being PasteJson.JsonPackage. Restarting VS 2012 didn't help.

The issue turned out to be that VS 2012 maintains some sort of cache (meta data most likely) about the packages and it was either outdated or corrupt for some reason.

You can fix this situation easily by going to C:\Users\[INSERT USER NAME HERE]\AppData\Local\Microsoft\VisualStudio\12.0\ComponentModelCache and deleting all files you find in that folder.

No more errors after that. :-)

Someone mentioned to me that this might be a recurring issue so until it's fixed, just delete the files again.

Posted in: Visual Studio

Tags:

ASP.NET site that runs in Visual Studio 2012 will not run in Visual Studio 2013: mimeMap entry error

July 25, 2014 at 11:38 AMMadestro

I ran into the following error while trying to open a Visual Studio 2012 solution in the new version, Visual Studio 2013:

HTTP Error 500.19 - Internal Server Error

The requested page cannot be accessed because the related configuration data for the page is invalid.

The detailed information section listed the follwing config error:

"Cannot add duplicate collection entry of type 'mimeMap' with unique key attribute 'fileExtension' set to '.woff'"

The important thing here is not the mime type. It's the action of adding it that is causing the problem.

Apparently, the IISExpress version used by Visual Studio 2013 is based on newer IIS engines (7.0 and up) which throw this error when you add the same mime type at multiple levels in the config files.

You can obviously just add it at one level and solve the problem. However, more times than not this is not ideal and you still need to have the entry there.

Fortunately, there is a simple solution. Add a Remove directive right before you add the mime type:

<staticContent>
      <remove fileExtension=".woff" />
      <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
</staticContent>
 
And that's all there is to it. By removing the entry right before you re-add it, you avoid this error.

Posted in: Visual Studio | Web Development

Tags:

How to keep IISExpress running after you stop debugging in Visual Studio 2013

June 24, 2014 at 5:01 AMMadestro

It's very annoying to have the IISExpress web server close down every time you hit the STOP button in the Visual Studio Debugger.

Fortunately, it's simple enough to keep it open:

  1. Go to the web application in the Solution Explorer.
  2. Right click on it and hit "Properties" (or hit ALT + ENTER).
  3. Click on the "Web" tab on the left.
  4. Uncheck the box for "Enable Edit and Continue".

And that's all there is to it.

Posted in: Visual Studio | Web Development

Tags:

Getting your HTML e-mails to work across different e-mail clients and browsers

May 23, 2014 at 11:41 AMMadestro

If you have worked on creating HTML e-mails, you know how frustrating and time consuming it can be.

Not all browsers (and e-mail clients) are created equal, so it's very hard to get stuff to look the same in all of them.

I was editing an e-mail the other day and sure enough, it looked great in one browser but completely messed up on the other.

While  reviewing the HTML in Chrome with the Developer toolbar (F12), I noticed a couple of interesting things:

1. The Elements tab does not display MY code. It displays Chrome's rendering which presumably fixes some inconsistencies and most importantly ADDS consistency by tweaking your HTML slightly.

2. The styles tab displays a box at the bottom with a drawing representing the ACTUAL size, margin and padding of the selected object. Notice I said ACTUAL, not the HTML/CSS defined values.

So, armed with these two things, I did the following:

1. Made sure I got it looking great on Chrome.

2. Copied the source from the Elements tab and replaced my source (right click on the HTML node and select "Copy as HTML"). This effectively gives me cleaner, Google-sanitized HTML code.

3. Used the little Styles tab to get the ACTUAL height, width, margin and padding of my objects. I then drew a little diagram on paper to make sure the numbers made sense (sometimes you put a table with 500 width and include a 520 width TD in it, lol). I took all the ACTUAL values and replaced my ORIGINAL values. For instance, if I had declared a width of 500px for a table, but the actual value was 495px and the table looked great, I replaced the 500px with 495px on my document.

Needless to say, it worked like a charm.

Granted, this is not going to fix all inconsistencies among browsers/clients. Some issues require more complex workarounds but this will take you most of the way.

I also know there are tools out there that can do this for you. This is just a quick, free way to get your HTML e-mails displaying properly (for the most part).

Good luck!

Posted in: Web Development

Tags:

Feel free to share this blog wherever you want!

May 23, 2014 at 11:37 AMMadestro

Hi all, 

I have come across a number of posts from people asking if it's OK to share the content of this blog. The answer is YES!

Please feel free to share the information in any way, shape or form. The main motivation behind this blog is to spread information and save others valuable time.

Have a great day!

Posted in: Everything else

Tags:

Images on rollovers, image buttons or links disappear when you click them on a mobile device

March 4, 2014 at 2:04 PMMadestro

A customer of mine brought up a situation recently where some rollover buttons on a mobile site I made were not working as expected.

In particular, the image was disappearing when users clicked (or rather tapped) on the image link. The only thing left was the alt[ternate] text, while the new page loaded.

It turns out mobile devices have a 300ms delay between a physical tap and the firing of the "Click" event. This is done in order to detect a "double-tap".

After researching a little, I found a decent solution: FastClick.

FastClick is a simple JS library that takes care of this problem while avoiding any interference with your logic.

After downloading FastClick, include it on your html:

<script type="text/javascript" src="/Scripts/FastClick.js"></script>

Then hook it to the objects in question that produce the "Click" (what the user taps on). For instance, if you are using JQuery:

$(document).ready(function ()
  {
       FastClick.attach($('myAnchorTagId'));
   });

Voila!... no more missing images.

Posted in: Web Development

Tags:

The user profile service failed the logon. User profile cannot be loaded

February 25, 2014 at 12:04 PMMadestro

A user was not able to login to a computer for the first time. He kept getting the following error:

The user profile service failed the logon. User profile cannot be loaded

There are plenty of articles out there and even a Microsoft "Fix It" for it:

http://support.microsoft.com/kb/947215/en-us

http://answers.microsoft.com/en-us/windows/forum/windows_7-security/i-receive-error-message-the-user-profile-service/38844b82-a2c1-4fa2-9802-a5318d6f7831

None of this worked for me unfortunately.

After giving it some thought, it occurred to me that maybe the Windows default profile (used when you login for the first time) was corrupted.

So I went to the c:\users\default folder and deleted everything in it. 

I then went to another machine that was working fine and copied the contents of the folder to the machine having trouble.

Problem solved.

Posted in: Windows Networking

Tags:

Blocking sites with the SonicWall TZ-205 Content Filtering Service (CFS)

January 10, 2014 at 2:07 PMMadestro

 

I recently installed a SonicWall TZ-205 on a customer site without a CGSS subscription.

The customer wanted to block some websites. I went to Security Services > CFS and set up a custom list of websites. This functionality still works, even without a subscription.

When I went to apply the policy to the zones however, I got stuck because the combo box used to display the policies was empty. From every tutorial out there, I was expecting to see a "default policy" entry. 

Testing the unit by just checking the "Enable Content Filtering" box didn't work. I could still see the offending site.

It turns out the appliance is smart enough to know NOT to block ME while I am logged in as admin. After I logged out, I tried hitting one of the offending sites and behold!... it worked.

Posted in: Windows Networking

Tags:

Intellisense not working on views after migrating MVC application to Visual Studio 2013

January 8, 2014 at 11:28 AMMadestro

 

I recently migrated one of our MVC applications to Visual Studio 2013.

After the migration, Intellisense broke. It would not work for any view I opened. It wouldn't even recognize the @model directive.

Since part of the plan was to upgrade to the latest version of MVC (5 at the time of this writing), I decided to add the NuGet package and its dependencies. This didn't solve the problem either.

Eventually, I ended up creating a new test MVC project with Visual Studio 2013. I then took the pertinent sections from the web.config file under the Views folder and copied them over to my migrated project. I then closed and relaunched VS2012 and the solution.

That got Intellisense working again.

Keep in mind that if you do this, you will introduce some new dependencies, since the latest template uses the System.Web.Optimization namespace. I didn't try removing this namespace from the web.config but if you don't want the dependencies, you might be able to get away with removing it from the web.config.

Posted in: ASP.NET MVC | Visual Studio

Tags:

Removing SVN from a Visual Studio 2012/2013 Solution

January 7, 2014 at 3:59 PMMadestro

 

I recently ran into a situation while trying to migrate a project from SVN to TFS.

I used the Export command of Tortoise SVN to produce the output I would migrate. This effectively produces a "clean" copy of the code (no SVN folders).

When I tried to add the code to TFS via Visual Studio, I noticed the solution kept loading with SVN bindings (I use the ANKHSVN plugin). If I tried to switch the plugin, it would ask me to close the solution.

I went poking around in the Solution (.sln) file and found the following entry:

 

GlobalSection(SubversionScc) = preSolution

Svn-Managed = True

Manager = AnkhSVN - Subversion Support for Visual Studio

EndGlobalSection

 

Removing this "GlobalSection" did the trick for me. After launching the solution again, I was able to add it to TFS.

I hope this helps anyone with the same issue out there.

Posted in: Visual Studio

Tags: