Welcome to MSDN Blogs Sign in | Join | Help

When CSC.Exe Generates a Different Size of Assembly From VS IDE

I struggled for the reason why CSC.EXE results in an assembly differently from VS IDE, because VS IDE generates an assembly of 20KB while CSC.exe compiles it in 8KB with the same source code.

I checked the compiler options for the two compilers, but I couldn’t find any big difference. I didn’t except it, but I simply copied the compiler command shown in the output window of VS IDE and executed the same one in the command line window..Wow. The same command line generated the assembly of 8 KB, which were 20KB in VS IDE with the same compiler options..

To figure out  which compiler options and how VS IDE actually passed to CSC.exe, I tried the process explorer and the Gflag tools to hook into the csc.exe execution….but, I couldn’t because VS IDE uses a different mechanism to run the compiler.  I disassembled them and checked the differences, but no big difference.

The actually reason is that I migrated the project from the previous version of VS IDE to 2005. In the previous version, the default File alignment has been changed for the new version. The default value of the setting was 4096, but now it is 512. I don't why though.

To have change the option for CSC.exe, you can use the "/filealign" option. If you want to change the setting in VS IDE, you can do that by setting File Alignment in the Advanced Build Settings dialog box. Capture8-30-2007-5.04.54 PM

Young

Technorati Tags:
Posted by yjhong | 3 Comments

Changing text encodings of output files redirected from PowerShell.

I created a logman setting file as follows:
typeperf -q | where { $_ -like "\Phy*" } | foreach { '"' + $_.Trim() + '"' } > counter.txt

But, logman raised an error reading “Invalid counter path” when I tried to update a counter data collection with the settng file, counter.txt. That’s right. Logman requires the ANSI encoding for its setting file, while the output redirection that PowerShell created Unicode files for that redirection.

Then, How to create a output text file with different encodings?

typeperf -q | where { $_ -like "\Phy*" } | foreach { '"' + $_.Trim() + '"' } | output –encoding ASCII

Posted by yjhong | 0 Comments
Filed under:

The public beta 2 of BizTalk Server 2006 R2 has been released.

It's been long time since I posted the last one. I was pretty busy in working on the WCF adapter documentation for R2.  In addition to the WCF adapters, R2 also has EDI, RFID, and WCF/WinWF interceptors. I think this release has a very high quality.  The WCF adapter has been improved a lot since Beta 1 from the TAP customer feedbacks, and it also has several walkthroughs and samples. You can download this release from here. If you have any questions about the WCF adapters in R2, please let me know.

-- Young

Posted by yjhong | 0 Comments
Filed under:

BizTalk Server 2006 R2

I think there will be no engine changes in R2, but this product refresh will include a number of interesting features and enhancements. For example, R2 adds EDI, RFID, WCF and WF BAM Interceptors, the WCF adapter and supports the R2 Adapter Framework and new releases of LOB adapters. You can get more information about what R2 will look like here.

By the way, I'm now working on the WCF adapters that will be released with BizTalk Server 2006 R2. If you have any questions about the adapters, please leave a message.

Posted by yjhong | 2 Comments
Filed under:

Passing arguments from the command line to downstream functions in Powershell

$args is a special variable, an array of all arguments passed to a function on the command line. But, $args is always treated as an array in PowerShell. And It may cause an interesting side effect when passing $args to a downstream function.
Suppose we define a function as follows:
function t1
{
 “args : $args, $($args.count)”
}

If you call the function in the command line as follows:
PS : Yjhong>C:\t1 r t g
The result will be
args: r t, 2
But, if you call the function in a function as follows:
function t2
{
 t1 $args # my intention is passing the command line arguments that t2 received to the nested function, t1.
}

And, if you run the t2 as follows, you will get a different result as follows:
PS : Yjhong>C:\t2 r t
args: System.Object[], 1
It means that when the t1 function is called in a function, t1 will receive one System.Object[] object consisting of two elements, ‘r’, and ‘t’
Posted by yjhong | 2 Comments
Filed under:

How to create a function name to the global scope in a Powershell script file

I created a script named s.ps1 to define a function named s1.

# s.ps1
function s1
{
             //
}

But, after I run this script, the s1 function is not available in the global scope like:

.\S.ps1
S1
s1' is not recognized as a cmdlet, function, operable program, or script file.

 There are two ways to add the function name to the global scope.

1) Using the dot sourcing

. .\s.ps1 # be cautious that there are a space between two dots.

This makes all definitions in the script be exported or copied to the global scope after its execution.

2) Using global: keyword as follows:

# s.ps1
function global:s1
{
             //
}

Posted by yjhong | 3 Comments
Filed under:

How to create multiple or jagged arrays in Powershell

For me, it was not apparent to create multiple dimensional or jagged arrays in Powershell. I tried the following command, but it only made a single dimensional array:

$b = ((‘a’,’a’))

$b.Count

2

Bruce Payette gave me the answers for this basic question.

 

Here is how to create multiple arrays:

$x = new-object "int32[,]" 10,10

$x.rank

$x[0,5] = 13

$x[0,5]

13

And, here is how to create jagged arrays:

$a = (1,2,3),("a","b","c"),([char[]]"Hello")

$a[0]

1

2

3

$a[0][1]

2

$a[1][1]

b

$a[2][4]

o

$a[2][1..3]

Or..you can use unary comma operator as follows:

$a = ,(1,2)
$a.count
1
$a[0]
1
2
$a[0].count
2

Posted by yjhong | 2 Comments
Filed under:

You will love the new shell named Powershell!

When I installed Windows SDK to test Indigo stuff, I found another toy named Powershell. Powershell is the new name of MSH code named Monad. It is a shell or command interpreter based on .NET framework.
I thought the cmd.exe shell is too simple for practical uses. But, Powershell is simply great!. It is easy, simple, and powerful. It also gives an interactive script development environment that I missed from VB or Jscript. For me, it looks like a Scheme or Lisp interpreter that I learnt and loved at college. Moreover, I think it gives good enough features to manage systems..Now I’m considering using a text based editor like vi, emacs, or qeditor again..:-)
You can download Powershell standalone here.
It will be great if Powershell provider or cmdlet (command let) for BizTalk Server would be provided. (If I have sometime I’d like to make some sample codes for BizTalk Server management.)
Try the new shell, and I believe you will love it!
Posted by yjhong | 3 Comments

10 more BizTalk samples are live in the MSDN Web site

10 more BizTalk samples are live in the MSDN Web site. I wrote four of them as follows:

1) BAM and HAT Correlation
This sample demonstrates how to use the enhanced BAM features, and how to customize BAM and HAT integration. This sample also includes a Windows Forms application customizing BAM and HAT integration for the sample BizTalk solution

2) Using Role Links
This sample demonstrates how to use role links and parties.

3) Using Enterprise Library 2.0 with BizTalk Server
This sample demonstrates how to use Enterprise Library 2.0 with BizTalk Server.   

4) Consuming Web Services
This sample demonstrates how to consume Web services in a messaging-only scenario, and without using the Add Web Reference option

If you have any feedbacks about the samples, please leave a message.

Posted by yjhong | 1 Comments

How to suppress the annoying warning message, "The dependency 'Microsoft.BizTalk.Tracing' could not be found."

I got the following warning messages when building a BizTalk project.


------ Build started: Project: BizTalkApp, Configuration: Development .NET ------
Updating references...
The dependency 'Microsoft.BizTalk.Tracing' could not be found.
The dependency 'Microsoft.BizTalk.Bam.EventObservation' could not be found.
The dependency 'Microsoft.BizTalk.Streaming' could not be found.
The dependency 'Microsoft.BizTalk.XPathReader' could not be found.
Performing main compilation...


I think these warning messages are no harm at runtime. But, they may annoy. The BizTalk project had a reference to a pipeline component project using some BizTalk related components such as Microsoft.BizTalk.Pipeline.dll.
To suppress these warning messages, you can select "False" for the "Copy Local" property of the referenced pipeline project in the BizTalk project. After then, they will be gone.

Posted by yjhong | 0 Comments
Filed under:

How to send the feedbacks for the BizTalk Server documentation!

I attended a customer awareness workshop last week, and one of the feedbacks from customers is about how to send the feedbacks about the BizTalk Server documentations.
Each topic of the online or offline documentations has the following table at the bottom of the page, If you can’t see the table, you can enable it by clicking .

The feedbacks are reviewed promptly, and then the BizTalk Server UE team will response them within 24 hours (usually sooner).
If you have any problems or feedbacks, please don’t hesitate to send them so that you will get the right documentation that you want to see.

Posted by yjhong | 2 Comments
Filed under:

10 more samples for BizTalk Server 2006 live at the MSDN Web site

10 more samples for BizTalk Server 2006 live at the MSDN Web site. I wrote the following samples of them.

1) Using Long Running Transactions in Orchestrations (BizTalk Server Sample)

2) Recoverable Interchange Processing Using Pipelines (BizTalk Server Sample)

3) Delivery Notification (BizTalk Server Sample)

I'm now writing some samples for Role Link, SSO Configuration Source, BAM-HAT correlation, and Web Services messaging only scenario. If you have any opinion or feedbacks for the samples you want to see, please let me know.

Posted by yjhong | 0 Comments
Filed under:

Using Enterprise Library 2.0 in the BizTalk Server 2006 applications with SSO

Enterprise Library 2.0 was released early this year. The library consists of several application blocks for so called enterprise level applications; logging, data access, security, configuration, exception handling, and so on.
BizTalk Server 2006 provides a great tool for BizTalk Server configuration, but it doesn’t seem to have any tool for the application configuration running on BizTalk Server.
Of course, you can use the configuration application block included in Enterprise Library 2.0, but you should touch the BTSNTSVC.exe.config file that is a system-wide resource.  Otherwise, you can use the SSO store to manage the configuration, but you still need to make a custom management tool, and it couldn’t be well integrated with Enterprise Library 2.0. .
I thought the best way to solve these problems should be to implement a SSO configuration source for Enterprise Library. In this way, you can use the Enterprise Library configuration tool to save your configuration information, and the application blocks in Enterprise Library can be more seamlessly integrated into the BizTalk Server 2006 applications. 

How to install the SSO configuration source:

1) Download the SsoConfigurationSource.VSTS solution and unzip it to the C:\BizTalkServer2006RTWSamples folder.
2) Compile the sample solution. It is recommend downloading Enterprise Library 2.0 from the Microsoft patterns and practices Web site, but you don’t need to do that because this sample includes all of the executables in the EnterpriseLibrary2.0Signed folder.
3) Run the following command to create the SSO application for the application blocks in Enterprise Library: DummyApp.xml is in the TestData folder of the SsoConfigurationTest project.
ssomanage –createapps DummyApp.xml


How to test the SSO configuration source:

4) Open EntlibConfig.exe that is the configuration tool for Enterprise Library 2.0, which is included in the EnterpriseLibrary2.0Signed folder.
5) Open DummyApp.config using EntlibConfig.exe. DummyApp.config has a full sample configuration information for Enterprise Library. You can pick up just a few of the application blocks as you need.
6) Create a new Configuration Sources.

7) Remove System Configuration Source, and then add Sso Configuration Source.

8) Set the ApplicationName property to Dummy, and then set the SelectedSource property of the Configuration Source node to SSO Configuration Source.
9) Save it. It will save the configuration information in the file to SSO. (You can also create configuration information from scratch or export the existing configuration data in SSO to an external file.)
Now, you can use Enterprise Library in the BizTalk Server applications like:

Database db = DatabaseFactory.CreateDatabase(“Dummy Connection String1”);
db.ExecuteNonQuery(commandType.Text, “Delete Orders”);

I’m now writing documentation for this sample component, which will be published at end of June. I’m going to update the codes as well until that time. But, if you have any opinions, or feedbacks for this component, please let me know. I’d like to keep updating this component even after it is published.

 

 

Posted by yjhong | 6 Comments
Filed under:

C# sample code for interface injection

I read a great article titled "Inversion of Control Containers and the Dependency Injection pattern" written by Martin Fowler. But, as for me the interface injection pattern was a little confusing. I wrote a sample code in C# based on his article, but the sample doesn’t implement a container. I think it will make it easier to understand the pattern itself.

Posted by yjhong | 3 Comments
Filed under:

5 more BizTalk samples are live in the MSDN Web site.

5 more BizTalk samples are live in the MSDN Web site. I wrote three of them as follows:

1) SSO as Configuration Store
This sample provides an implementation of a sample class and a walkthrough that demonstrates how to use the SSO administrative utility and the SSOApplicationConfig command-line tool.    

2) Atomic Transactions with COM+ Serviced Components in Orchestrations
This sample demonstrates how atomic transactions work in orchestrations.    

3) Using the SQL Adapter with Atomic Transactions in Orchestrations
This sample shows how to use the SQL adapter with atomic transactions to keep databases consistent.     

 In my samples, I used to BizUnit 2006 to make it easy to repro the steps and change the samples. If you have any feedbacks about the samples, please leave a message.

Posted by yjhong | 0 Comments
Filed under:
More Posts Next page »
 
Page view tracker