How to delete a folder from the Subversion database in the TortoiseSVN client

If you don’t need a folder in the Subversion database anymore follow the the steps below.

If you are using the TortoiseSVN Subversion client

  • Start Windows Explorer,
  • Right click any folder,
  • Select “TortoiseSVN”, “Repo-browser” to open the repository browser.

TortoiseSVN repo browser select

 

In the repository browser:

  • Right click the folder you want to remove,
  • Select “Delete…”

TortoiseSVN repo browser folder delete

 

Enter a message and click the “OK” button.

TortoiseSVN repo browser folder delete message

 

How to exclude a project folder from the Subversion database

If you added the AnkhSVN – Subversion Support for Visual Studio from http://ankhsvn.open.collab.net/ you can easily version your files as you develop them.

In your application there could be projects or folders that you don’t want to include in source control.

To ignore the changes in a project open the Solution Explorer in Visual Studio 2010,

  • Right click the project that you want to exclude from source control
  • Select “Project File”, ‘”Ignore”, “Ignore Folder”

visual studio subversion project ignore

New files are not displayed when I click the “Add Items to Folder” button in the Source Control Explorer of Microsoft Visual Studio 2012

To add items to source control in Microsoft Visual Studio 2012 open the Source Control Explorer and  click the “Add Items to Folder” button on the tool bar.

If a folder is selected Visual Studio does not display the new files in the current folder:

visual studio 2012 source control explorer add folder selected

 

To be able to add the new files from the current folder, click somewhere on the background of the file list, so no item is selected, and click the  “Add Items to Folder” button again:

visual studio 2012 source control explorer add nothing selected

Convert Microsoft Visual Studio applications to version 2012

When Microsoft releases a new version of Visual Studio developers would  like to use the new features of the new IDE. Usually the new version of Visual Studio converts the solution and project files to a new format to be able to save the new settings of that version of the IDE. More seasoned developers already experienced this conversion madness multiple times migrating their applications from VS 2003 to VS 2005 to VS 2008 to VS 2010 and now to VS 2012. Knowing the past we can predict that this trend will continue in the foreseeable future, so it is better to be prepared and set up our applications for easy conversion from the get go.

This post explains how to convert an application from Microsoft Visual Studio 2010 to 2012.

First prepare your application for the conversion. Read the  “How to set up Microsoft Visual Studio solutions for easy conversion…” post to get all the details step-by-step.

 

Copy the project folder

For every Console Application, Windows Service and Class Library project make a copy of the Project_2010 folder as Project_2012

visual studio convert to 2012 project copy project folder

Remove the read only attribute from the folder and all sub folders and files in it:

  • Right click the Project_2012 folder and select “Properties”
  • In the Properties window clear the “Read only…” check box and click “OK”

visual studio convert to 2012 project remove read only

 

Click OK on the next window to remove the read only flag from all files and the sub folders too.

visual studio convert to 2012 project remove read only subfolders

 

Open the “Project_2012” folder and delete the “bin”, “obj”  folders and the “.csproj.vspscc” TFS file.

visual studio convert to 2012 project delete files

 

Copy the web project file

For Web Applications and Web Services make a copy of the …_2010.csproj web project file as …_2012.csproj and remove the read only attribute from the _2012 version:

visual studio convert to 2012 project copy web project file

 

Edit the project file in the Project_2012 folder

In Visual Studio 2012 select “Open”, “File…” from the menu,

visual studio open file

 

  • Click the down arrow on the Open button
  • Select “Open With…”

visual studio open with

 

  • Select “XML (Text) Editor” and click “OK”

visual studio open with XML

 

  • In the project file replace “_2010” with “_2012”. In the replace dialog turn off “Match whole word” to find all occurrences of the _2010 reference.

visual studio replace 2010 with 2012

 

Add the new “Project_2012” folder to source control.

 

Copy the solution folder

Make a copy of the Solution_2010 folder as “Solution_2012”.

visual studio convert to 2012 solution copy solution folder

 

Remove the read only flag from the “Setup_2012” folder and its sub folders as you did it with the Project_2012 folder above.

Delete the “.vssscc” file. Visual Studio 2012 cannot work with setup projects, so also delete the “Setup” folder with the VS 2010 setup project in it.

visual studio convert to 2012 solution delete files

 

Edit the solution file in Visual Studio

Open the solution file as XML in the “Solution_2012” folder and replace “_2010” with “_2012”  as you did it in the Project_2012 file above.

 

Open the 2012 solution in Visual Studio 2012

Open the solution in Visual Studio 2012, and click OK on the warning dialog about the Setup project. Visual Studio 2012 does not support the Setup project any more. If you want to create MSI files use WIX to generate them.

visual studio convert to 2012 setup project not supported

 

To remove the Setup project from the solution right click the setup project and select “Remove”

Make sure all of your projects use the same .NET framework. See the  “Yellow exclamation point next to a project reference…” post for more information.

 

Add the “Solution_2012” folder to source control.

Make a copy of the Config_2010 folder as Config_2012

  • Remove the read only flag from the Config_2012 folder
  • Add the Config_2012 folder to source control

Modify the config files


For command line executives and windows services

Modify the App.config files in the Config_2012 folder


If the solution was created in Visual Studio 2008 or an earlier version

  • Remove encoding=”utf-8″ from the first line
  • Insert

    <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup>

    into the <configuration> element


If the solution was created in Visual Studio 2010

  • Change the value of the  sku attribute of the <supportedRuntime> element from “.NETFramework,Version=v4.0” to “.NETFramework,Version=v4.5”


For web applications and web services

Modify the Web.config files in the Config_2012 folder

  • In the <system.web> node
    • in the <compilation> element set the value of the targetFramework to “4.5”
      targetFramework="4.5" )
    • in the <pages> element set the value of the controlRenderingCompatibilityVersion to “4.0”
      ( controlRenderingCompatibilityVersion="4.0" )


    <compilation defaultLanguage="c#" debug="false" targetFramework="4.5" />

    <pages controlRenderingCompatibilityVersion="4.0" clientIDMode="AutoID"/>

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.