In C++ and in PHP and other languages, a great logging feature is the ability to log the file and line number where the log occurs.
These unfortunately do not exist. I have been searching even in the latest .NET 4.0 and haven’t found them. If they are there, they are hidden. Having these two variables is an extremely useful feature in other languages and it appears to be a feature very overlooked by the C# developers. However, maybe they didn’t overlook it. Maybe there is a good reason that it is not there.
Getting __LINE__ and __FILE__ in C# when in debugging mode
There were a couple of solutions floating around online but many of them only worked with debugging enabled (or in release if the pdb file is in the same directory).
Here is one example that only works in debugging (or in release if the pdb file is in the same directory).
StackHelper.cs
using System;
using System.Diagnostics;
namespace FileAndLineNumberInCSharpLog
{
public static class StackHelper
{
public static String ReportError(string Message)
{
// Get the frame one step up the call tree
StackFrame CallStack = new StackFrame(1, true);
// These will now show the file and line number of the ReportError
string SourceFile = CallStack.GetFileName();
int SourceLine = CallStack.GetFileLineNumber();
return "Error: " + Message + "\nFile: " + SourceFile + "\nLine: " + SourceLine.ToString();
}
public static int __LINE__
{
get
{
StackFrame CallStack = new StackFrame(1, true);
int line = new int();
line += CallStack.GetFileLineNumber();
return line;
}
}
public static string __FILE__
{
get
{
StackFrame CallStack = new StackFrame(1, true);
string temp = CallStack.GetFileName();
String file = String.Copy(String.IsNullOrEmpty(temp)?"":temp);
return String.IsNullOrEmpty(file) ? "": file;
}
}
}
}
Here is a little Program.cs that shows how to use it.
using System;
namespace FileAndLineNumberInCSharpLog
{
class Program
{
static void Main(string[] args)
{
int x = 100;
int y = 200;
int z = x * y;
Console.WriteLine(StackHelper.ReportError("New Error"));
}
}
}
Unfortunately if the above does only work in release if the pdb file is available.
Getting __LINE__ and __FILE__ in C# when in debugging mode
Well, according to this MSDN forum post, it simply cannot be done.
http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/6a7b021c-ec81-47c5-8f6a-2e280d548f3f
If I ever find a way to do it, I will post it.
So for troubleshooting a production file at a customer’s site, you pretty much have to send out your pdb file to them when they need it. There are a lot of benefits to C# and this lacking feature is one of the eye sores.
I am looking for a Graphical Newtork Configuration tool for FreeBSD. However, my attempts to find one are unsuccessful.
KDE’s “Network Settings” tool
So, KDE on FreeBSD has a network configuration tool. However, it doesn’t appear to work. PC-BSD has a working network management tool, that looks different.
I don’t have PC-BSD installed, but instead my own desktop build on FreeBSD, so I dont’ have a PC-BSD screen shot, but here is the screen shot from KDE’s regular Network Settings.
It flashes a little box that says, detecting platform and then the screen is empty of network cards.
I am on FreeBSD 8.1 64 bit.
I have these ports installed:
[jared@slc-jab ~]$ pkg_info |grep kde
akonadi-1.4.0_1 Storage server for kdepim
kde4-4.5.2 The “meta-port” for KDE
kde4-icons-oxygen-4.5.2 The Oxygen icon theme for KDE
kde4-shared-mime-info-1.0 Handles shared MIME database under ${KDE_PREFIX}
kde4-xdg-env-1.0 Script which hooks into startkde and helps KDE pick up XDG
kdeaccessibility-4.5.2 Accessibility applications for KDE4
kdeadmin-4.5.2 KDE Admin applications
kdeartwork-4.5.2 KDE Artworks Themes
kdebase-4.5.2 Basic applications for the KDE system
kdebase-runtime-4.5.2 Basic applications for the KDE system
kdebase-workspace-4.5.2 Basic applications for the KDE system
kdebindings-smoke-4.5.2 SMOKE bindings for Qt/KDE
kdeedu-4.5.2 Collection of entertaining, educational programs for KDE
kdegames-4.5.2 Games for the KDE integrated X11 desktop
kdegraphics-4.5.2 Graphics utilities for the KDE4 integrated X11 desktop
kdehier4-1.0.6 Utility port that creates hierarchy of shared KDE4 director
kdelibs-4.5.2 Base set of libraries needed by KDE programs
kdemultimedia-4.5.2 KDE Multimedia applications
kdenetwork-4.5.2 KDE Network applications
kdepim-4.4.6 Libraries for KDE-PIM applications
kdepim-runtime-4.4.6 Libraries for KDE-PIM applications
kdepimlibs-4.5.2 Libraries for KDE-PIM applications
kdeplasma-addons-4.5.2 Extra plasmoids for KDE4
kdesdk-4.5.2 KDE Software Development Kit
kdetoys-4.5.2 Collection of entertaining programs for KDE
kdeutils-4.5.2 Utilities for the KDE4 integrated X11 Desktop
kdeutils-printer-applet-4.5.2 Printer system tray utility for KDE4
kdevelop-4.0.0 Opensource IDE based on KDevPlatform, KDE and Qt libraries
kdevelop-php-1.0.0 PHP support for KDevelop
kdevelop-php-docs-1.0.0 PHP documentation for KDevelop
kdevplatform-1.0.0 KDE development platform
kdewebdev-4.5.2 Comprehensive html/website development environment
py26-kdebindings-kde-4.5.2 Python bindings for KDE
py26-kdebindings-pykdeuic4-4.5.2 An enhanced version of pyuic4
ruby18-kdebindings-4.5.2 Ruby bindings for Qt/KDE
system-config-printer-kde-4.5.2 KDE4 frontend for system-config-printer
So there according to the README in subversion for KDE’s network settings, this is supposed to work on FreeBSD. Maybe it doesn’t actually work. I can configure my network from the command line, so it doesn’t affect me, it just affects me trying to get new users who don’t know how to configure the network from the command line.
Looks like no one has maintained this feature on the FreeBSD platform and it is not working.
PC-BSD’s “System Network Configuration” tool
PC-BSD has their Network Management tool available as a port it appears. /usr/ports/net/pcbsd-netmanager
However, when I installed it on FreeBSD, it didn’t really work either. Again, I am not on PC-BSD, just my own Xorg and KDE build on FreeBSD. It did work on PC-BSD when I was testing PC-BSD.
When I installed it to FreeBSD, it added a different network configuration option to the KDE System Settings called “System Network Configuration” which is different than the default one called “Network Settings”.
I sort of wish that instead of writing a new tool, the PC-BSD team had just worked with KDE to make the regular one work, but maybe there is a reason I am not aware of that made this a necessity. Anyway, that is besides the point, the GUI network configuration tool from PC-BSD didn’t work when installed to FreeBSD either.
It shows the network devices, physical, wireless, and virtual, but while it displays them, right-clicking and choosing the Configure option does absolutely nothing.
Any one know if GNOME has a GUI Network Configuration?
I didn’t check out GNOME’s options. I don’t have GNOME installed and installing it is a bigger chore than I was planning on trying for finding a GUI network configuration tool
Conclusion
If you are running PC-BSD, the graphical System Network Configuration tool works.
If you are running FreeBSD, you may be out of luck using your own network configuration tool.
Options
The options seem to be these.
We can contact the folks at PC-BSD and the folks at KDE and see if either have plans to make their tool work.
We could step in and help either PC-BSD or KDE and fixing this ourselves and contributing our code.
Write our own tool.
I like option 1 or 2. I guess I will contact PC-BSD and see what I can do to help.
Ok, so many of you have reverted to a snapshot of a virtual machine that is a member of an Active Directory domain only to see the error message saying something like this:
In XP:
“Windows cannot connect to the domain, either because the domain controller is down or otherwise unavailable, or because your computer account was not found. Please try again later. If this message continues to appear, contact your system administrator for assistance.”
In Windows 7:
“The trust relationship between this workstation and the primary domain failed.”
This happens whether you are using VMWare or VirtualBox. It also happened back when we were re-imaging to “revert” our drives.
This is caused because the Machine creates an account on the Domain. It actually maintains its own password and updates its own password every 30 days. So as soon as the Machine account’s password is updated, you are going to be in this state.
“Increase the computer account password age, or disable password changes altogether. Both these can reduce likelihood of the problem, but may reduce the level of security in the domain. On the other side, since this is probably a test, a QA or a demo environment, you may consider it as a valid option . These settings are available on the domain member (and not on the domain controller), and as such, you can change them on your computer before you create a snapshot out of it.”
While he mentions that it can be done, he doesn’t mention how to do it. There is a Microsoft Knowledge-base article about this. This is a WIndows 2000 article, but I will have to verify that it works in later versions. How to disable automatic machine account password changes
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters]
"RefusePasswordChange"=dword:00000001
So I am going to try the first one, as it doesn’t require a global setting on the domain. Lets see if it really works.
Update
I put the first registry key on all my VMs back when this was posted, which looks like October 22, 2010. I haven’t had the problem since, so I would say this solution works.
I don’t know if the second key that goes on a Domain Controller works. Maybe some one can try it out for me.
Ok, so it is one thing to have Xorg just autodetect settings, it is another to install and take advantage of a powerful NVIDIA driver and all its features.
To install the NVIDIA driver on FreeBSD 8.1, do the following.
This needs to be done as root, so su to root.
Install the NVIDIA driver. (Obviously only do this if your video card is NVIDIA)
#
#
cd /usr/ports/x11/nvidia-driver
make install
Note: You will be prompted for the build configuration. Check the ACPI box because I suspect ACPI is needed if you want to sleep and resume. If you have Linux compatibility enabled or plan to use it later, leave that checked, otherwise uncheck it and hit ok.
Edit the /boot/loader.conf file.
#
ee /boot/loader.conf
Add the following line to configure the NVIDIA module to load at startup.
nvidia_load=”YES”
Install the NVIDIA configuration tool.
#
#
cd /usr/ports/x11/nvidia-xconfig
make install
Use Xorg to create an xorg.conf. The following command creates and xorg.conf.new in /root. This might detect the NVIDIA driver, or not. Whether it detects it or not if may not make all the desired settings. The nvidia-xconfig tool will make the xorg.conf file settings work more accurately for the NVIDIA driver.
#
Xorg -configure
Copy the file to the appropriate location
#
cp /root/xorg.conf.new /etc/X11/xorg.conf
Run nvidia-xconfig
#
nvidia-xconfig
Edit the /etc/X11/xorg.conf.
#
ee /etc/X11/xorg.conf
Add this line in the driver section or “Section Device” to enable transparancy.
Option Overlay
Ok, you should have your NVIDIA card working. There are probably many more tweaks you could make. If you know of any other options that your would recommend, please comment and let my readers and I know.
Ok, so if you are going to have a string visible in your WPF application and your application can be in multiple languages, you are facing the localization problem.
Usually people as themselves two questions:
Do I localize or not?
How do I localize?
The answers are usually not now and I don’t know. So no localization work is done at first. Later, you wish you were more prepared for localization.
Well, I am here to tell you that you can at least prepare to be localized by doing a few simple steps:
Centralize your strings in a publicized Resources.resx file.
Add a reference to your Properties.
Replacing any statically entered text with the name of the string resource.
Do you best to use dynamic sizing.
Preparing your strings for localization
If you are going to have a string in your WPF application, it is a good idea to store those strings in a centralized place for localization purposes. Usually in Visual Studio, that is in Resources.resx.
Cialis is an additional impotence problems treatment, http://www.horizonhealthcareinc.com/ which is gaining interest at a faster pace. The reason for more popular at a faster pace is because of its effectiveness.
Often a string is entered directly into an the WPF XAML. This is not recommended. Maybe you are thinking that you don’t need to localize your application, so this is not important to you. Ok, really what you are thinking is:
“I don’t know how to do it and if I ever get big enough to need localization, at that point, I will figure it out.”
Well, what if I told you that using Resources.resx is extremely easy?
What if I told you that it hardly takes more time at all?
If it easy and hardly time consuming at all, you would do it, right? I would. Hence this post.
Step by step guide for Preparing your strings for locaization
I have a project called LicenseAgreementManager. Right now this only needs to display a license agreement in English, but maybe someday, this will need to display a license agreement in any language.
Preparation – Create a new project or use an existing project
In Visual Studio, create a new WPF Applcation project.
I named my project LicenseAgreementManager.
Right away, you already have at least one string statically entered into your XAML, the text for the window title.
Step 1 – Add all your strings to the Resources.resx file
Double-click on Resources.resx in your WPF Project. This found under the ProjectName | Properties option in your Solution Explorer tree.
Change the Access Modifier drop down menu from Internal to Public.
Enter your strings in the Resources.resx by giving them a unique name and a value of the desired string. A comment is also optional.
You now have a publicized Resource.resx file and a few strings inside it.
Step 2 – Add a reference to your Properties
In your project, open your MainWindow.xaml file.The XAML looks as follows:
What changes did I make above that I couldn’t do through the Visual Studio GUI?
I removed Height and size from almost every element.
I added SizeToContent=”WidthAndHeight” to the Windows element.
I added some extra size to the margins.
Conclusion
You don’t have to be localized to be prepared for easy localization. By doing the above simple steps, when it comes time to add localization, you will be ready.
If you want to go on an finish localization. You might want to read some of my sources.
Copyright ® Rhyous.com – Linking to this article is allowed without permission and as many as ten lines of this article can be used along with this link. Any other use of this article is allowed only by permission of Rhyous.com.
I don’t know about you but I switch between FreeBSD and Windows a lot. So it drives me crazy when I type the command ls on windows and get the error message.
C:\Windows\system32>ls
‘ls’ is not recognized as an internal or external command,
operable program or batch file.
So I want this to go away.
I looked for the alias command in Windows and couldn’t find one. So I made a batch file that solves this.
Windows doesn’t seem to have the equivalent of a .shrc or .cshrc or .bashrc. I couldn’t find a .profile either. So I decided to go with the batch file route.
Option 1 – Using doskey
I was tipped off to this idea from a comment, which led my mind to the Command Prompt autorun registry I already knew about. But once I wrote the batch file, the parameters were not working, so I searched around and found an example of exactly what I wanted to do here: http://bork.hampshire.edu/~alan/code/UnixInWin2K/
Create a batch file called autorun.bat and put it in your home directory:
My home dir is: c:\users\jared
Add the following key to the registry:
Key: HKEY_CURRENT_USER\Software\Microsoft\Command Processor
REG_SZ (String): Autorun
Value: %USERPROFILE%\autorun.batOr as a .reg file:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
"Autorun"="%USERPROFILE%\\autorun.bat"
Now whenever you open a command prompt, the aliases will be there.
Option 2 – Creating a batch file as an alias
I created an.bat file that just forwards calls the original file and forwards all parameters passed when making the call.
Here is how it works.
Create a file called ls.bat. Add the following text.
ls.bat
@ECHO OFF
dir $*
Copy this batch file to your C:\Windows\System32 directory. Now you can type in ls on a windows box at the command prompt and it works.
How does this work to make your aliased command?
Name the batch file the name of the alias. I want to alias ls to dir, so my batch file is named ls.bat.
In the batch file, set the RealCMDPath variable to the proper value, in my case it is dir.
So if you want to alias cp to copy, you do this:
Copy the file and name it cp.bat.
Edit the file and set this line:
SET RealCMDPath=dir
Now you have an alias for both ls and cp.
Using different versions of msbuild.exe
You can also use this so you don’t have to add a path.
I need to use C:\Windows\Microsoft.NET\Framework\v3.5\msbuild.exe but sometimes I want to use C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe. Both files are named the same. So I can easily use my alias command.
Create two files in C:\Windows\System32: one named msbuild35.bat and one named msbuild40.bat.
Change the line in each file to have the appropriate paths for the RealCMDPath.
In this example we are going to create a simple MSI that deploys a two files. This is not that much different than one file, but there is an implementation decision you have to make here that is important to understand.
This also assumes that you have also installed the WIX 3.5 add-ons. If not, download the latest 3.5 or 3.6 build and install both ProjectAggregator2.msi and Wix35.msi: http://wix.sourceforge.net/releases/
Step 1 – Create a WIX project in Visual Studio
Creating a new project is a very simple task once you have done it a few times. However, I try to make my walk-thrus newbie proof, so even some one who has never done this feels comfortable. So if you need help with this step, use my instructions below. If you don’t, skip them.
Open Visual Studio if it is not already open.
Got to File | New | Project.
You should have an option under Installed Templates for Windows Install XML. Select it.
Now you should see the option for Setup Project. Select it.
Enter a Name for the project. I called the project I made for this walk-thru MultiFileProject.
Change the directory to store the project if you want. It doesn’t matter what directory you choose, but it is nice to keep your learning projects organized.
Click OK.
Your project should now be created. In solution explorer you should now have a solution, a project, a reference and the Product.wxs. See the image below.
Ok, I hope that was easy for you. Lets move on.
Step 2 – Add two files to the project
These steps are preformed in Visual Studio on the project you just created in the above step.
Right-click on the project name, MultiFileProject, and from the drop down, choose Add | New Item.
Select Text File.
Name it whatever you want. I used the default value, TextFile1.txt for this example.
Click Add.
Repeat the steps above to create a second file. My second file is TextFile2.txt.
Your files are now added to the Visual Studio project. However, they are not automatically added into the Product.wxs as a file to be installed. This is done manually in the next step.
Step 3 – Take a moment to learn
We are going to change the Product.wxs file to include the file we just created.
The Product.wxs file has the following XML text in it. Take a moment to look at the XML nodes and their elements so are familiar with the syntax it is using.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="9a19f6ed-a7b2-4cfc-a429-7069066fbf2a" Name="MultiFileProject" Language="1033" Version="1.0.0.0" Manufacturer="MultiFileProject" UpgradeCode="c1bdcc4d-b249-4b36-97fd-32609a60f8b4">
<Package InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLLOCATION" Name="MultiFileProject">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<!-- <Component Id="ProductComponent" Guid="6263db4e-4c67-4adc-9ef1-e1caef798331"> -->
<!-- TODO: Insert files, registry keys, and other resources here. -->
<!-- </Component> -->
</Directory>
</Directory>
</Directory>
<Feature Id="ProductFeature" Title="MultiFileProject" Level="1">
<!-- TODO: Remove the comments around this ComponentRef element and the Component above in order to add resources to this installer. -->
<!-- <ComponentRef Id="ProductComponent" /> -->
<!-- Note: The following ComponentGroupRef is required to pull in generated authoring from project references. -->
<ComponentGroupRef Id="Product.Generated" />
</Feature>
</Product>
</Wix>
The text of the Xml gives us hints as to what we are supposed to do in its comments. Take a moment and read the comments.
Step 4 – Configure the WIX Xml file to deploy that file
Lets start editing that XML file.
Note: I am going to use the term “node’ to indicate and XML section. So and everything it contains is a node. If a node is inside it, I might call it a subnode.
Uncomment the Component node the Directory nodes.
Remove the two TODO: comments.
Uncomment the ComponentRef node that is inside the Feature node.
Remove the TODO: comment and the Note comment.
Inside the Component node, at two File nodes for each of your two files as follows:
Well, there really isn’t much to debug, so we are only going to build a release version here.
In the Visual Studio 2010 tool bar, there should be a drop down box that either says Debug or Release. Change it to Release if it is not already at Release.
Select Build | Build Solution or use the shortcut key.
You should now have an MSI built in the project’s bin\release directory.
Step 5 – Test the MSI
Let’s go get the MSI and test it.
Right-click on the project, MultiFileProject, and choose, Open Folder in Windows Explorer.
In Explorer, navigate into the bin\release directory.
You will see two files: MultiFileProject.msi – This is the MSI and is all you need. MultiFileProject.wixpdb – This is a file for debugging only. You may never use it unless you need to debug.
You may or may not want to test the MSI on you development box. If you do, just double-click the MSI. Otherwise, copy it to a test box and run the MSI there.
Verify that the file installed.
Note: If on a 64 bit system, it will by default install as an x86 app, so look in c:\program files (x86)\ for a folder called MultiFileProject.
Check Add / Remove Programs to make sure the install shows up there and that the uninstall works.
Congratulations. You just use WIX to create an MSI that deploys multiple files.
Windows Install XML (WIX) is a nice simple way to create an MSI installation file. Some of the items it automatically handles, such as registering with Add / Remove Programs, are very nice features.
In this example we are going to create a simple MSI that deploys a single file.
This also assumes that you have also installed the WIX 3.5 add-ons. If not, download the latest 3.5 or 3.6 build and install both ProjectAggregator2.msi and Wix35.msi: http://wix.sourceforge.net/releases/
Step 1 – Create a WIX project in Visual Studio
Creating a new project is a very simple task once you have done it a few times. However, I try to make my walk-thrus newbie proof, so even some one who has never done this feels comfortable. So if you need help with this step, use my instructions below. If you don’t, skip them.
Open Visual Studio if it is not already open.
Got to File | New | Project.
You should have an option under Installed Templates for Windows Install XML. Select it.
Now you should see the option for Setup Project. Select it.
Enter a Name for the project. I called the project I made for this walk-thru DeployOneFile.
Change the directory to store the project if you want. It doesn’t matter what directory you choose, but it is nice to keep your learning projects organized.
Click OK.
Your project should now be created. In solution explorer you should now have a solution, a project, a reference and the Product.wxs. See the image below.
Ok, I hope that was easy for you. Let move on.
Step 2 – Add a file to the project
These steps are preformed in Visual Studio on the project you just created in the above step.
Right-click on the project name, DeployOneFile, and from the drop down, choose Add | New Item.
Select Text File.
Name it whatever you want. I used Install.conf for this example.
Click Add.
Your file is now added to the Visual Studio project. However, it is not automatically added into the Product.wxs as a file to be installed. This is done manually in the next step.
Step 3 – Take a moment to learn
We are going to change the Product.wxs file to include the file we just created.
The Product.wxs file has the following XML text in it. Take a moment to look at the XML nodes and their elements so are familiar with the syntax it is using.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="fae97512-4eca-4271-821d-75b7a8861557" Name="DeployOneFile" Language="1033" Version="1.0.0.0" Manufacturer="DeployOneFile" UpgradeCode="fec17f7b-060e-466f-8bd2-7895eb2b92ce">
<Package InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLLOCATION" Name="DeployOneFile">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<!-- <Component Id="ProductComponent" Guid="927a42ea-a6df-45f6-ac52-4b979194bc10"> -->
<!-- TODO: Insert files, registry keys, and other resources here. -->
<!-- </Component> -->
</Directory>
</Directory>
</Directory>
<Feature Id="ProductFeature" Title="DeployOneFile" Level="1">
<!-- TODO: Remove the comments around this ComponentRef element and the Component above in order to add resources to this installer. -->
<!-- <ComponentRef Id="ProductComponent" /> -->
<!-- Note: The following ComponentGroupRef is required to pull in generated authoring from project references. -->
<ComponentGroupRef Id="Product.Generated" />
</Feature>
</Product>
</Wix>
The text of the Xml gives us hints as to what we are supposed to do in its comments. Take a moment and read the comments.
Step 4 – Configure the WIX Xml file to deploy that file
Lets start editing that XML file.
Note: I am going to use the term “node’ to indicate and XML section. So and everything it contains is a node. If a node is inside it, I might call it a subnode.
Uncomment the Component node the Directory nodes.
Remove the two TODO: comments.
Uncomment the ComponentRef node that is inside the Feature node.
Remove the TODO: comment and the Note comment.
Inside the Component node, at a File node as follows:
Well, there really isn’t much to debug, so we are only going to build a release version here.
In the Visual Studio 2010 tool bar, there should be a drop down box that either says Debug or Release. Change it to Release if it is not already at Release.
Select Build | Build Solution or use the shortcut key.
You should now have an MSI built in the project’s bin\release directory.
Step 5 – Test the MSI
Let’s go get the MSI and test it.
Right-click on the project, DeployOneFile, and choose, Open Folder in Windows Explorer.
In Explorer, navigate into the bin\release directory.
You will see two files: DeployOneFile.msi – This is the MSI and is all you need. DeployOneFile.wixpdb – This is a file for debugging only. You may never use it unless you need to debug.
You may or may not want to test the MSI on you development box. If you do, just double-click the MSI. Otherwise, copy it to a test box and run the MSI there.
Verify that the file installed.
Note: If on a 64 bit system, it will by default install as an x86 app, so look in c:\program files (x86)\ for a folder called DeployOneFile.
Check Add / Remove Programs to make sure the install shows up there and that the uninstall works.
Congratulations. You just use WIX to create and deploy your first MSI.
Bonus Information – Learning about Repair
Repairing an installation is an important feature of to understand.
What you are going to learn here, is that if you delete a file in a component that has the KeyPath=’yes’ tag, the component will reinstall.
Make sure the MSI you just created above is installed. If you uninstalled it doing steps above, reinstall it.
On the machine where you installed the MSI, Browse to the installation directory.My directory is here.
C:\Program Files (x86)\DeployOneFile
The only file in that directory is the file you installed:
Install.conf
Delete the Install.conf file.
Still on the machine where you installed the MSI, go to Add / Remove Programs.
Right-click on the DeployOneFile instance and choose Repair.
The file you deleted should be restored.
Ok, so you probably have questions about repair. This was just a basic introduction. Hopefully we will learn more about repair as we go on.
So, I am trying to run Unit tests in Visual Studio 2010. However, it isn’t working.
I am getting this message in the status bar.
The key combination (Ctrl + R, Ctrl + C) is bound to command (DebugTestsInClass) which is currently not available.
I do have Visual Studio 2010 Ultimate so I expected everything to be available.
I did a Google and Bing and MSDN search for “DebugTestsInClass” and got a big fat nothing, which is pretty difficult to do these days. (Of course, that won’t happen for the next guy now that I have made this post!)
Anybody know what the DebugTestsInClass is and how to make it available?
Cause
Ok, so I found the issue. My test project was created a long time ago in Visual Studio 2008 and using MBUnit.
I had changed the test to use no longer use MBUnit, but to use Microsoft.VisualStudio.QualityTools.UnitTestFramework.
I had create a new test project by click Test | New Test.
Then migrate my test classes to the new project.
I was unaware that the test project must be .NET 4, but yes it does. Creating a new Test project allows me to use my Ctrl + R, Ctrl + C functionality.
At first, I thought that using .NET 4 might be a problem because everything else we are doing is currently in .NET 3.5. However, even though we are developing in .NET 3.5 currently, our test projects can be .NET 4 as they only run on dev and build machines.
Resolution
So it looks like multiple steps were required to move my test project from one testing library to another.
Create a new Test project by going to Test | New Test.
Move the classes to the new test project.
Change the class syntax to match the syntax specified by Microsoft.VisualStudio.QualityTools.UnitTestFramework.
The Utah Open Source Conference 2010 was pretty fun. It was really my first open source conference. Yes, I have been into open source for 10 years, specifically FreeBSD, but somehow I haven’t really attended the conferences.
I will probably attend conferences more often.
What was there about FreeBSD?
PC-BSD and the folks as iXSystems sent me with some swag. Howard Logsdon helped me man the GUBUG booth.
So Novell SUSE brought some nice laptop bags, and they were pretty good. I have a nice Ogio laptop back pack, so I am giving this laptop bag to my wife. It is just big enough to fit her 17″ HP laptop.
There was Fedora, Ubuntu, KDE, and GNOME. There was a boot on XDMC and MythTV.
There was a very cool company there called Fusion-IO. They have an awesome hard drive, though they are not cheap. 7k for the cheapest drive. But for some companies, it would be worth it. When is the next Conference?
You can go here to see upcoming events: http://www.freebsd.org/events/events.html
Ok, so because my work has given me a license to VMWare Workstation, I have never really gone to the trouble of using VirtualBox.
But I really want to move to use FreeBSD (well, PC-BSD) on my laptop but I have to have a Windows 7 box for work.
So I had Windows 7 with PC-BSD in a VMWare Virtual Machine.
However, I am switching that as we speak.
I now have PC-BSD installed as my primary operating system, and Windows 7 in a VirtualBox Virtual Machine.
There are some features we use at LANDesk a lot, such as many snapshots, and PXE booting, and more. I will test and follow-up on whether this is a good solution for me.
I decided to try a post using Blogio. Supposedly it is a nice tool where I can write my blogs offline, save them locally, and post them when I can.
So lets see how some of the features work.
This is a heading 1
However, after creating heading 1 and then hitting enter, it did not make the next line’s type to Paragraph. I changed it to paragraph and it was still wrong. I had to click Html editor and then click back to the visual editor to make this work.
This is a heading 2
Same problem with heading 2.
Here is a quote
Ending quote was easy. Just hit the quote button again with the mouse.
This is a numbered
list of items
And we will see if it works.
The font size works, except not for headings.
Well, I am going to be using SilverStripe in a few months. I wonder if it will integrate with that.
Update: There was an issue where when I published this, it didn’t show up right away and said it “missed schedule” whatever that means. I updated it and now shows up.
The article is titled Unix’s Revenge and it was quite a good read.
Here is a quote:
Now we’ve entered a new decade of devices where Unix(-like) operating systems will, on a CPU basis, probably out-install Windows. Not only is iOS based on Unix, but Android and MeeGo and even Bada are based on Linux as are QNX and WebOS. Google, Apple, HP, RIM, Samsung and Nokia are all now betting heavily on Unix or Unix-like implementations. The success is so overwhelming that there are really only two hold-outs: Microsoft and the rapidly depreciating Symbian.