Search this blog

Showing posts with label .NET Framework. Show all posts
Showing posts with label .NET Framework. Show all posts

Monday, December 14, 2009

"Send To" Not Listing the Shortcut of Application After Install Setup Kit


Today we have created setup kit for windows based application. After installed the setup, it should extract the application to “Send To” Folder.
This is our requirement, everything is going well, application installed well and shortcut file of the application in created in “Send To” folder. But the problem is, when you select any file and click “Send To”, the list is not showing the application.

When I search the solution in the Google, I found the following solution.

1. We need to modify the Setup file (*.MSI), which is output of our setup project, before install it. To modify the file first Download Orca.Exe and install it.
Orca.exe is a database table editor for creating and editing Windows Installer packages and merge modules. The tool provides a graphical interface for validation, highlighting the particular entries where validation errors or warnings occur.
2. After installed, open the Orca application from installed location.
3. open your output file, *.MSI in Orca.Exe
4. Go to the “property” Table and select from left pane.
5. In the right pane, it will list the properties it contains
6. Right on the right pane, select “Add Row”
7. Add new property “DISABLEADVTSHORTCUTS” with value “1” as shown in the image.
8. Click Ok, and then Save it.
9. Now if you install this package, it will be listing on the “Send To” list


Note: Click on the image to see the maximize view


Hope it helps!

Tuesday, October 27, 2009

ILMerge


ILMerge is a utility that can be used to merge multiple .NET assemblies into a single assembly. ILMerge takes a set of input assemblies and merges them into one target assembly. The first assembly in the list of input assemblies is the primary assembly. When the primary assembly is an executable, then the target assembly is created as an executable with the same entry point as the primary assembly. Also, if the primary assembly has a strong name, and a .snk file is provided, then the target assembly is re-signed with the specified key so that it also has a strong name.


ILMerge is packaged as a console application. But all of its functionality is also available programmatically.


There are several options that control the behavior of ILMerge. See the documentation that comes with the tool for details.


ILMerge runs in the v2.0 .NET Runtime, but it is also able to merge v1 or v1.1 assemblies. However it can merge PDB files only for v2 assemblies.


Currently, ILMerge works only on Windows-based platforms. It does not yet support Rotor or Mono.


If you have any problems using ILMerge please contact mbarnett _at_ microsoft _dot_ com. More details are available at the ILMerge web site.
Download ILMerge.Msi

Tuesday, October 20, 2009

The .NET Framework Stack




Refer this link

Monday, October 12, 2009

Interface in .NET


What is Interface?
          Interface is a Collection of abstract methods, members encapsulated together into a specific functionality. It contains only the signature of the members. The implementation of these members will be available on the class that implements the interface

Interface can be a member of class or namespace and it contains only the signature of following members
   1. Methods
   2. Properties
   3. Indexers
   4. Events or Delegates


When you go for Interface?
          C# doesn’t support Multiple Inheritance. To overcome these problems we can use Interface. Also interface provides more design facility. Interface let you separate the definition of the object from their implementation. Also there are several others reason like,
   1. your application may requires many unrelated object types to provide certain functionality
   2. it is more flexible than base class
   3. you don’t need to inherit implementation from base class
   4. it is very useful when you can’t use class inheritance where as structure can’t inherit from class but it can be implemented thru interface




Private Assembly

Private Assembly:
  • It is available and accessible with in an application
  • It will reside inside the application folder
  • It is designed only for isolated application
  • By default, all the assemblies are private assemblies.
  • Private assembly must be accompanied by an assembly manifest.
  • Private assemblies are not required to be installed
  • It is not required to be signed, and PublicKeyToken is not required in the element of the assembly manifest.

What is Assembly

Assembly is a compiled code which is also called as native code and it will be compatible to run on operating system. It may be either executable or library file (.dll).

An Assembly is a reusable, versionable, self-describing deployment unit for types and resources. It is the primary building block of .NET Applications.

Assembly consist of following logical components
  1. Manifest
  2. Metadata
  3. Resources

Assemblies are classified into 3 categories, there are

  1. Private
  2. Public or shared
  3. Satellite

Friday, October 9, 2009

Introduction to .NET - Video Presentation

This is very Informative video for .NET Beginners.

This video is Presented By,
Mike Ormond
Developer & Platform Group
Microsoft Limited

Presented On 14th April 2004





Hope it helps you!

Wednesday, October 7, 2009

What is Managed Code and Managed Data?

if a code running under the control of CLR, then we can call it as Managed Code.

Managed Code is code that is written to target the services of the common language runtime (see what is CLR?). In order to target these services, the code must provide a minimum level of information (metadata) to the runtime. All C# (when not using the unsafe keyword), Visual Basic .NET, J#, and JScript .NET code is managed by default. Visual Studio .NET C++ code is not managed by default, but the compiler can produce managed code by specifying a Command-line switch (/CLR). 


Closely related to managed code is Managed Data — data that is allocated and reallocated by the common language runtime's garbage collector. C#, Visual Basic.NET, J# and JScript .NET data is managed by default. C# data can, however, be marked as unmanaged through the use of special keywords. Visual Studio .NET C++ data is unmanaged by default (even when using the /CLR switch), but when using Managed Extensions for C++, a class can be marked as managed by using the __gc keyword. As the name suggests, this means that the memory for instances of the class is managed by the garbage collector. In addition, the class becomes a full participating member of the .NET Framework community, with all of the benefits and restrictions that brings. An example of a benefit is proper interoperability with classes written in other languages (for example, a managed C++ class can inherit from a Visual Basic.NET class). An example of a restriction is that a managed class can only inherit from one base class. Any restrictions, such as this one, are designed to prevent common programming errors.

What is CTS and MSIL

What is the common type system (CTS)?

The common type system (CTS) is a rich type system, built into the common language runtime (CLR) that supports the types and operations found in most of .NET programming languages. The common type system supports the complete implementation of a wide range of programming languages.

What is the Microsoft Intermediate Language (MSIL)?

MSIL is the Machine independent Code into which .NET Framework programs are compiled. It contains instructions for loading, storing, initializing, and calling methods on objects. Combined with metadata and the common type system, MSIL allows for true cross language integration. Prior to execution, MSIL is converted to machine code via CLR’s Just-in-Time (JIT) compiler.

What is the common language runtime (CLR)?

The common language runtime (CLR) is major component in the .NET Framework and it is the execution engine for .NET Framework applications.

It is responsible for proving the number of services, including the following:
  1. Code management (loading and execution)
  2. Verification of type safety
  3. Conversion of Microsoft Intermediate Language (MSIL) to native code
  4. Access to metadata (enhanced type information)
  5. Managing memory for managed objects
  6. Enforcement of code access security (See what is code access security?)
  7. Exception handling, including cross-language exceptions
  8. Interoperation between managed code, COM objects, and pre-existing DLLs (unmanaged code and data)
  9. Automation of object layout
  10. Support for developer services (profiling, debugging, and so on)

Tuesday, September 29, 2009

Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack

When I tried Execute the Following Code,


try
{
Response.Redirect(
"Default2.aspx");
}

catch (Exception Ex)
{
Response.Write(Ex.Message.ToString());
}

I got the following Error


Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.

I removed the try ... catch ... block, then I tried only with

Response.Redirect(
"Default2.aspx");

then it works fine. finally I came to know that Response.Redirect wont works with in
try ... catch ... block.

Hope it helps you too.

DataAdapter

The DataAdapter is a ADO.NET class, it provides disconnected data access, also acting as a middleman to provide all kind of interaction between the database and a DataSet.

The DataAdapter is used either to fill a DataTable or DataSet with data from the database by it's Fill method. After the memory-resident data has been manipulated, the DataAdapter can commit the changes to the database by calling the Update method.

The DataAdapter provides four properties that represent database commands:
  • SelectCommand
  • InsertCommand
  • DeleteCommand
  • UpdateCommand

Data Provider

The Data Provider is a one of the major components of ADO.NET architecture, it is responsible for providing and maintaining the connection to the database. A DataProvider is a collection of related components that work together to provide data in an efficient manner.

Currently, the following data providers are available in .NET Framework,

  • SQL Server
  • OLEDB
  • ODBC
  • Oracle

Each DataProvider consists of the following component classes:

The Connection object which provides a connection to the database
The Command object which is used to execute a command
The DataReader object which provides a forward-only, read only, connected recordset
The DataAdapter object which populates a disconnected DataSet with data and performs update

Tuesday, September 1, 2009

ADO.NET Data Services v1.5 CTP2


This CTP is a preview of the set of features we are considering shipping with the next version of ADO.NET Data Services. This CTP targets the Microsoft .NET Framework 3.5 SP1 and extends the functionality we provided in v1.0 of ADO.NET Data Services by providing additional features. This CTP builds on and makes updates to the functionality provided in ADO.NET Data Services v1.5 CTP1.

As this is a CTP release, we recommend that you do not install this release on your primary development computer. Also, be aware that the features that ultimately ship with the final release of v1.5 may be different than the features included in this CTP.

The features included in this CTP are:
  • Row count
  • Feed customization (aka "web-friendly feeds")
  • Data binding for WPF and Silverlight 3
  • Enhanced blob support
  • Server-driven paging
  • Projection Support (via the $select query option)
  • A new "Data Service Provider" interface for custom providers
  • Various bug fixes to V1.0 features
Install Notes:

This release is separate from the Project Codename "Astoria Offline", Alpha Preview released on March 5, 2009. Installing this CTP on the same system as the Offline release will cause a conflict and is not supported. We strongly recommend that you do not install them together.

Installing this CTP on the same system as the ADO.NET Data Services CTP1 is not supported. You must uninstall CTP1 before installing CTP2.

It is possible to use this CTP with the Windows 7; however, design time support integrated with Microsoft Visual Studio 2008 SP1 or Microsoft Visual Web Developer 2008 Express Edition will not be available on Windows 7. Using DataSvcUtil.exe for client-side code generation will also not be available on Windows 7. If you use the installer named ‘ADONETDataServices_v15_CTP2.exe’ you will receive a warning when you use the setup on a system with Windows 7 installed indicating a file is locked but the setup will not fail and the design-time components will not be installed. A separate installer named ‘ADONETDataServices_v15_CTP2_RuntimeOnly.exe’ is provided that installs only the runtime components and does not present the error message during install.

Wednesday, August 19, 2009

Filter the EventLog Entries thru C# Code

To Read & Write Event Log thru C#, System.Diagnostics.EventLog class will help. When we read from Eventlog, the following code will helps

EventLog EvLog = new EventLog("Application", ".");
foreach (System.Diagnostics.EventLogEntry entry in EvLog.Entries)
{
.....
}

This code will read all the Entries from Event Log, here there is no option to filter the entries of Event log.To implement the filter on the Eventlog, we have to check the value one by one in the for each loop, as given below

foreach (System.Diagnostics.EventLogEntry entry in EvLog.Entries)
{
if (entry.TimeWritten > DateTime.Now.AddDays(-1))
{
.....
}
}

If the list of entries are more in the Event log, then this is not proper way. It will leads to performance issue.To avoid this, we can use WMI Query Language. this Query Language is same as SQL Query structure, we can filter the data in the same way of SQL.

Win32_NTLogEvent is a WMI class which is used to translate instances from the Windowsevent log.

Have a look at the following sample code, (written in C# and windows application)

string SomeDateTime = "20090817000000.000000+000";
string Query = String.Format("SELECT * FROM Win32_NTLogEvent WHERE Logfile = 'Application' AND TimeGenerated > '{0}'", SomeDateTime);

ManagementObjectSearcher mos = new ManagementObjectSearcher(Query);
object o;
foreach (ManagementObject mo in mos.Get())
{
foreach (PropertyData pd in mo.Properties)
{
o = mo[pd.Name];
if (o != null)
{
listBox1.Items.Add(String.Format("{0}: {1}", pd.Name,mo[pd.Name].ToString()));
}
}
listBox1.Items.Add("---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
}

In this sample code, we are using following Query

SELECT * FROM Win32_NTLogEvent WHERE Logfile = 'Application' AND TimeGenerated > 20090817000000.000000+000

This query will fetch the data from Application Log, where the log created on or after 17-Aug-2008This is code display the filtered output in listbox control as shown below

Monday, August 17, 2009

Read Event Log using C#

The Following sample code helps to Read Data from Event Log. This is a sample windows application written by using C#.

In the following sample code, I used 2 controls, Listbox and EventLog Controls.

Set the Log Property of Eventlog control to name of the log to read or write. I selected System Log to test this code

In the Form Load Event, I written the following code,

foreach (System.Diagnostics.EventLogEntry entry in eventLog1.Entries)
{
listBox1.Items.Add(entry.EntryType.ToString() +
" - " + entry.TimeWritten + " - " + entry.Source + " - " + entry.UserName);
}

This code, read the Data from Log file and written display in to listbox control.

Now if run the code, it will display as shown in screen shot

Wednesday, July 22, 2009

WF 4 Migration Guidance


Download
WF 4 Migration Guidance

These documents help .NET developers better understand and evaluate Windows Workflow Foundation (WF) in the Microsoft .NET Framework 4, and the impact of WF 4 on existing WF workflows and code.

This collection of documents by the WF product team should help .NET developers currently using WF in the .NET Framework 3.0 and 3.5 to evaluate .NET Framework 4. The documents map concepts between the existing WF model (defined as the types in the System.Workflow.* namespaces, or WF3) and the new WF model (defined as the types in the System.Activities.* namespaces, or WF4).

The documents and code samples are expected to be updated semi-regularly as additional content is created, and based on the feedback we receive, starting with the release of .NET Framework 4 Beta 1, and continuing through RTM of .NET 4.

Feedback and questions around the documents should be directed to the
WF 4 Forums.

Download
WF 4 Migration Guidance

Thursday, July 16, 2009

Rapid.Addition.White.Paper

Rapid Addition leverages Microsoft .NET 3.5 Framework to build ultra-low latency FIX and FAST processing

This whitepaper describes how Rapid Addition built their ultra low latency FIX and FAST message processing software using the Microsoft .NET 3.5 Framework. By following a disciplined design and development, Rapid Addition was able to meet stringent latency requirements while retaining the advantages that managed code brings.

Download
RapidAdditionWhitePaper.pdf

Wednesday, July 1, 2009

Web Platform Installer 1.0

Developers and server administrators can use the Web Platform Installer 1.0 to more easily discover, download and install the Microsoft Web platform. Using the Web Platform Installer's simple user interface, you can select specific components or install the entire Microsoft Web Platform onto your computer easily and quickly. To help you stay up-to-date with product releases, the Web Platform Installer tool always contains the most current versions and new additions to the Microsoft Web Platform.

Examples of products which can be downloaded and installed through Web Platform Installer include:
  • IIS Web Server


  • Visual Web Developer 2008 Express Edition

  • SQL Server Express Edition

  • .NET Framework

  • IIS Extensions (such as FTP 7.0 and URL Rewriter)

  • …and more
Feedback for Web Platform Installer can be discussed directly with the feature team by visiting the Web Platform Installer Candidate Forum.

Download Web Platform Installer 1.0

Tuesday, June 23, 2009

.NET Rocks! - David Hayden on the Unity Framework

Brief Description
David Hayden talks to Carl and Richard about the Microsoft Unity Framework

Overview
David Hayden is an independent consultant in Sarasota, Florida offering consulting, mentoring, and development services on architecture and best practices in .NET. David is a Microsoft MVP in C#, speaker, MSDN Forum Moderator, Enterprise Library Community Leader, and advisor to Microsoft Patterns & Practices. He spends much of his time helping companies and development teams leverage the proven practices and productivity benefits of Enterprise Library and Software Factories. In addition to his personal blogs at DavidHayden.com and CodeBetter.com, David also runs PnPGuidance.net, which offers numerous articles, screencasts, sample downloads and other resources covering best practices in .NET.

Download 20081111DHayden.zip