Some notes on software development... RSS 2.0
# Thursday, 21 May 2009

The Pre and Post build events in Visual Studio 2008 run as a batch file so you can check the ConfigurationName variable to only do things for Release mode.
For example, to copy the built files in Release mode to C:\Temp

if $(ConfigurationName) == Release copy $(TargetPath) "C:\Temp"

From StackOverflow

Thursday, 21 May 2009 09:25:53 (GMT Standard Time, UTC+00:00)  #    -
Visual Studio
# Wednesday, 22 April 2009

Because I keep forgetting the syntax…


Wednesday, 22 April 2009 22:59:53 (GMT Standard Time, UTC+00:00)  #    -
SQL Server
# Thursday, 05 March 2009

This is old news but something I had to use recently....
Add a .cs file to your project, any filename is fine but I called mine ExtensionAttribute.cs.
Add the following code...


Wherever you declare your extension methods you need to include 'using System.Runtime.CompilerServices' to the top.

Note:- You must be using Visual Studio 2008 for this to work.

The Moth - Using Extension Methods in Fx 2.0 Projects
CodeThinked - Using Extension Methods in .net 2.0

Thursday, 05 March 2009 10:12:41 (GMT Standard Time, UTC+00:00)  #    -
# Wednesday, 18 February 2009

I had an issue with a compact framework project where I needed to add a shortcut on the desktop that pointed to my application whose location was \Program Files\MyApplication\.
You need to create a .lnk text file and place it on the device's desktop. However, .lnk files are a bit tricky to use with Visual Studio 2008 because it thinks it is an actual shortcut to a file on your actual desktop machine.

Mike Hall has a blog article that further covers Windows CE shortcuts.

Here are my steps on how to overcome the .lnk issue when using a Smart Device CAB project from within Visual Studio 2008.

My application is called MyApplication.exe and it's full path, once installed on Windows CE, is \Program Files\MyApplication\MyApplication.exe
All my application does is show 'Hello World' in a label on the form.
My Windows CE installer project is called MyWindowsCEInstaller.

First I create the application and installer projects and added the project output of MyApplication to the MyWindowsCEInstaller project. Here is what my solution looks like so far:


Next step is to create the shortcut file that will eventually be placed on the device desktop. To do this I created a new text file within the MyApplication project called MyApplication.lnkx
It's 'Build Action' property should be set to None and 'Copy to Output Directory' property set to Do Not Copy.
It is a lot easier to work with the file having the extension as .lnkx so that Windows doesn't think it is an actual shortcut file.

The MyApplication.lnkx file will contain the command line text and the command line character count separated by a hash (#).
So my Windows CE application full path is \Program Files\MyApplication\MyApplication.exe making the character count 48, below is my MyApplication.lnkx file:


Note:- If the path contains a space it must be enclosed in quotes and they get included in the command character count!!!

Next step is to add our MyApplication.lnkx file to the correct folder in the MyWindowsCEInstaller project.

From the root of the Primary Output File System view of the MyWindowsCEInstaller project add the Windows Special Folder.
Under the Windows folder create a new folder called Desktop

Add the MyApplication.lnkx file to the newly created Desktop folder.


Next, select the MyApplication.lnkx file from the MyWindowsCEInstaller project and change the TargetName to be MyApplication.lnk
This will change the extension off the shortcut file on the target device to be .lnk while on the development machine it will stay as .lnkx

The final files should look like this:

image image

Build the solution, copy the CAB file to the device, install it and now there should be desktop shortcut that points to the MyApplication application ;-)

image image

Note that the shortcut will also use the application icon as it's image once this has been set in the application properties, here it is the default image.

Mike Hall Windows CE Shortcuts Blog Article

Wednesday, 18 February 2009 17:31:35 (GMT Standard Time, UTC+00:00)  #    -
CF | CE Devices

Sign In
Total Posts: 116
This Year: 0
This Month: 0
This Week: 0
Comments: 36
About the author/Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2019
Hadrian Phillips

All Content © 2019, Hadrian Phillips
DasBlog theme 'Business' created by Christoph De Baene (delarou)