Skip to content

MikeBevers.be

Putting it out there…

Archive

Category: Visual Studio

The problem

Recently we’ve changed the extension of the external url of our TFS server. Strange enough Visual Studio doesn’t provide an edit feature in the TFS servers window. Maybe that’s why it’s called “Add/Remove Team Foundation Server”.

The solution

I went looking where Visual Studio stored the TFS info. After a bit of searching in the Registry I ended up in: “CURRENT_USER\Software\Microsoft\VisualStudio\10.0\TeamFoundation\Instances”.

In the Instances folder you’ll see all your added TFS servers. You can start by changing the name of the folder, this text is used as the name label. What is important, is to change all the Uri entries you’ll find in the subfolders. There is one per TFS server and one for each collection!

Happy coding!

Source

I found a nice tutorial on Josip Medved’s blog. I’ve copied the article below for back-up purposes.

How to connect VS2008 with TFS 2010

Team Foundation Server 2010 works great when combined with Visual Studio 2010. However, if you wish to combine it with Visual Studio 2008, some additional setup is required.

First thing that you need to install is Team Explorer 2008. If you already used source control, you may have it. Easiest way to check is to go into Tools > Options and select Source Control. If there is “Visual Studio Team Foundation Server” in plug-in list, you can skip this download.

Another thing I installed was Visual Studio Team System 2008 Service Pack 1 Forward Compatibility Update for Team Foundation Server 2010. I do not think that this long-named update is really “must” but I decided to install it anyhow – just in case.

Once you install everything, you can try adding Team Foundation Server 2010 as destination, but you will be greeted with error “TF31002: Unable to connect to this Team Foundation Server …”. Reason behind this is that old Team Explorer 2008 does not know anything about collections.

Solution would be to add it as full path (e.g “http://server:8080/tfs/collection”). I could not do it because every time I entered full path, I also got error “TF30335: The server name cannot contain characters ‘/’ or ‘:’ …”. Since official way would not work it was time to come up with alternative.

In order to add TFS 2010 server, you will need to exit Visual Studio 2008 and go into Registry editor. Find key “HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\TeamFoundation\Servers” and at this location just add string value. Name of this value will be what Team Explorer 2008 will use for display. It’s value is full address of your server. It should be something like “http://server:8080/tfs/collection”.

Now you can go into Visual Studio 2008 and Team Explorer will have new entry. As you work with it, you will notice that not everything is “bump-free” (e.g. tasks). However, source control it self will work perfectly and that was enough for me.

Context

Before WCF, there was ASMX aka ASP.NET Web Services. Debugging ASMX or WCF are quite different. Let’s take a look how we can enable debugging in ASMX and WCF.

Basics of running a web application

When you hit the F5 button and your startup project is an ASP.NET, ASP.NET Web Services or WCF application, Visual Studio will start an ASP.NET Development Server. This is what we call Client-side hosting using Cassini. If want to know more check Dino Esposito’s article on MSDN. Wikipedia also has a description about UltiDev Cassini Web Server.

After Cassini is loaded, by default an Internet Explorer (IE) window will open and browse to the Cassini URL on your localhost.

Debugging ASMX

When you hit the F5 button, IE will open a webpage which looks like the image below:

Browse ASP.NET Web Service

Browse ASP.NET Web Service

You’ll notice that all Web Methods are listed as hyperlinks. So when I click “HelloWorld” in my example, it will browse forward:

Invoke ASP.NET Web Service

Invoke ASP.NET Web Service

Before we invoke the Web Method using IE, first we need to attach the Visual Studio instance with our sources to Cassini! In Visual Studio, navigate to “Debug” > “Attach to Process …”. In the list of Available Processes there should be a process called “WebDev.WebServer.exe” and the Title should be “ASP.NET Development Server – Port XXXX”. The Port XXXX is the port on which Cassini is active. Click the “Attach” button and you are ready to go!

Now, click the button “Invoke” in Internet Explorer and your Visual Studio will stop at the first breakpoint it encounters. When the method has returned its result, a new IE window will open and display the result as XML, like below:

ASP.NET Web Service Result

ASP.NET Web Service Result

 

Debugging WCF

Like ASMX, Visual Studio will open a browser by default:

Browse WCF Service

Browse WCF Service

At first it shows the directory listing. When you open your Service1.svc, you’ll notice that no hyperlinks or Invoke buttons are available on our Operation Contracts. To debug the WCF service, Microsoft provided a small tool in your Visual Studio installation directory, called “wcfTestClient.exe”. The tool is usually located in “C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\wcfTestClient.exe”. If not, you can download and install the Windows SDK from the Microsoft website.

In order to automatically start the “wcfTestClient.exe” and load our Services, we need to edit the WCF application project:

Start wcfTestClient.exe

Start wcfTestClient.exe

You can add multiple svc’s by leaving a space between the addresses.

When your WCF Service is loaded, you can double click an Operation Contract and invoke it. You don’t need to attach your Visual Studio to another process, it’s already attached for you.

wcfTestClient Method Invokation

wcfTestClient Method Invokation

Context

Every developer knows that managing your app.config or web.config isn’t an enjoyable task. When you’re moving your application from one environment to another, you will need to change some variables. Maybe you’re working with automatic builds, and so on.

Since Visual Studio 2010 you have a new feature: “Config transformations”. Because I’m still working with Visual Studio 2008, I can’t use it. That’s why I wrote my own config transformer.

continue reading…

The problem

Today I wrote some tests for a project I’m working on, which uses the FileHelpers library.

When I tried to run the tests, I received the following error:

Failed to queue test run ‘mbev@WSXP-BE-6833 2010-08-31 11:51:43′: Test Run deployment issue: The location of the file or directory ‘c:\pathToProject\business.tests\bin\debug\FileHelpers.dll’ is not trusted.

First thing that went through my mind was: “Man, I’m trying to introduce testing in this environment and then I get this. Why is everything working against me?!!”. Nevertheless, I put my personal issues aside and worked on resolving the problem.

In the past I’ve encountered a similar issue, but then I was working with network shares. Visual Studio has trust issues with other machines then your own. It that were the case, you can resolve it using CASPOL (Code Access Security Policy Tool). But I’m working on my own machine, on a local drive, my system drive!

The Solution

Suddenly, I remembered that Windows also has trust issues with external dll’s and exe’s. The solution is extremely simple! You can resolve it by clicking two buttons: Unblock and OK…

Restart Visual studio and you’re good to go!

Filehelpers Properties - Blocked

The Problem

The other day, I was working on update / patch / setup patterns and stuff, when I noticed in the Windows Registry that the InstallLocation of my installed application was empty. You can find info on installed applications in the Windows Registry by typing “regedit” in the Run command and browsing to: “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\”.

Apparently, it is a known bug. So, we’ll have to fix it ourselves!

continue reading…

The Problem

A few days ago, I was toying with WiX (Windows Installer XML). When working with WiX, you need Guids for your product ID, upgrade ID, installer ID, …

To compile my installer, I needed valid Guids. So instead of always going to the web and use a guid generator, I decided to create a Macro in Visual Studio (2008) and link it with a shortcut to my keyboard.

continue reading…

The Problem

Another user has locked a file for checkout, but is no longer available to check the file back in and now you need that file.

continue reading…

Region code snippet

To organize my code, I use a lot of regions to make it more readable. I love regions. Unfortunately, Visual Studio doesn’t provide a default code snippet to define regions. So I created one for myself. I’m publishing the code because I often change from PC or because of reinstalls etc. The internet is always (or most of the time) available, so I can easily download my snippet from here.

continue reading…

What is AL.exe?

AL.exe is the Assembly Linker. The Assembly Linker generates a file with an assembly manifest from one or more files that are either modules or resource files. A module is a Microsoft intermediate language (MSIL) file that does not have an assembly manifest.

continue reading…