When I changed the prerequisites for my Microsoft Visual Studio setup project to target the .NET Framework 4 and not the .NET Framework 4 Client Profile, I got the message:
The target version of the .NET Framework in the project does not match the .NET Framework launch condition version ‘.NET Framework 4 Client Profile’. Update the version of the .NET Framework launch condition to match the target version of the.NET Framework in the Advanced Compile Options Dialog Box (VB) or the Application Page (C#, F#).
This was caused by the fact, that the setup Launch condition was still on Microsoft .NET Framework 4 Client Profile
Solution
Change the Setup Launch condition to match you’re setup prerequisites:
- Select you’re project in the Solution Explorer
- Click on the Launch Conditions Editor button
Note 1
You can change the prerequisites of you’re Microsoft Visual Studio setup project, by right clicking on the setup project, choose properties and click on Prerequisites…
Change to Microsoft .NET Framework 4 and not Microsoft .NET Framework 4 Client Profile:
Note 2
When you are working with Microsoft Visual Studio setup projects make sure the following settings are in sync:
- Project Target framework for the projects the setup references
- Prerequisites of the setup project
- Launch condition of the setup project
Tags: Setup Packages, Visual Studio
If you create a class like Setting<T>, you might think you can create a generic list, like:
List<Setting<T>> List = new List<Setting<T>>();
,but this is not possible in .Net 4.0. If you want objects of type Setting<int> mixed with objects of type Setting<bool> in one List<T> you must define a none generic base class Setting, like:
public class Setting { private string _name; public string Name { get { if (string.IsNullOrEmpty(_name)) { throw new ApplicationException("Property [Name] in class [Setting] is null or empty"); } return _name; } set { _name = value; } } } [Serializable] public class Setting<T> : Setting { private T _value; public T Value { get { return _value; } set { _value = value; } } public Type Type { get { return typeof(T); } } /// <summary> /// Define a default constructor for serialization purposes /// </summary> public Setting() { } }
Then you can mix generic types in the generic list like:
List<Setting> list = new List<Setting> { new Setting<int>{Name = "Timeout", Value = 1000}, new Setting<bool>{Name = "ImportEnabled", Value = true} };
You can get an element of this list by using the method:
public T GetSetting<T>(string name, List<Setting> list) { T result; Setting<T> setting = (Setting<T>)Convert.ChangeType( list.Single(s => s.Name.Equals(name)), typeof(Setting<T>), null); result = setting.Value; return result; }
To call the method use:
int timeout = GetSetting<int>("Timeout", list);
Tags: C#
When I use a Windows 7 x64 computer and start a Remote Desktop session to a machine running Windows 7 x64 with VMWare 7. De mouse pointer disappears in the VMWare guest running Windows XP, when over textboxes or texteditors.
I found the solution at: http://wiert.wordpress.com/2010/08/06/rdp-to-vmware-host-running-an-xp-guest-invisible-mouse-cursor-on-text-editors/
Solution
Change the mouse pointer scheme to "Windows Black (system scheme)"
Start > Control Panel > Mouse > Pointers > Windows Black (system scheme)
Tags: VMWare
When I refreshed a SSIS package OLE DB Source, I got the error: column "test" cannot be found or is not specified for query (13865).
This was caused by the fact, that the query contained a column that did not exist anymore in de database.
Removing the column name in the SqlCommand resolved this error.
Tags: Integration Services
When you have many databases on a database development SQL server and these databases are re-creatable, you can save space by setting the recovery model for all databases to Simple, truncate and shrink the log files, with the following T-SQL script
/* Only use this script for SQL Server development servers! Script must be executed as sysadmin This script will execute the following actions on all databases - set recovery model to [Simple] - trucate log file - shrink log file */ use [master] go -- Declare container variabels for each column we select in the cursor declare @databaseName nvarchar(128) -- Define the cursor name declare databaseCursor cursor -- Define the dataset to loop for select [name] from sys.databases -- Start loop open databaseCursor -- Get information from the first row fetch next from databaseCursor into @databaseName -- Loop until there are no more rows while @@fetch_status = 0 begin print 'Setting recovery model to Simple for database [' + @databaseName + ']' exec('alter database [' + @databaseName + '] set recovery Simple') print 'Shrinking logfile for database [' + @databaseName + ']' exec(' use [' + @databaseName + '];' +' declare @logfileName nvarchar(128); set @logfileName = ( select top 1 [name] from sys.database_files where [type] = 1 ); dbcc shrinkfile(@logfileName,1); ') -- Get information from next row fetch next from databaseCursor into @databaseName end -- End loop and clean up close databaseCursor deallocate databaseCursor go
Tags: SQL Server, T-SQL
Install the proofing tools for your language (English, French, Spanish are installed by default) for example Dutch.
Then if you want to change the proofing language of a piece of text in OneNote 2010.
Select the text > Review > Language > Set Proofing Language… >
Tags: OneNote
If you create all your software documentation in OneNote 2010 and want to export it to Word 2010, for a customer. You will miss a table of contents. You can automatically generate this table of contents during export, by using the OneNote export api, but this post shows you how to do it manually.
Result of the OneNote 2010 export to Word 2010:
Tutorial
- Generate your OneNote 2010 like this:
- Apply heading styling to your chapters and paragraphs:
- Export OneNote section to Word 2010: File > Save As > Section > Word Document (*.docx) > Save As > Save
- Open the document in Word 2010:
- Set cursor on the text "Chapter 1", click on Home > Select > Select All Text With Similar Formatting (No Data)
- Click on Heading 1 to apply formatting
- Do the same for Paragraph 2.2 and 2.2.1
- Create table of contents: References > Table of Contents
Tags: OneNote
After doing some projects for customers with ASP .NET 4.0, what are the new features that I used in the real world?
- SQL cache invalidation: this means that when the result set from SQL Server changes, the output cache is triggered to change, and the end user always sees the latest result set. The data presented is never stale
- ASP.NET 4 provides 64-bit support. This means that you can run your ASP.NET applications on 64-bit
Intel or AMD processors. - ADO .NET Entity Framework, used for business entity- and data layer.
- ASP.NET Dynamic Data, used for generating the administration pages of an web application.
- WCF Data Services, to create, update and delete data in the database, via a RESTful service
- Health monitoring system, used in addition to SCOM to monitor the health of the system. (log: application starts and stops, failed logins, unhandled exceptions etc.)
- WebConfigurationManager, to read and write to the web.config, changing settings.
Tags: ASP .NET
If you want to get the week number of a date in C#, use the following function:
private int GetWeekNumber(DateTime date) { return CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(date, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday); }
Tags: C#
If you want to close all connections to a database, you can use the following TSQL code:
USE MyDatabase
GO
ALTER DATABASE MyDatabase SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
– Set some options or do some work
GO
ALTER DATABASE MyDatabase SET MULTI_USER
GO
Tags: SQL Server, T-SQL

