tag:blogger.com,1999:blog-21356860269847075402008-12-08T14:23:27.846-08:00Sebastian Wojciechowski’s WebLogSebastianhttp://www.blogger.com/profile/16751123768960723440noreply@blogger.comBlogger38125tag:blogger.com,1999:blog-2135686026984707540.post-36747996320934691462008-09-06T09:17:00.001-07:002008-09-06T09:20:04.273-07:002008-09-06T09:20:04.273-07:00Integrating Cellular Emulator support when running Device Emulator from Visual Studio<p>Each time you set COM ports to use Cellular Emulator in Microsoft Device Emulator you need to do soft reset which this takes time. <br />Problem is that those settings are not saved, so when next time you run Device Emulator from VS you need to set those properties again and do soft reset.</p> <p>This is how to set those options so they are applied each time VS runs Device Emulator for you:</p> <ol> <li>Run Cellular Emulator and check port it runs on: <br /><a href="http://lh3.ggpht.com/sebastianwojciechowski7/SMKtHvuerzI/AAAAAAAABa4/aZkeM3Liy78/s1600-h/image%5B21%5D.png" target="_blank"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="126" alt="image" src="http://lh5.ggpht.com/sebastianwojciechowski7/SMKtIROZe2I/AAAAAAAABa8/FhKt6BJaeWY/image_thumb%5B9%5D.png?imgmax=800" width="244" border="0" /></a>  </li> <li>In Visual Studio go to: <br /><strong>Tools/Options/Device Tools/Devices <br /><a href="http://lh6.ggpht.com/sebastianwojciechowski7/SMKtJEtn9dI/AAAAAAAABbA/l7zEbxe9Dgg/s1600-h/image%5B22%5D.png" target="_blank"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="143" alt="image" src="http://lh5.ggpht.com/sebastianwojciechowski7/SMKtJxFnoBI/AAAAAAAABbE/VfRZfudqQ5E/image_thumb%5B10%5D.png?imgmax=800" width="244" border="0" /></a> </strong></li> <li>Select device you want to configure and click <strong>Properties <br /><a href="http://lh3.ggpht.com/sebastianwojciechowski7/SMKtKcHPGoI/AAAAAAAABbI/DSoYfK2dWJc/s1600-h/image%5B23%5D.png" target="_blank"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="167" alt="image" src="http://lh5.ggpht.com/sebastianwojciechowski7/SMKtLPCOUaI/AAAAAAAABbM/P0uFGdXHsAU/image_thumb%5B11%5D.png?imgmax=800" width="244" border="0" /></a> </strong></li> <li>Next click <strong>Emulator Options</strong> </li> <li>In opened window click <strong>Peripherals </strong>tab <br /><a href="http://lh6.ggpht.com/sebastianwojciechowski7/SMKtLuEJIwI/AAAAAAAABbQ/KnQ-yL-ecAY/s1600-h/image%5B24%5D.png" target="_blank"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="188" alt="image" src="http://lh3.ggpht.com/sebastianwojciechowski7/SMKtMbcz1jI/AAAAAAAABbU/Qe1LZIAhc0g/image_thumb%5B12%5D.png?imgmax=800" width="244" border="0" /></a> </li> <li>In <strong>Serial Port 0</strong> choose COM port from point 1. <br />Note: If COM port from point 1 is not listed, just type it in. </li> <li>OK all </li> </ol> <p>Now, when you hit F5 in VS it will load emulator with phone support. <br /> <br />Disadvantage is that it will take a lot of time to boot the emulator, so disable it when you do not need phone support.</p> <p>Cellular Emulator must be running all the time for it to work.</p> Sebastianhttp://www.blogger.com/profile/16751123768960723440noreply@blogger.com0tag:blogger.com,1999:blog-2135686026984707540.post-38232782078646419462008-09-05T08:51:00.000-07:002008-09-05T08:51:00.598-07:002008-09-05T08:51:00.598-07:00Google Chrome on Lenovo T61<p>3 of us here installed Google Chrome on T61 laptops and got this:</p> <p><a href="http://lh5.ggpht.com/sebastianwojciechowski7/SMEBHJ6HktI/AAAAAAAABaQ/2PnRn7YX9Ik/s1600-h/image%5B3%5D.png"><img title="image" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="123" alt="image" src="http://lh4.ggpht.com/sebastianwojciechowski7/SMEBH5gTtEI/AAAAAAAABaU/3T7W0kwtGLg/image_thumb%5B1%5D.png?imgmax=800" width="549" border="0"></a> </p> <p> </p> <p>Ups. It works on my home computer.</p> Sebastianhttp://www.blogger.com/profile/16751123768960723440noreply@blogger.com0tag:blogger.com,1999:blog-2135686026984707540.post-17393639581895486322008-01-09T09:20:00.000-08:002008-08-23T15:28:51.758-07:002008-08-23T15:28:51.758-07:00Why my VSTO Office 2003 addin doesn't work?<h3><strong>First things you need to know</strong> </h3> <ol> <li>You can see the list of detected and enabled addins in Outlook in: <br /><strong>Tools->Options->Other->Advanced Options->COM Add-Ins... <br /></strong>If there were some error and addin has not been loaded it will be there with unchecked box. This is where you enable disabled addins. When you check addin and click OK - addin will be enabled right away, you don't have to restart Outlook <br /> <br /></li> <li>If addin prevented Outlook from functioning correctly it will be "hard disabled" and put there: <br /><strong>Help->About Microsoft Office Outlook->Disabled Items... <br /></strong> <br /></li> <li>When addin fails to load, by default, we don't see any info about it or the error details. But we can change it! </li> </ol> <ul> <li>Open command prompt: <br /><strong>cmd</strong> <br /></li> <li>Type: <br /><strong>set VSTO_SUPPRESSDISPLAYALERTS=0</strong> <br /></li> <li>Run Outlook from that command line, should be like this: <br /><strong>"c:program filesMicrosoft OfficeOffice11Outlook.exe"</strong> </li> </ul> <p>Now if something fails with addin - you will see it. </p> <p>This will give you good basic to debug why your addin doesn't work. <br />I recently had a lot of problems with it. I thought about sharing it with you so that you don't have to go through it again :-) <br />BTW: you won't find those information on any forums or other pages ;-) </p> <h3>Things to verify</h3> <ol> <li>Install all required assemblies to GAC. This gives them full permissions so if it's something with permissions now it should work. If it does work - check your CAS settings. <br /> <br /></li> <li>Check manifest file. If you played with solution reorganization, changed names of projects, classes - there will be a problem. <br />Take a look at the underlined fragments: <br /> <br /><font face="Courier New"><assembly xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" manifestVersion="1.0"> <br />  <assemblyIdentity <strong><u>name="Sample.Addin.dll"</u></strong> version="1.0.0.0" /> <br />  <asmv2:entryPoint name="Startup" dependencyName="dependency0"> <br />    <asmv2:clrClassInvocation <strong><u>class="Sample.Addin.OutlookAddin"</u></strong> /> <br />  </asmv2:entryPoint> <br />  <asmv2:dependency asmv2:name="dependency0"> <br />    <asmv2:dependentAssembly> <br />      <assemblyIdentity <strong><u>name="Sample.Addin" version="3.2.0.0" publicKeyToken="c45b3b012bedcf43"</u></strong> /> <br />    </asmv2:dependentAssembly> <br />    <asmv2:installFrom codebase="Sample.Addin.dll" /> <br />  </asmv2:dependency> <br /></assembly> <br /></font> <br /></li> <li>Then take a look at the registry setting in the setup project. Verify all paths. <br />Make sure that XXX in keys below are equal to ProgID: <br /><font face="Courier New">HKCU/Software/Classes/XXX/CLSID <br /></font>and <br /><font face="Courier New">HKCU/Software/Microsoft/Office/Outlook/Addins/XXX</font> <br /> <br /></li> <li>Got this: <br /><font face="Courier New">"Could not load file or assembly 'Microsoft.Office.Interop.Outlook, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. <br />System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Office.Interop.Outlook, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies...."</font> <br /> <br />Yeah, had this too :) Make sure that you don't have any Office 2007 applications installed on the development machine. I had SharePoint Designer. Uninstall them and reopen solution. Dependency to office.dll 12.0.0.0 should be gone (verify it in the dependency list in setup project). <br />Rebuild setup project. </li> </ol> <p> <br />I think that's it :) <br />Good luck!</p>Sebastianhttp://www.blogger.com/profile/16751123768960723440noreply@blogger.com1tag:blogger.com,1999:blog-2135686026984707540.post-18466781146932663632007-12-21T08:05:00.000-08:002008-08-23T15:28:39.686-07:002008-08-23T15:28:39.686-07:00Can TextBox.Text ever be null?Recently I have been asked this question. Answer is that it cannot be null and will not be null, so you don't have to:<br /><pre>.Text != null</pre><br />Why? Because .Text property in base class does:<br /><pre> set <br /> { <br /> if (value == null) <br /> { <br /> value = ""; <br /> } <br /> ..... <br /> }</pre><br />Above is for TextBox from Windows.Forms, as for TextBox from WebControls it's the same. The getter looks like this:<br /><pre> get <br /> { <br /> string str = (string) this.ViewState["Text"]; <br /> if (str != null) <br /> { <br /> return str; <br /> } <br /> return string.Empty; <br /> }</pre><br />If you don't believe me just try to assign a null value :-)Sebastianhttp://www.blogger.com/profile/16751123768960723440noreply@blogger.com0tag:blogger.com,1999:blog-2135686026984707540.post-56032417565846787052007-11-29T08:40:00.000-08:002008-08-25T04:12:02.414-07:002008-08-25T04:12:02.414-07:00Lookup fields in custom activity and [%_x005f_String0%]If you do a custom activity, configure it to use Lookup fields on field configured as DesignerType="StringBuilder" and instead of field value you get [%_x005f_String0%] you need to process this value with this function: public static string ProcessStringField ( string str, Activity activity, WorkflowContext context ) Here is a code sample:<br /><pre><br />//... <br />public static DependencyProperty __ContextProperty = <br /> DependencyProperty.Register("__Context", typeof(WorkflowContext), typeof(EmailActivity)); <br />//... <br />[ValidationOption(ValidationOption.Optional)]public WorkflowContext __Context <br />{ <br /> get { return (WorkflowContext) base.GetValue(__ContextProperty); } <br /> set { base.SetValue(__ContextProperty, value); }<br />} <br />//... <br />protected override ActivityExecutionStatus Execute(ActivityExecutionContext provider) <br />{ <br /> Activity parent = provider.Activity; <br /> while (parent.Parent != null) <br /> { <br /> parent = parent.Parent; <br /> } <br /> <br /> string returnValue = Helper.ProcessStringField(stringToProcess, parent, this.__Context)); <br />}</pre><br />It seems that if you don't have WorkflowContext you can pass null<br /><pre>string returnValue = Helper.ProcessStringField(stringToProcess, parent, this.__Context));</pre>Sebastianhttp://www.blogger.com/profile/16751123768960723440noreply@blogger.com0tag:blogger.com,1999:blog-2135686026984707540.post-44917639639992873832007-11-21T07:50:00.000-08:002008-08-23T15:28:40.161-07:002008-08-23T15:28:40.161-07:00Closing Form with WebBrowser control after window.close with C#I recently had this problem. I have a Windows Form that hosts a WebBrowser control. The page in the WebBrowser control closes itself using window.close and when it does that the Windows Form freezes up.<br /><br />Found a solution <a target="_blank" href="http://blogs.msdn.com/jpsanders/archive/2007/05/25/how-to-close-the-form-hosting-the-webbrowser-control-when-scripting-calls-window-close-in-the-net-framework-version-2-0.aspx"><font color="#488f0a">here</font></a> posted by <a target="_blank" href="http://blogs.msdn.com/jpsanders/default.aspx"><font color="#488f0a">Jeff Sanders</font></a> on his <a target="_blank" href="http://blogs.msdn.com/jpsanders/default.aspx"><font color="#488f0a">blog</font></a> (thanks man!)<br /><br />The sample code is provided in VB.NET Below is the same code rewritten in C#<br /><pre><br />public class ExtendedWebBrowser : WebBrowser<br /> {<br /> public const int WM_PARENTNOTIFY = 0x0210;<br /> public const int WM_DESTROY = 2;<br /><br /> public delegate void ClosingEventHandler();<br /> public event ClosingEventHandler Closing;<br /><br /> protected override void WndProc(ref Message m)<br /> {<br /> switch (m.Msg)<br /> {<br /> case WM_PARENTNOTIFY:<br /> if (!this.DesignMode)<br /> {<br /> if (m.WParam.ToInt32() == WM_DESTROY)<br /> {<br /> if (this.Closing != null)<br /> {<br /> this.Closing();<br /> }<br /> }<br /> }<br /> base.DefWndProc(ref m);<br /> break;<br /><br /> default:<br /> base.WndProc(ref m);<br /> break;<br /> }<br /> }<br /> }<br /></pre>Sebastianhttp://www.blogger.com/profile/16751123768960723440noreply@blogger.com0tag:blogger.com,1999:blog-2135686026984707540.post-12771505945174922382007-09-09T14:15:00.000-07:002008-08-23T15:35:13.554-07:002008-08-23T15:35:13.554-07:00Zoom in / Zoom out code in Visual Studio<p>When I browse code looking for something or when I take a look at a new class I want to see as much code as I can. But then when I enter the “coding” mode I want to focus on code that I write and I want to have bigger font to make it easier to read.</p> <p>To achieve this you could change the font size in options, well this is what you have to do. But doing it manually is not real.</p> <p>The simplest solution is to just make font bigger/smaller using a shortcut key. We could write macro for that… wait, hold on… what I see, Visual Studio already has macro for making source code editor font bigger/smaller, sweet– high five! <br /></p> <p><img id="id" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="116" alt="macros" src="http://blog.icsharp.net/wp-content/uploads/2007/09/macros.gif" width="437" border="0" /> </p> <p>So the only thing we have to do is just bind shortcut keys to those macros.</p> <p>I use CTRL+A for making the font bigger and CTRL+Z for making it smaller (just like changing gears in Need For Speed, well just without CTRL key).</p> <p>So in results we have something like this:</p> <p><img id="id" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="333" alt="test" src="http://blog.icsharp.net/wp-content/uploads/2007/09/test.gif" width="500" border="0" /> </p> <p> The first time the macro is executed it runs slowly, but next calls are fast.</p>Sebastianhttp://www.blogger.com/profile/16751123768960723440noreply@blogger.com0tag:blogger.com,1999:blog-2135686026984707540.post-41828069664364431792007-08-11T06:12:00.000-07:002008-08-27T11:49:18.372-07:002008-08-27T11:49:18.372-07:00Error - Microsoft Office SharePoint Server 2007 Installation and Configuration LabUps! :-)<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_wnkZvOnRQ6s/SLWhn51AAVI/AAAAAAAABZM/vWpaj8dD-vY/s1600-h/virtuallab_error.jpg"><img style="cursor: pointer;" src="http://3.bp.blogspot.com/_wnkZvOnRQ6s/SLWhn51AAVI/AAAAAAAABZM/vWpaj8dD-vY/s400/virtuallab_error.jpg" alt="" id="BLOGGER_PHOTO_ID_5239271448425529682" border="0" /></a>Sebastianhttp://www.blogger.com/profile/16751123768960723440noreply@blogger.com0tag:blogger.com,1999:blog-2135686026984707540.post-49160527915697592502007-08-11T06:11:00.000-07:002008-08-27T11:51:35.286-07:002008-08-27T11:51:35.286-07:00Not implemented 0x80004001 while capturing entire screen in Windows Media Encoder 9If you get:<br /><br /><em>“1 error(s) occurred during this session. Click Error Log for details.“</em><br /><br /><em>“Not implemented 0x80004001“</em><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_wnkZvOnRQ6s/SLWh8dRG6XI/AAAAAAAABZU/llXvlpdIxPI/s1600-h/wme_error1.gif"><img style="cursor: pointer;" src="http://3.bp.blogspot.com/_wnkZvOnRQ6s/SLWh8dRG6XI/AAAAAAAABZU/llXvlpdIxPI/s400/wme_error1.gif" alt="" id="BLOGGER_PHOTO_ID_5239271801536047474" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_wnkZvOnRQ6s/SLWh_xwS_GI/AAAAAAAABZc/82OOsgnYUSg/s1600-h/wme_error2.gif"><img style="cursor: pointer;" src="http://1.bp.blogspot.com/_wnkZvOnRQ6s/SLWh_xwS_GI/AAAAAAAABZc/82OOsgnYUSg/s400/wme_error2.gif" alt="" id="BLOGGER_PHOTO_ID_5239271858575178850" border="0" /></a><br /><br />errors while <strong>Capture screen</strong>, <strong>Entire screen</strong> using <strong>Windows Media Encoder 9</strong> that probably means that you are in multiple monitor mode.<br /><br />Switch to one monitor mode and it should work.Sebastianhttp://www.blogger.com/profile/16751123768960723440noreply@blogger.com1tag:blogger.com,1999:blog-2135686026984707540.post-54644376890732789432007-07-15T05:08:00.000-07:002008-08-27T11:53:52.516-07:002008-08-27T11:53:52.516-07:00The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_wnkZvOnRQ6s/SLWijdj9t-I/AAAAAAAABZs/J9DHGTPOOjo/s1600-h/errorpage.GIF"><img style="cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_wnkZvOnRQ6s/SLWijdj9t-I/AAAAAAAABZs/J9DHGTPOOjo/s400/errorpage.GIF" border="0" alt=""id="BLOGGER_PHOTO_ID_5239272471630034914" /></a><br /><br />If you have this error and you did all of those things:<br /><ul><br /> <li>reinstalled DLLs,</li><br /> <li>checked custom aspx if they reference any misspelled DLLs, </li><br /> <li>removed one by one all the custom solutions,</li><br /> <li>ran the “SharePoint Products and Technologies Configuration Wizard”,</li><br /> <li>thought “Let’s go for a lunch and then reinstall this machine”</li><br /></ul><br />Check the web.config Best thing would be to take it from other machine and compare with a diff tool.<br />Take a look at what was wrong in our case:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_wnkZvOnRQ6s/SLWin-ih4UI/AAAAAAAABZ0/AMH4Y5hOQzo/s1600-h/compare12.gif"><img style="cursor:pointer; cursor:hand;" src="http://4.bp.blogspot.com/_wnkZvOnRQ6s/SLWin-ih4UI/AAAAAAAABZ0/AMH4Y5hOQzo/s400/compare12.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5239272549201862978" /></a><br />Lesson learned!Sebastianhttp://www.blogger.com/profile/16751123768960723440noreply@blogger.com0tag:blogger.com,1999:blog-2135686026984707540.post-46124354723027172752006-11-29T11:10:00.000-08:002008-08-23T15:28:44.133-07:002008-08-23T15:28:44.133-07:00HeaderImageUrl overwrites HeaderTextIf you set up HeaderImageUrl property in HyperLinkColumn, the text from HeaderText will not be shown.<br />Take this code for example:<br /><br /><font face="Courier New"><asp:HyperLinkColumn DataTextField="urn:schemas-microsoft-com:office:office#Author"<br />DataNavigateUrlField="urn:schemas-microsoft-com:office:office#Author"<br />DataNavigateUrlFormatString="/MySite/Public.aspx?user={0}"<br /><strong>HeaderText="Author" HeaderImageUrl="/_layouts/images/imnhdr.gif"</strong>></font><br /><br /><font face="Curier New">The "Author" text will not be shown in this column's header. Only the icon will be visible. Well there is a simple way to solve <br /><br />this:</font><br /><br /><font face="Curier New"> </font><font face="Courier New"><asp:HyperLinkColumn DataTextField="urn:schemas-microsoft-com:office:office#Author"<br />DataNavigateUrlField="urn:schemas-microsoft-com:office:office#Author"<br />DataNavigateUrlFormatString="/MySite/Public.aspx?user={0}"<br /><strong>HeaderText="<img src='/_layouts/images/imnhdr.gif'/>Author"</strong>></font><br /><br /><font face="Curier New">hey, it works :-)</font><font face="Curier New"> </font>Sebastianhttp://www.blogger.com/profile/16751123768960723440noreply@blogger.com0tag:blogger.com,1999:blog-2135686026984707540.post-25394391977884824702006-09-09T11:35:00.000-07:002008-08-25T09:09:31.868-07:002008-08-25T09:09:31.868-07:00How to force Visual Studio to recompile project at "Build" actionOur solution contains about 30 projects. There are web apps, windows services, web controls, web parts (usual stuff for SharePointers). One of them is a BuildApp. It contains only one empty file class1.cs but it's there to register DLLs in GAC, web parts in SPS and restart appPool.<br /><br />After installing Visual Studio 2003 SP1 the BuildApp is not compiled during build operation. VS detects that it's up to date and leaves it. It's cool, it should be like that (why it compiled it before?)<br /><br />But if BuildApp is not compiled, post build events are not fired. This forces us to run them manually. Personally I am a lazy but productive developer so I decided to fix it.<br /><br />To fool VS to think that the project needs to be compiled, open one of the compiled files (the empty file which nobody will edit again), change date to something in far future like 2010, edit file and save it.<br />If you use SourceSafe edit the file outside the VS and remove "read only" attribute manually (apply is after edit has been made).<br /><br />Thanks to this trick VS will compile the project every time you do the "build" and run post build events - sweet!<br /><br />It works for Visual Studio 2003 SP1 and Visual Studio 2005Sebastianhttp://www.blogger.com/profile/16751123768960723440noreply@blogger.com2tag:blogger.com,1999:blog-2135686026984707540.post-28409979223731286312006-08-31T11:59:00.000-07:002008-08-27T11:55:55.777-07:002008-08-27T11:55:55.777-07:00Building active project rather than whole solution in VS 2003Have you ever needed to build only one project, the one you are currently working on, rather than a whole solution (especially the webparts deployment projects)?<br />There is a shortcut "ctrl+shift+b" but it builds whole solution. If you want to build current project you have to take your hands off the keyboard, move your mouse and click (two times!) “Build/Build ProjectName“.<br /><br />Well, you can create a shortcut for it and it's easy!<br />Just go to Tools/Options/Environment/Keyboard, choose "Build.BuildSelection" command and assign a shortcut for it.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_wnkZvOnRQ6s/SLWjAMf1huI/AAAAAAAABZ8/YViXK6lzPKQ/s1600-h/o_build_selection.gif"><img style="cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_wnkZvOnRQ6s/SLWjAMf1huI/AAAAAAAABZ8/YViXK6lzPKQ/s400/o_build_selection.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5239272965265524450" /></a><br /><br />Now look at "Build/Build 'ProjectName'" - we have a shortcut!<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_wnkZvOnRQ6s/SLWjEdxtWDI/AAAAAAAABaE/eOUCdPoBfkE/s1600-h/o_build_selection2.jpg"><img style="cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_wnkZvOnRQ6s/SLWjEdxtWDI/AAAAAAAABaE/eOUCdPoBfkE/s400/o_build_selection2.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5239273038623365170" /></a><br /><br />In VS 2005 this command has a “shift + F6” shortcut defined by default.Sebastianhttp://www.blogger.com/profile/16751123768960723440noreply@blogger.com3tag:blogger.com,1999:blog-2135686026984707540.post-51174641686312345022006-03-11T10:15:00.000-08:002008-08-23T15:28:45.593-07:002008-08-23T15:28:45.593-07:00Internal server error:Missing LinkUrl<font size="2" color="#000000" face="Courier New"><br /><p class="postText"><font size="2" color="#000000" face="Verdana">I've had a problem with this and I've seen other people having problem with this too.<br />If after making a SQL Full Text query like this:</font><br /><br /><font color="#0000ff">SELECT</font><br /><font size="2" color="#ff0000">"DAV:getcontentlength"</font><font color="#000000">,<br /></font><font size="2" color="#ff0000">"urn:schemas-microsoft-com:office:office#Title"</font><font color="#000000" face="Courier New">,<br /></font><font size="2" color="#ff0000">"Rank"<br /></font><font size="2" color="#0000ff">FROM </font><font size="2" color="#000000">Portal_Content..</font><font size="2" color="#ff00ff">Scope</font><font size="2" color="#2f4f4f">()<br /></font><font size="2" color="#0000ff">WHERE </font><font size="2" color="#2f4f4f">(</font><font size="2" color="#ff0000">"DAV:getcontentlength" </font><font size="2" color="#2f4f4f">> </font><font size="2" color="#00008b">10000</font><font size="2" color="#2f4f4f">)<br /></font><font size="2" color="#0000ff">ORDER BY </font><font size="2" color="#ff0000">"DAV:getcontentlength"</font><br /><br /><font size="2" color="#000000" face="Verdana">using search.asmx web service you get this error:</font><br /><br /><?xml version="1.0" encoding="utf-16"?><br /><ResponsePacket xmlns="urn:Microsoft.Search.Response"><br /> <Response domain="QDomain"><br /> <Copyright>Microsoft (c) Office SharePoint (tm) Portal Server 2003</Copyright><br /> <Status>ERROR_SERVER</Status><br /> <DebugErrorMessage>Internal server error:Missing LinkUrl</DebugErrorMessage><br /> </Response><br /></ResponsePacket><br /><br /><font size="2" color="#000000" face="Verdana">it's not a xml error. Just add this column to a select</font><br /><br /><font size="2" color="#ff0000" face="Courier New">"DAV:href"</font><br /><br /><font size="2" color="#000000" face="Verdana">and query it again</font><br /><br /></p></font><font color="#0000ff">SELECT</font><br /><font size="2" color="#ff0000"><strong>"DAV:href",</strong></font><br /><font size="2" color="#ff0000">"DAV:getcontentlength"</font><font size="2">,<br /></font><font size="2" color="#ff0000">"urn:schemas-microsoft-com:office:office#Title"</font><font size="2" face="Courier New">,<br /></font><font size="2" color="#ff0000">"Rank"<br /></font><font size="2" color="#0000ff">FROM </font><font size="2">Portal_Content..</font><font size="2" color="#ff00ff">Scope</font><font size="2" color="#2f4f4f">()<br /></font><font size="2" color="#0000ff">WHERE </font><font size="2" color="#2f4f4f">(</font><font size="2" color="#ff0000">"DAV:getcontentlength" </font><font size="2" color="#2f4f4f">> </font><font size="2" color="#00008b">10000</font><font size="2" color="#2f4f4f">)<br /></font><font size="2" color="#0000ff">ORDER BY </font><font size="2" color="#ff0000">"DAV:getcontentlength"</font>Sebastianhttp://www.blogger.com/profile/16751123768960723440noreply@blogger.com0tag:blogger.com,1999:blog-2135686026984707540.post-89897662637195407682006-02-20T08:28:00.000-08:002008-08-23T15:28:49.279-07:002008-08-23T15:28:49.279-07:00System.Runtime. InteropServices. COMException on viewlsts.aspx and SPWeb form context<span lang="EN-US">Some time ago I was developing a web control which had to take a list of a SPListItems from a specific SPList from a current SPWeb. </span><span lang="PL">Simple thing. Code was also simple. </span><span lang="EN-US">I used </span><span lang="EN-US">SPControl.GetContextWeb and got the list I wanted. I wrote the code and everything was ok until… until during tests I got into a viewlsts.aspx page. This page welcomed me with a nasty error message:</span><br /><br /><span lang="EN-US" /><strong><span lang="EN-US">System.Runtime.InteropServices.COMException</span></strong><br /><br /><strong><span lang="EN-US" /></strong><span lang="EN-US">First thing that came to my mind was that the list was not found. Strange. That means that the list disappeared or the wrong SPWeb has been opened. To check it I printed the SPWeb.Url and SPWeb.Name properties. Url was ok, but the .Name was from totally different Web! That’s why the list couldn’t be found - SPControl.GetContextWeb opened some other Web.<br /></span><span lang="PL">Ok, ok. So let’s create SPWeb object manually. </span><span lang="EN-US">Dang, another problem. Page.Request.Url returns only "<em>_layouts/1033/viewlsts.aspx</em>". But hey, the .Url property of our ‘wrong’ SPWeb object from context is correct, so why not use it. That was it, now everything works like a charm :)</span><br /><br /><span lang="EN-US">Here’s the code:</span><br /><br /><span lang="EN-US" /><span lang="EN-US" /><span lang="EN-US"><br /><div style="padding-right: 0pt; padding-left: 0pt; font-size: 10pt; background: white; padding-bottom: 0pt; color: black; padding-top: 0pt; font-family: Courier New; border: windowtext 1pt solid"><br /><pre style="margin: 0px"><span style="color: blue">private</span> SPWeb GetCurrentSPWeb()</pre><br /><pre style="margin: 0px">{</pre><br /><pre style="margin: 0px"> SPWeb contextWeb = SPControl.GetContextWeb(Context);</pre><br /><pre style="margin: 0px"> SPSite site = <span style="color: blue">new</span> SPSite(contextWeb.Url);</pre><br /><pre style="margin: 0px"> </pre><br /><pre style="margin: 0px"> Uri contextWebUri = <span style="color: blue">new</span> Uri(contextWeb.Url);</pre><br /><pre style="margin: 0px"> </pre><br /><pre style="margin: 0px"> SPWeb currentWeb = site.OpenWeb( contextWebUri.AbsolutePath ) </pre><br /><pre style="margin: 0px"> </pre><br /><pre style="margin: 0px"> <span style="color: blue">return</span> currentWeb;</pre><br /><pre style="margin: 0px">} </pre><br /></div><br /><!--EndFragment--><span lang="EN-US" /></span><span lang="EN-US"><font face="Verdana">The recommendation I’ve been told some time ago, says that it’s better to get the SPWeb from SPSite.OpenWeb and not from the context. As you can see recommendation is good because context sometimes doesn’t work like it should :)</font></span><br /><br />Sebastianhttp://www.blogger.com/profile/16751123768960723440noreply@blogger.com0tag:blogger.com,1999:blog-2135686026984707540.post-47865946361548547882006-02-02T07:33:00.000-08:002008-08-23T15:28:40.992-07:002008-08-23T15:28:40.992-07:00Curse you Visual Studio 2003!!Since I'm working on VMWare machine on SharePoint, the little window named "Microsoft Development Environment has encountered a problem and needs to be close" become main part of my life.<br /><br />Always when I got this message I had a close and send error to Microsoft buttons. I always send those error reports.<br /><br />Few moments ago VS crashed again, but this time I got a window without the send button. What?, I guess the guys at Microsoft are just tired of those reports... just like we are tired of those crashes.<br /><br />Check it out<br /><br /> <img id="image28" title="Visual Studio 2003 crash" alt="Visual Studio 2003 crash" src="http://blog.icsharp.net/wp-content/uploads/2006/02/vs_error.JPG" /><br /><br /><strong>[UPDATE 08 feb 2006]</strong><br /><br />wait, the 'send error' button is back. I still can spam Microsoft with my error reports :-)Sebastianhttp://www.blogger.com/profile/16751123768960723440noreply@blogger.com0tag:blogger.com,1999:blog-2135686026984707540.post-76157257031292584692006-02-01T07:46:00.000-08:002008-08-25T09:13:52.486-07:002008-08-25T09:13:52.486-07:00Google toolbar 4 betaCheck it out. New version of Google Toolbar. It has a new looks. Take a look at it, maybe you will like it :-) It's still beta.<br /><br /><a href="http://www.google.com/tools/toolbar/T4/index.html">http://www.google.com/tools/toolbar/T4/index.html</a><br /><br />Just found those cool things:<br /> <ul><li>When you type text toolbar gives you suggestions and checks for typos<br /> </li><li>When you type text which is longer that a toolbar's textbox, it expands! that what I was missing. Now you can type long sentences and see it all.<br /></li></ul>So go ahead and download it, now! :-)Sebastianhttp://www.blogger.com/profile/16751123768960723440noreply@blogger.com0tag:blogger.com,1999:blog-2135686026984707540.post-12992572082805199682005-12-27T18:16:00.000-08:002008-08-24T05:37:03.651-07:002008-08-24T05:37:03.651-07:00System.Uri.BasePath is private, oh no!For SharePoint developers working with URL is a crucial thing. So probably many of us noticed that BasePath property of Uri class is private. Maybe it is something like <a href="http://jelle.druyts.net/Permalink.aspx?title=StaticClassesAndTheHasShutdownStartedProperty" target="_blank">property in .NET 1.0 </a>(example in "Framework Designing Guidelines") but I don’t think so.<br /><br />So, how we can solve this? Well, in a SharePoint context I think we can use segment method, because in SharePoint we always get a file name at the end of the URL.<br /><br />1 <span style="font-family: Courier New">Uri testUrl = new Uri(http://testUrl.com/something/list/AllItems.aspx);<br /></span><br />2<span style="font-family: Courier New"> string basePath = testUrl.AbsolutePath.Replace(testUrl.Segments[testUrl.Segments.Length - 1], ""); </span><br /><br />In more advanced method you can check is the last segment is a file, for example by doing IndexOf(”.”);<br />Safer version is to use static method <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemiopathclassgetdirectorynametopic.asp">System.IO.Path.GetDirectoryName</a>. Using this method we only have to replace “\” with “/” since GetDirectoryName translates it to a file path. It looks like this:<br /><br />1 <span style="font-family: Courier New">Uri testUrl = new Uri(http://testUrl.com/something/list/AllItems.aspx); </span><br /><br />2 <span style="font-family: Courier New">string basePath = Path.GetDirectoryName(testUrl.AbsolutePath).Replace(@"\", "/"); </span><br /><br />Here is a complete console application for you to test. If you know any other ways to get BasePath, be sure to comment this post.<br /><p style="border: 1pt solid windowtext; padding: 0pt; background: white none repeat scroll 0% 50%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black; font-family: Courier New"><!--StartFragment--></p><br /><br /><style> .cf { font-family: Courier New; font-size: 10pt; color: black; background: white; } .cl { margin: 0px; } .cb1 { color: blue; } .cb2 { color: teal; } .cb3 { color: maroon; } .cb4 { color: green; }</style><br /><p class="cf"> </p><br /><br /><pre class="cl"><span class="cb1">using</span> System;</pre><br /><pre class="cl"><span class="cb1">using</span> System.IO;</pre><br /><pre class="cl"></pre><br /><pre class="cl"><span class="cb1">class</span> MyApp</pre><br /><pre class="cl">{</pre><br /><pre class="cl"> [<span class="cb2">STAThread</span>]</pre><br /><pre class="cl"> <span class="cb1">static</span> <span class="cb1">void</span> Main(<span class="cb1">string</span>[] args)</pre><br /><pre class="cl"> {</pre><br /><pre class="cl"> Uri testUrl = <span class="cb1">new</span> Uri(<span class="cb3">"http://testUrl.com/something/list/AllItems.aspx"</span>);</pre><br /><pre class="cl"></pre><br /><pre class="cl"> <span class="cb4">//Segments method</span></pre><br /><pre class="cl"> <span class="cb2">Console</span>.WriteLine(<span class="cb3">"Using segments:"</span> +</pre><br /><pre class="cl"> testUrl.AbsolutePath.Replace(testUrl.Segments[testUrl.Segments.Length - 1], <span class="cb3">""</span>));</pre><br /><pre class="cl"></pre><br /><pre class="cl"> <span class="cb4">//Path.GetDirectoryName method</span></pre><br /><pre class="cl"> <span class="cb2">Console</span>.WriteLine(<span class="cb3">"Using Path.GetDirectoryName: "</span> +</pre><br /><pre class="cl"> <span class="cb2">Path</span>.GetDirectoryName(testUrl.AbsolutePath).Replace(<span class="cb3">@"\"</span>, <span class="cb3">"/"</span>) + <span class="cb3">"/"</span>);</pre><br /><pre class="cl"> <span class="cb2">Console</span>.ReadLine();</pre><br /><pre class="cl"> }</pre><br /><pre class="cl">}</pre><br /><!--EndFragment-->Sebastianhttp://www.blogger.com/profile/16751123768960723440noreply@blogger.com0tag:blogger.com,1999:blog-2135686026984707540.post-39523871608132132082005-12-05T11:10:00.000-08:002008-08-23T15:28:38.826-07:002008-08-23T15:28:38.826-07:00"The server instance specified was not found. Please specify the server's address and port." ErrorYesterday I ran into this problem. I tried to deploy Web Parts package with stsadm.exe and then bam!!<br /><br /><strong>“The server instance specified was not found. Please specify the server's address and port.”</strong><br /><br />On Saturday everything worked like a charm, and on Sunday that error (don’t ask how I know it worked on Saturday and Sunday ;-) ).<br />I didn’t do anything unusual. I’ve checked the Windows Auto update log, and it installed many updates on Saturday morning. I thought that it was it.<br /><br />Anyway, what helped me is<a href="http://blogs.msdn.com/mjeelani/archive/2005/03/05/385816.aspx"> this post </a>on Mohammed Jeelani's Blog. <br /><br />For me it was the first reason.<br />Sebastianhttp://www.blogger.com/profile/16751123768960723440noreply@blogger.com0tag:blogger.com,1999:blog-2135686026984707540.post-4953484938304754802005-10-05T14:51:00.000-07:002008-08-23T15:28:41.814-07:002008-08-23T15:28:41.814-07:00Enter, backspace, cut, paste stuck in Visual Studio.NET 2005 BETA 2From time to time my keyboard gets stuck in Visual Studio.NET 2005 BETA 2. Enter, backspace, keyboard cut & paste just stop working in C# editor.<br />Seems that showing and hiding the solution explorer fixes this problem. <br />Looks like hidden panels steal focus - pin them, turn off auto-hide. <br />And if your keyboard gets really stuck, try to press Shift + Alt + Enter few times.<br /><br />Good luck :-)Sebastianhttp://www.blogger.com/profile/16751123768960723440noreply@blogger.com0tag:blogger.com,1999:blog-2135686026984707540.post-4423455253073058432005-10-05T12:16:00.000-07:002008-08-23T15:28:44.960-07:002008-08-23T15:28:44.960-07:00ILMerge - merge multiple .NET assemblies into a single assemblyAre you tired of deploying applications with a millions of dll files? <br />for ex. <code>Something.XML.dll, Something.DAL.dll, SomeControl.Something.dll</code><br /><br />Now (well since 16 March 2005) you can merge those files into one single assembly and deploy just one file!<br />It is freely available for use from <a href="http://www.msdn.microsoft.com/netframework/downloads/tools/default.aspx" target="_blank">this page</a> from "Other Tools & Utilities" section.<br /><br />Best fo all - its license does allow commercial usage!<br /><br />Be sure to read the article: <a href="http://www.codeproject.com/dotnet/mergingassemblies.asp" target="_blank">"Merging .NET assemblies using ILMerge"</a> from <a href="http://www.codeproject.com/" _target="blank">CodeProject </a>. Hope it helps.Sebastianhttp://www.blogger.com/profile/16751123768960723440noreply@blogger.com0tag:blogger.com,1999:blog-2135686026984707540.post-36741465591516500822005-10-03T11:55:00.000-07:002008-08-23T15:28:47.858-07:002008-08-23T15:28:47.858-07:00Package Load Failure - VS 2005 Beta 2I am just a fan of custom installs. Every time I install something I choose custom to see what will be installed. <br />As you can see sometimes it's not a good idea. Since first time I have installed Visual Studio 2005 Beta 2 I had problem with test projects. When trying to add a new test project I kept getting this error message:<br /><br /><code>Package 'Microsoft.VisualStudio.QualityTools.TestCaseManagement.QualityToolsPackage, Microsoft.VisualStudio.QUalityTools.TestCaseManagement, Version=8.0.0.0, Culture=neutral, PublicKeyToken=v03f577f11d50a3a' has failed to load properly ( GUID = {A9405AE6-9AC6-4F0E-A03F-7AFE45F6FCB7} ). Please contact package vendor for assistance. Application restart is recommended, due to possible environment corruption. Would you like to disable loading this package in the future? You may use 'devenc /resetskippkgs' to re-enable package loading.</code><br /><br />It seems that Microsoft.VisualStudio.QualityTools.TestCaseManagement.QuailtyToolsPackage requires Team Foundation Client feature to work. It was one of that features I decided not to install since I didn't plan to use it.<br /><br />If you have other problems with Visual Studio 2005 Beta2 check out this page <a href="http://lab.msdn.microsoft.com/vs2005/get/vsbeta2installissues/default.aspx" target="_blank">Visual Studio 2005 Beta 2 Install Issues</a><br />Sebastianhttp://www.blogger.com/profile/16751123768960723440noreply@blogger.com0tag:blogger.com,1999:blog-2135686026984707540.post-28663390797805865432005-08-14T12:24:00.000-07:002008-08-25T09:13:14.224-07:002008-08-25T09:13:14.224-07:00101 Samples for Visual Studio 2005Microsoft has provided 101 samples for Visual Studio 2005 for download on MSDN website. Samples are avaible both in C# and VB.NET .<br />They have been written and tested with Beta 2 of Visual Studio 2005<br />Right now there are 4 main categories:<br /><ul><li>Base Class Libraries<br /></li><li>Data Access<br /></li><li>Web Development<br /></li><li>Windows Forms<br /></li></ul>plus the remaining 51 samples are coming soon.<br /><br /><a href="http://lab.msdn.microsoft.com/vs2005/downloads/101samples/default.aspx" target="_blank">http://lab.msdn.microsoft.com/vs2005/downloads/101samples/default.aspx</a>Sebastianhttp://www.blogger.com/profile/16751123768960723440noreply@blogger.com0tag:blogger.com,1999:blog-2135686026984707540.post-85064643719049370882005-08-14T12:11:00.000-07:002008-08-23T15:38:16.788-07:002008-08-23T15:38:16.788-07:00NUnit 2.2 and Visual Studio .NET 2005 beta 2If you get BadImageFormatException error or you want to work with NUnit 2.2 and VS .NET 2005 beta 2, you must add <br /><br /><code><supportedRuntime version="v2.0.50215" /></code><br /><br />to <code><startup></code> section<br /><br />so it looks like this:<br /><code><br /> <startup><br /> <supportedRuntime version="v2.0.50215" /><br /> <supportedRuntime version="v1.1.4322" /><br /> <supportedRuntime version="v1.0.3705" /><br /><br /> <requiredRuntime version="v1.0.3705" /><br /> </startup><br /></code><br />and remember that you have to change it both in the <br />nunit-gui.exe.config and nunit-console.exe.config files.<br /><br />v2.0.50215 is for beta 2 of VS 2005 .NET.<br /><br />Best thing to do is to check what version of .NET framework you're running. <br />To do it, see folder names in WindowsPathMicrosoft.NETFramework folder (for ex. C:WINDOWSMicrosoft.NETFramework)<br /><br />Plus it seems that NUnit 2.2 doesn't work when run as an external program while debugging from VS .NET 2005.<br />When you click Run nothing happens.<br /><br />Try to download NUnit 2.2.2, it worked for me.Sebastianhttp://www.blogger.com/profile/16751123768960723440noreply@blogger.com0tag:blogger.com,1999:blog-2135686026984707540.post-21580537532178762005-08-07T12:31:00.000-07:002008-08-23T15:28:46.413-07:002008-08-23T15:28:46.413-07:00Learn Visual Studio 2005 Express EditionThis video series is designed specifically for individuals who are interested in learning the basics of how to create applications using Visual Basic 2005 Express Edition and Visual C# 2005 Express Edition. This includes over 10 hours of video-based instruction that walks from creating your first "Hello World" application to a fully functioning RSS Reader application. Learn how to write your first application today!! <br /><br /><a href="http://lab.msdn.microsoft.com/express/beginner/default.aspx" target="_blank">Click here for the videos</a>Sebastianhttp://www.blogger.com/profile/16751123768960723440noreply@blogger.com0