Derik Whittaker : HowTo, Help!!!http://devlicio.us/blogs/derik_whittaker/archive/tags/HowTo/Help_210021002100_/default.aspxTags: HowTo, Help!!!enCommunityServer 2008.5 SP1 (Build: 31106.3070)FileLoadException: Could not load file for Version 2.0.5.0, Portable Class Libraryhttp://devlicio.us/blogs/derik_whittaker/archive/2012/07/23/fileloadexception-could-not-load-file-for-version-2-0-5-0-portable-class-library.aspxMon, 23 Jul 2012 13:13:33 GMT40756a8b-6212-4073-9d98-6c26781577de:70042Derik Whittaker0http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=70042http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=70042http://devlicio.us/blogs/derik_whittaker/archive/2012/07/23/fileloadexception-could-not-load-file-for-version-2-0-5-0-portable-class-library.aspx#comments<p>Recently while trying to deploy a service to a clean VM (moving this off our main production server onto its own server) I ran into the error below”</p> <blockquote> <p>Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly &#39;System, Version=2.0.5.0, Culture=neutral, <br />PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes&#39; or one of its dependencies. The given assembly name or codebase was invali <br />d. (Exception from HRESULT: 0x80131047)</p> </blockquote> <p>At first glance I thought it was saying that I did not have .net 2 installed on the server which was odd as it had .NBet 3.5 (which is a superset of 2) and .Net 4.&#160; Of course I quickly set out to Bing the hell out of the message but that did not really lead me to an immediate solution.&#160; However, what I did notice was that v 2.0.5.0 was always referred to in the context of Silverlight, this got me thinking.&#160; Was i referencing a Silverlight based assembly in my project?&#160; To find this out I turned to my handy decompiler from <a href="http://www.telerik.com/products/decompiler.aspx">Telerik</a>.&#160; </p> <p>Sure enough I did have a silverlight assembly being referenced in .Net (I did not have the silverlight SDK installed on my box).&#160; I removed the reference and redeployed, but nothing changed.&#160; I still received the error above.&#160; Now I was getting pissed.&#160; I went back to the decompiler and started looking again through my reference tree to see if I missed something, and I did, kinda.&#160; Turns out one of our assemblies is using the Portable Class Library and it is targeted towards the client profile and Silverlight profile, but this should not have caused an issue, but clearly it did.</p> <p>After a bit more digging the answer showed up.&#160; As it turns out the solution to my problem was buried deep on the <a href="http://msdn.microsoft.com/en-us/library/gg597391.aspx">Portable Class Library documentation</a> page (as seen below), and it pointed me toward the <a href="http://www.microsoft.com/en-us/download/details.aspx?id=3556">setup file</a> which solved my issue.</p> <p>&#160;</p> <p><a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/derik_5F00_whittaker/image_5F00_30C77178.png"><img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/derik_5F00_whittaker/image_5F00_thumb_5F00_29C7BEF3.png" width="513" height="47" /></a> </p> <p> <p>Turns out that when you use the Portable Class Library it will actually upgrade/update your .net assemblies on disk in order to use this, which makes sense, and with out running the installed mentioned above you will not be able to use any .net assembly which is based off the Portable Class Library.</p> <p>The moral of the story is that if you are use PCL then make sure you install the update above on your servers in order to get everything to work.</p> <p>Till next time,</p></p><div style="clear:both;"></div><img src="http://devlicio.us/aggbug.aspx?PostID=70042" width="1" height="1">.NetHelp!!!HowToHelp Fiddler is not capturing my traffic!!!http://devlicio.us/blogs/derik_whittaker/archive/2011/09/23/help-fiddler-is-not-capturing-my-traffic.aspxFri, 23 Sep 2011 16:51:36 GMT40756a8b-6212-4073-9d98-6c26781577de:68196Derik Whittaker5http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=68196http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=68196http://devlicio.us/blogs/derik_whittaker/archive/2011/09/23/help-fiddler-is-not-capturing-my-traffic.aspx#comments<p>If you are not a power user, like me, of <a href="http://www.fiddler2.com/">Fiddler2</a> (or even a non-power user) you may run into the occasion where Fiddler simply stops capturing your traffic it can be very frustrating.&#160; Today this happened to me, well technically I caused the issue a few weeks ago, but just noticed it today.</p> <p>If you are like me when this happens you are going to jump out to google and look for an answer.&#160; Most everything I saw out there pointed me to my&#160; WinINet settings or the Fiddler Options (below)</p> <p><a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/derik_5F00_whittaker/image_5F00_09E961A5.png"><img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/derik_5F00_whittaker/image_5F00_thumb_5F00_292C0878.png" width="404" height="270" /></a></p> <p>After looking at my settings and making various pointless changes nothing solved my problem.&#160; I than moved on to the ‘lets see if uninstalling/reinstalling dance’ solves my problem, which of course it did not.&#160; Right When I was about to declare my machine ‘fiddler broken’ I by chanced clicked on the &quot;Filters” tab <br /><a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/derik_5F00_whittaker/image_5F00_1A15299E.png"><img style="background-image:none;border-right-width:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/derik_5F00_whittaker/image_5F00_thumb_5F00_4EB585D9.png" width="182" height="60" /></a></p> <p>and noticed that turned on Using Filters and was ONLY accepting traffic from one IP Address as below</p> <p><a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/derik_5F00_whittaker/image_5F00_67452329.png"><img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/derik_5F00_whittaker/image_5F00_thumb_5F00_72027A7E.png" width="404" height="139" /></a></p> <p>After turning off the ‘User Filters’ option my traffic was being monitored again…. wow that was difficult.</p> <p>The moral of the story is this.&#160; If you turn on filtering in Fiddler you may want to turn it back off prior to leaving the application because chances are you will forget you turned it on a few weeks later and you will pull out your hair trying to find out why your traffic is not being captured.</p> <p>Hope this helps some other poor sap like myself.</p> <p>Till next time,</p><div style="clear:both;"></div><img src="http://devlicio.us/aggbug.aspx?PostID=68196" width="1" height="1">DevelopmentHelp!!!HowToIndex was outside the bounds of the array when Obfuscating a LARGE WP7 applicationhttp://devlicio.us/blogs/derik_whittaker/archive/2011/02/22/index-was-outside-the-bounds-of-the-array-when-obfuscating-a-large-wp7-application.aspxTue, 22 Feb 2011 21:14:00 GMT40756a8b-6212-4073-9d98-6c26781577de:66624Derik Whittaker0http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=66624http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=66624http://devlicio.us/blogs/derik_whittaker/archive/2011/02/22/index-was-outside-the-bounds-of-the-array-when-obfuscating-a-large-wp7-application.aspx#comments<p>This is a follow up to my <a href="http://devlicio.us/blogs/derik_whittaker/archive/2010/12/31/obfuscating-your-wp7-applications.aspx">prior post</a> on how to obfuscate a WP7 application, which is really just a call out to <a href="http://weblogs.asp.net/bsimser/archive/2010/12/31/dotfuscator-deep-dive-with-wp7.aspx">Bil&rsquo;s post</a>.</p>
<p>While trying to get a large (when I say large it takes 2+ hours just to obfuscate) WP7 application ready for publication I ran into an error while trying to obfuscate our entire .xap.&nbsp; The error was</p>
<blockquote>
<p>Writing XAML: Phone.Controls.g.resources\themes/generic.xaml <br />Index was outside the bounds of the array. <br />Build Error.</p>
</blockquote>
<p>No of course this error did NOT lead me to a solution so I tried a whole sort of changes to see if I could resolve it.&nbsp; What I did find is that I could obfuscate each assembly on its own, but not the entire .xap.&nbsp; Because I was getting desperate, and twitter was no help, I decided to email support at <a href="http://www.preemptive.com/know-more/windows-phone-7">PreEmptive</a>.&nbsp; In my email I provided them with my full build log.</p>
<p>Well, less than 24 hours later I received an email from their support with a few suggestions.&nbsp; I tried the suggestions below as suggested:</p>
<p>1.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; From the input tab: make sure that all third party assemblies within the XAP package have been marked as &ldquo;Artifact&rdquo;.&nbsp; (Right click on the third party dll and select &ldquo;Exclude Assembly from Package&rdquo;).&nbsp; This will instruct Dotfuscator to obfuscate/instrument only non-third party libraries.</p>
<p> 2.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; From the settings tab: to start, enable &ldquo;Control Flow&rdquo; and &ldquo;String Encryption&rdquo;, and disable &ldquo;Renaming&rdquo; (i.e. set Disable Renaming to &ldquo;Yes&rdquo;).</p>
<p> 3.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If the XAP file is signed, you can provide a Certificate file by selecting the XAP file from the input tab, and selecting the properties </p>
<p>After doing this I was able to get my app obfuscated and loaded onto my emulator. I even went and ran it again but this time turning String Encryption back on and it still worked.&nbsp; Looks like the trick was to remove the 3rd party assemblies from the list of assemblies to scan, which makes sense.</p>
<p>Anyway, the moral of the story is that when obfuscating your WP7 application make sure you omit any 3rd party assemblies and you should be right as rain.</p>
<p>Till next time,</p><div style="clear:both;"></div><img src="http://devlicio.us/aggbug.aspx?PostID=66624" width="1" height="1">Help!!!HowToWP7WindowsPhoneXAMLInstalling the January WP7 Developer toolshttp://devlicio.us/blogs/derik_whittaker/archive/2011/02/09/installing-the-january-wp7-developer-tools.aspxWed, 09 Feb 2011 16:20:15 GMT40756a8b-6212-4073-9d98-6c26781577de:65403Derik Whittaker3http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=65403http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=65403http://devlicio.us/blogs/derik_whittaker/archive/2011/02/09/installing-the-january-wp7-developer-tools.aspx#comments<p>If you are in the process of trying to upgrade to the January WP7 <a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=49B9D0C5-6597-4313-912A-F0CCA9C7D277">tools</a> and you are running the WindowsPhoneDeveloperResources_en-US_Patch1.msp package make sure you have closed down your emulator.&#160; </p> <p>I have found that when I had my emulator up and running the installer would launch, run for a second then close w/ no message.&#160; When I closed down the emulator and re-ran the package it ran and completed correctly.</p> <p>It is possible this is just my experiences during this install, but I thought I would share this in case someone else out there was wondering why the installer is starting and stopping without any messages.</p> <p>Till next time,</p><div style="clear:both;"></div><img src="http://devlicio.us/aggbug.aspx?PostID=65403" width="1" height="1">Help!!!HowToWP7WindowsPhoneRegistration Error while Hosting WCF Services in a Windows Serverhttp://devlicio.us/blogs/derik_whittaker/archive/2010/02/11/registration-error-while-hosting-wcf-services-in-a-windows-server.aspxThu, 11 Feb 2010 22:46:00 GMT40756a8b-6212-4073-9d98-6c26781577de:55354Derik Whittaker6http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=55354http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=55354http://devlicio.us/blogs/derik_whittaker/archive/2010/02/11/registration-error-while-hosting-wcf-services-in-a-windows-server.aspx#comments<p>Have you ever run into the following error while trying to host (start) a WCF service inside a Windows Service?</p>
<blockquote>
<p>Starting WCF Services step has caused the following error HTTP could not register URL <a href="http://+:9997//Services/HashGenerationService/">http://+:9997//Services/HashGenerationService/</a>. Your process does not have access rights to this namespace (see <a href="http://go.microsoft.com/fwlink/?LinkId=70353">http://go.microsoft.com/fwlink/?LinkId=70353</a> for details).</p>
</blockquote>
<p>If you have you are not along. Also, if you have clicked on the link for MS and felt like that was absolutely NO help, you still are not alone.</p>
<p>The simplest (maybe not the best) way to solve this issue is to configure your windows service (the one hosting your WCF services) to log on as &lsquo;Local System Account&rsquo; as below.</p>
<p><a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/derik_5F00_whittaker/image_5F00_345EDE79.png"><img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/derik_5F00_whittaker/image_5F00_thumb_5F00_480BC80D.png" border="0" height="395" width="364" /></a> </p>
<p>Once you have done this try restarting your service and see if your wcf services start as expected.</p>
<p>Hope this helps.</p>
<p>Till next time,</p><div style="clear:both;"></div><img src="http://devlicio.us/aggbug.aspx?PostID=55354" width="1" height="1">Help!!!HowToWCFNAnt/MSbuild build error MSB4019 -- Missing Targetshttp://devlicio.us/blogs/derik_whittaker/archive/2008/09/19/nant-msbuild-build-error-msb4019-missing-targets.aspxFri, 19 Sep 2008 15:19:23 GMT40756a8b-6212-4073-9d98-6c26781577de:42358Derik Whittaker4http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=42358http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=42358http://devlicio.us/blogs/derik_whittaker/archive/2008/09/19/nant-msbuild-build-error-msb4019-missing-targets.aspx#comments<p>I was trying to setup our new build server today and received this error:</p> <blockquote> <p>error MSB4019: the imported project &lt;Path to .net framework here&gt;\Microsoft.CompactFramework.CSharp.targets was not found.</p></blockquote> <p>At first I was a bit confused as to what was going one, how could you not find my targets file?&nbsp; And of course this was working just fine on my laptop (always works on you machine), but not the build server.</p> <p>Before I dive into the solution for this, I would like to pause to review what was on the build box.</p> <p><strong>Environment Overview:</strong></p> <p>Build Server: Team City<br />Build Script: NAnt<br />Build Action: MSBuild<br />Software Installed: .Net 2.0 SDK, .Net 3.5 SDK, .Net 3.5 Compact Framework SDK, need tools for build.&nbsp; NO Visual Studio IDE&#39;s</p> <p><strong>Onto the Solution:</strong></p> <p>Ok, now that we know what the server setup was like, lets get onto the solution. </p> <p>For what ever reason my build server did not contain any .targets files for the compact framework.&nbsp;&nbsp;&nbsp; These files are normally found in your c:\Windows\Microsoft.Net\Framework\v3.5 folder, but mine were missing.&nbsp; The easiest way to fix this issue is to grab these files off of the server/laptop that has them and copy/paste them onto the server that does not.&nbsp; This worked just fine for me.</p> <p>Note: My issue was with missing targets for the compact framework, but have heard reports of the same thing happening with other .targets files.&nbsp;</p> <p>Hope this helps someone.</p> <p>Till next time,</p><div style="clear:both;"></div><img src="http://devlicio.us/aggbug.aspx?PostID=42358" width="1" height="1">Help!!!HowTo