BLOG | Resolve build error in Visual Studio 2010 (vb.net)

If you already have a .net project in Visual Studio, your next step is to build an executable file that can run individually with a double click. Normally, click Build->Build <your solution name>, and an updated .exe file will appear in your bin/Debug folder (destination can be changed in Build->Configuration Manager, however you want to move relative resources to the new folder, too). In this article, instead of discussing this regular way of finishing build, let’s talk about fixing errors during the build process.

When you couldn’t find an updated .exe file in your designated location, check if anything popped up in the error list or not. Normally, build will fail if something goes wrong, generates exceptions and halts the building process. Your error list will show messages like this:

In this case, clearly the error is from “imports <namespace>” because used classes are shown as “not defined”. If you have issues other than this one, feel free to leave and google. This article will only deal with this specific error.

First, go check if your target framework needs to be updated. Go to Project-><your solution name> Properties->Compile, and hit “Advanced Compile Option” at the bottom of the page. In pop up window, the last toggle list called “Target framework (all configurations):” will show the current framework version. Update your target framework and make it equal or higher to your required environment. You can simply update it to the latest version.

If changing target framework doesn’t work for you, try to check your 3rd party file linkage. If any link is broken or missing, Visual Studio will give vague error massages instead of telling you which link is broken. Go to Project-> <your solution name> Properties->References, and all your linkage is listed under “References:”. Check if any link says system could not find the file. If you find any, either remove them or replace them with a new link in your local. Normally, this will resolve the build error.

Notice that it is very important to always have a backup of the project that you are working on. If anything goes wrong, you can simply go back to your last executable version and copy all the settings from there.

Leave a comment