I have a C sharp windows application form payroll then i deploy the project
After deplyomentation i installed a fresh system(sql server and .net framework is not exist) but an error occur
I want to install .Net framework then SQLServer 2005 and finally install my application
Loading

Zoran HorvatPosted Jul 20, 2011, 9:10 AM
That application would then test for presence of required resources, which in your case is to test .NET Framework and MSSQL installations.
You can detect presenceof .NET Framework, including precise versions installed, by inspecting registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework
MS SQL Server creates registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server
, and under it you can inspect installed versions.
You can access registry from Win32 application by using WIN API, without need of any specific libraries and frameworks, so that will work for sure on a fresh system. If that application finds out that .NET Framework is missing, it can spawn a process running the .NET Framework installer, and then inspect process exit code to check whether installation went good. Same is with SQL Server - if it's missing, spawn a process with its installer and then inspect its return value.
In both cases refer to MSDN articles explaining return codes of these installers.
Once both installations went well (or components were initially present, so installations have been skipped), you spawn a process to run your installation, which requires these components to be in place.
Zoran