Wednesday, 22 September 2010

You cannot change the specified .NET Framework version

Hi Boys and Girls,

After converting an existent Solution from VS 2008 to VS 2010 I noticed that the Target Framework, for most projects, were kept to .NET Framework 3.5 with the only exception being my Test Project.

My Test Project had .NET framework 4.0 as the target framework. :-(

I tried manually to change the .NET framework back to 3. 5 and got this infamous error:












So basically I am stuck with having my Test Project targeting .NET 4.0 and my other projects targeting 3.5.

The $1000 question is : will the test units work? Thankfully they ran with out any issue. ;-)

The word from MS is:

Posted by Microsoft on 21/08/2009 at 12:58 AM

Thanks for your feedback. We are routing this bug to the product unit who works on that specific feature area. The team will review this issue and make a decision on whether they will fix it or not for the next release.

Thank you,
Visual Studio Product Team







Thursday, 9 September 2010

SSIS 2008 - Adding conversion data types


Last day I run into an issue while trying to import data from an excel workbook into some MSSQL 2008 tables.

On the setp "Review Data Type Mapping" of the Import/Export Wizard I got the infamous
red icon, next to two of the columns I wanted to import






Clearly the source data and the target data for those two columns are of different types and SSIS doesn't have a mapping between a Double and a nvarchar.

The mapping between SSIS data types are defined on a xml file located under the folder "Microsoft SQL Server\100\DTS\Binn" named DTUtil.exe.config
Luckily this XML file can be augmented to support conversions of others SSIS data types as long as the the the formatting of the target and source data types allow the conversion.





















First step is to discover what SSIS data types are the columns generating the issue.
On the Review Data Type Mapping screen I located one of the column experiencing the
unknown column type conversion and double click to see the conversation details.




















By looking on the Column Conversion Details I notice that the SSIS type of my source colum is (DT_R8)

Column Type: Double
SSIS Type: double-precision float [DT_R8]

and the SSIS type of the target or destination column is DT_TEXT.

Column Type: nvarchar
SSIS Type: Unicode text stream [DT_NTEXT]

Next I open the DtwTypeConversion.xml file using Tool for Men (aka Visual Studio)
By looking on the section for the DT_R8 type I confirmed that conversion of DT_R8
to DT_TEXT is not supported on the current mapping.













As a matter of fact my current mapping for the DT_R8 type only supports: conversion DT_R8 types to DT_DATE, DT_NUMERIC AND DT_DECIMAL

Time to add the DT_NTEXT type to this mapping to let SSIS knows that the conversion type of a Double to nvarchar is possible.

With the extra mapping for the conversion of double (DT_R8) to nvarchar(DT_NTEXT) added, this is the way this section of my DtwTypeConversion.xml looks like:



Important, things to consider:
1. Create a copy or back up of the DtwTypeConversion.xml before you modify it.
2. On window 7 and Server 2008 you will need to open the DtwTypeConversion.xml with
Administrator rights.
3. After applying the changes to the DtwTypeConversion.xml and before importing the
data, back up your database just in case your data lose precision.
4. if working with real data, this is data that will be used on a real application,
I would suggest you test this procedure on your developer environment to minimize
down time to either your clients or company.

Don't underestimate the power of the Dark Side.