Microsoft Visual Studio solution folder structure for easy conversion to the new version of the IDE

Microsoft releases a new version of  Visual Studio every 2-3 years, but most of the enterprise applications have to be operational for years. Many companies developed applications in earlier versions of Microsoft Visual Studio ( VS 2003, VS 2005, VS 2008, VS 2010, or VS 2012 ) and the developers would like to use the new features of the VS 2013 development environment and the .NET 4.5 or higher Framework, but the conversion looks very hard and time consuming. If the application’s lifespan is long, the projects and solutions could be converted multiple times, so it makes sense to prepare your applications for the easiest  migration as soon as possible. Preferably set up all projects and solutions during the initial development phase, so later the conversion will be easy and straightforward.

You can set up your new applications and modify the structure of existing projects and solutions for easy conversion, so when the time comes it will be easy to convert them to the new version of Microsoft Visual Studio.

For console applications and Windows services we will create the following folder structure.

visual studio folder structure console app no middletier

If you need to add a middle tier project to the application to handle the business rules follow the structure below:

visual studio folder structure console app with middletier

For web applications and web services we will leave the project file in the web application folder, so the folder structure will look like this:

visual studio folder structure web app no middletier

If you need to add a middle tier project to the web application for the business rules:

visual studio folder structure web app with middletier

In the first example we will prepare the My Console App console application for the conversion.

The files of the My Console App solution are distributed the following way:

  • The top level “MyConsoleApp” solution level folder contains sub folders for the solution file, and the project files,
    visual studio folder structure console app top level no middletier

 

  • The “Project_2012″ folder only contains the”Config” and  “Properties” folders, the App.config file and the project file

visual studio folder structure console app project folder

The “Source” folder will contain all the source files.

visual studio convert to 2012 source folder content2

Create the folder structure in Windows Explorer and in Microsoft Visual Studio 2012 move all source files to the “Source” folder, so multiple projects can reference them:

  • Open the VS 2012 solution in Microsoft Visual Studio 2012
  • Right click a source file in the solution explorer and select “Remove”
  • In TFS (Team Foundation Server) move the just removed source file from the project folder to the “Source” folder. (If you don’t use TFS or any other source control system use Windows Explorer to move the file.)
  • Important: In the Solution Explorer select the project and above the name of the solution click the “Refresh” button, otherwise Visual Studio 2012 will not let you add the file back to the project from the “Source” folder.

visual studio convert to 2012 project refresh

 

  • Right click the ArchiveCreator project and select “Add”, “Existing Item…”

visual studio convert to 2012 project add exsiting

 

  • Select the source file in the “Source” folder, click the down arrow on the “Add” button and select “Add As Link”. This way the file is not going to be copied back to the project folder, it will stay in the “Source” folder.

visual studio convert to 2012 project add as link

 

  • Repeat the steps above to move all your source files to the “Source” folder and add them to the project as link. A small arrow indicates the the file is added to the project as a link, so multiple projects can reference it.

visual studio convert to 2012 project file link indicator

For Web Applications and Web Services leave the project file in the web application folder, and indicate the Visual Studio version in the file name:

visual studio convert to 2012 web project preparation

Create a Visual Studio version specific folder for the solution and place the .sln file into it. Indicate the Visual Studio version in the name of the folder.

For console applications and windows services:

visual studio folder structure console app solution file location

For web applications and web services:

visual studio folder structure web app solution file location

Multiple setup projects in a Microsoft Visual Studio solution

Sometimes it makes sense the create multiple setup projects in a Microsoft Visual Studio solution if you use the same projects, but you want to create separate MSI files for slightly different functionality. An example would be the processing of audio and graphics files. You can use the same middle tier and backend projects for both processes, but deploy two versions of the application to be able to set up two separate scheduled tasks. This way you can stop them separately and set up different schedules for them.

 

Visual Studio Multiple Setup Projects

 

The two setup projects can coexist, but by default they place the output MSI files to the same sub folder of the setup project: “Release” or “Debug” depending on the configuration. When you start the build of the setup project the compiler deletes all files from the target folder, so if you are expecting two MSI files after the two builds you will be surprised. You will only find the latest build result. The easiest way to handle this is to add an extra folder level in the output file name field of  the setup project properties for the Debug and Release configuration.

 

Visual Studio Multiple Setup Projects Output File Name

 

Send the audio processing MSI to Audio\Debug and Audio\Release, and the graphics processing MSI to Graphics\Debug and Graphics\Release.

Yellow exclamation point next to a project reference in Microsoft Visual Studio 2012 after conversion to a newer version of the IDE

When you convert a solution to a new version of the Microsoft Visual Studio IDE you can see yellow exclamation points next to some project references. When you build the solution you also get errors like the following:

Error, The type or namespace name '...' could not be found (are you missing a using directive or an assembly reference?)
Error, Metadata file '....dll' could not be found

The yellow sign tells you that the referenced project is not compatible with this project.

Visual Studio References Yellow Exclamation Point

 

Even if you remove the reference and add it again the exclamation mark stays there.

When you convert a solution to a newer version of the IDE in Microsoft Visual Studio make sure all projects target the same framework.

When Visual Studio converts a project it does not change the target framework. If you have multiple projects in your solution check the target framework on the Property pages of all of your projects to make sure those are the same.

Visual Studio Application Target Framework

 

Date specific header image in the Witcher World WordPress theme

Have you ever wanted to display specific images on certain dates in the header of your WordPress page like Google does?

If you want to automatically set the header image based on the date there is an easy way to do it. This way you can display a prepared image on certain dates like Independence Day, your birthday, or as in this example on the International Women’s Day, March 8th.

In the original Witcher World WordPress theme there are two ways to display header images: one selected image or a random image from multiple uploaded header images.

If you have access to your site via FTP and are not afraid of changing some PHP script in your Witcher World WordPress theme follow the simple steps below:

  • Upload a 988 pixel wide and 300 pixel high image to the “images” folder of the your Witcher World WordPress theme
    • Name the image “header_womens_day.jpg” (without the quotes)

wordpress witcherworld images folder

 

  • Log into your WordPress site as an administrator,
  • On the left side click “Appearance” and “Editor”,

wordpress appearance editor select

 

  • On the right side select “Header”,

wordpress theme header edit select

 

  • In the editor find the following line. That sets the header image of the theme.

<div id=”header”<?php if(get_header_image() != “”) echo ” style=’background-image: url(“.get_header_image().”);'”; ?>>

 

  • Replace it with the following script:

<div id=”header”
<?php
$today = date(“m-d”);
$templatedir = get_template_directory_uri();
$background_image_url = “”;
if ( “03-08″ == $today ) {
// Women’s day
$background_image_url = $templatedir.”/images/header_womens_day.jpg”;
} elseif (get_header_image() != “”) {
$background_image_url = get_header_image();
}
echo ” style=’background-image: url(“.$background_image_url.”);'”;
?>
>

 

  • At the bottom of the page click the “Update File” button

wordpress theme edit update file button

 

On every March 8th the “header_womens_day.jpg” image will be your header image. The  date(“m-d”) function returns the month and day in the  UTC time zone, so you will only see the change when it is March 8th in London (8 hours ahead of Los Angeles).

 

Print a web page in a printer friendly format

If you want to print a web page on your printer without header images and advertisement

  • Highlight the address of the page in the address bar and
    • Press CTRL-C or
    • Right click it and select “Copy”,

printfriendly copy address

  • Open a new tab and navigate to printfriendly.com
  • Paste the address into the field that says: “enter a url”
    • Click the field and press CTRL-V or
    • Right click the field and select “Paste”

printfriendly paste address

  • Click the “print preview” button to see the printer friendly version of the page

You can even delete sections of the document:

  • Move the mouse above the paragraph,
  • Click the red “Click to delete” link.

printfriendly delete paragraph

Click the buttons on the top menu to

  • Print,
  • Save as PDF or,
  • Email the page.

printfriendly buttons

You can remove the images by clicking the “Remove Images” box and adjust the size of the text with the “Text Size” drop down list.

Where are the uploaded images stored in WordPress?

When you upload an image for a page or a post WordPress stores the image at the following location:

wp-content\uploads\YEAR\MONTH

where YEAR and MONTH are the year and month of the upload date.

wordpress image upload location

WordPress creates a new folder every month to reduce the number of files per folder. This way you can find your files easier and the server can also find the files faster, because it can work with a smaller list of directory entries.

How can I remove an image from the Uploaded Images list in WordPress?

When you upload an image as a theme header images the image will be stored in the Media library.

WordPress Theme Header Wrong Images

If you upload multiple header images and you want to remove some of them

  • Log into your WordPress site as an administrator,
  • On the left side select “Library” in the Media menu,

WordPress Media Library Select

  • Click the “Delete permanently” link next to the unwanted image

WordPress Media Library Delete

  • Click “OK” to confirm the deletion of the file.

WordPress Media Library Delete Confirm

How can I create a custom header image for the Witcher World theme in WordPress?

The Witcher World is a great theme and it is very easy to customize it. The original header image is beautiful, but if you want to display your custom header image you have to take some simple image editing steps to make sure it looks as good as the original.

The original image contains the left and right borders of the header, so if you add your image you have to add those to your custom image.

Create the custom header image

Click the image below to open the header image template with transparent areas for your custom image in a new tab of your web browser. On the new tab right click the image and select “Save image as…” (“Save picture as…” in Internet Explorer) and save the image to your computer. When it is done close  the new tab to return to this page.

Witcher World header transparent template

 

Select a picture on your computer that you want to use as the header image. The following steps show how to do it in Colrel Paintshop Pro XI. All other graphics editor programs should have similar feature to do the same.

  • To resize the image to 988 pixel wide select “Resize” in the Image menu

Paint Shop Pro Resize Select

  • Set the width to 988 pixels and check the “Lock aspect rato” to set the height automatically and avoid distortion, and click OK,

Paint Shop Pro Resize

  • In the View menu select “Zoom to 100%” to see the larger view of the image,

Paint Shop Pro Zoom To 100%

  • To crop the image to 988 wide  and 300 high on the left side select the crop icon and in the header enter 988 pixel width and 300 pixel height,

Paint Shop Pro Crop Select

  • Move the crop rectangle to the desired place and click the “Apply” button on the header,

Paint Shop Pro Crop

  • Set the background color to blue to enable the transparency during the paste of the template,

Paint Shop Pro Background Color Is Blue

  • Double click the background color indicator,

 Paint Shop Pro Background Color Select

    • Click the blue color and click OK,

Paint Shop Pro Background Color Blue

  • Open the Witcher_World_header_transparent_template.png in the same application,
  • In the Selections menu click “Select All”

PaintShopPro_SelectAll

  • In the Edit menu click “Copy”,

PaintShopPro_Copy

  • Switch to the cropped image by selecting the file in the Window menu,

Paint Shop Pro Window Menu

  • Paste the Witcher_World_header_transparent_template.png on top of it as a “Transparent selection” exactly on top of your cropped image,

Paint Shop Pro Paste Transparent Selection

  • Save the new composite image on your computer. Click Yes to allow Paint Shop Pro to merge the parts of the image.

PaintShopPro_SaveMerge

Upload the custom header image

  • Log into your WordPress site as administrator,
  • On the left side select “Appearance,” and “Header”,

WordPress Theme Header Change Select

  • On the middle pane in the Select Image section select “Choose File” under Choose an image from your computer,

WordPress_ThemeHeaderChangeChooseFile

  • Select the new file and click the Open button,

WordPress Theme Header Change Browse File

  • Click the “Upload” button on the page,

WordPress Theme Header Change Upload File

  • You can upload multiple images and select  “Random: Show a different image on each page” in the Uploaded Images section to display a different image at every page load.

WordPress Theme Header Change Random

  • Click the “Save Changes” button at the bottom of the page.

WordPress Theme Header Change Save Changes

How to set up WordPress in five minutes

It really takes five minutes to set up WordPress.

If your site is hosted by an other Internet  Service Provider the process can be slightly different than the steps below, but it should be similar enough to be relevant to your situation.

If your site is hosted by Winhost.com

  • Log into your Winhost control panel at www.winhost.com
    (
    When you set up your site they gave you a user name and you selected a password to access the account administration pages)
  • On the main menu select “Sites” to administer you web site

Winhost Sites Link

 

  • On the Site List select the “Manage” link next to your site

Winhost Sites Manage Link

  • On the Site Manager window select the “App Installer” icon

Winhost App Installer Link

  • In the list of applications scroll down to the bottom to WordPress and click

Winhost App Installer WordPress Install Link

 

  • Enter the name of the folder where you want to install WordPress,

Winhost App Installer WordPress Install FolderName

  • Write down the full “AppPath” you entered. That will be the address of your WordPress site,
  • Click the “Install Application” button,
  • The confirmation page appears, but don’t click the link of your application yet,

Winhost App Installer WordPress Install Success Message

  • For advanced users only:
    • Before you continue make a note of the WordPress version your provider offers. It is 3.5.  At the time of  the writing of this post the latest version of WordPress is 3.5.1, so later we will overwrite the Winhost version using an FTP client.,
  • First we have to set up the MySql database that WordPress will use to store the content of your site, so click the “Site Manager” link below the top menu,
  • The link will take you to the Site Tools page,

Winhost MySql Setup Link

  •  Click the “MySQL” icon to set up the MYSQL database,

Winhost MySQL Setup Add

  • Click the “Add” button to create the MySQL database,

Winhost MySQL Setup Create

  • Enter
    • a name for the database 
    • username
    • the size of the data that the user can use in the database (if WordPress is the only applications you want to connect to this database enter the maximum value into the Quota field)
  • Click the “Create” button,

Winhost MySql Setup Success Message

  • To see the connection details for the newly created database click the “Manage” link,

Winhost MySql Manage

  • Copy the connection details to a text file, because you will need to enter these values into the WordPress configuration form,
  • Click the “Edit” link to set the database password,

Winhost MySql Change Password

 

  • Open a new tab in your web browser and enter the address of your wordpress site. In our example it is YOURSITE.com/blog

WodrPress Setup Config File

  • WordPress will create the missing configuration file when you click the “Create a Configuration File” button,

WodrPress Setup Config File Lets Go

  • Click the “Let’s go!” button,

WodrPress Setup Config Enter Values

  • Enter the values that you saved earlier,
    • Database Name
    • User Name
    • Password
    • Enter the Database Server name to the “Database Host” field
  • Click the “Submit” button

WodrPress Setup Config Run Install

  • Click the “Run the Install” button to create the WordPress configuration file,

WodrPress Setup Config Site Values

  • Fill out the form and click the “Install WordPress” button,

WodrPress Setup Config Success Message

  • Done! Click the “Log in” button to open your site manager page.