If you call your .NET application from a batch file…

If you deploy your .NET applications with a batch file, be aware that the way you call your .NET application might affect how it behaves.

The facts are as follows (for our application anyways):

when the application is called using the following line in the batch file:

start C:\Progra~1\ApplicationFolder\Application.exe

the application fails

if you call the application using the windows explorer in the batch file:

explorer C:\Program Files\ApplicationFolder\Application.exe

it works fine but it shows a security warnings that you’re downloading files and that publisher is unknown…Not good for the end user, not good.

If you call the application from a path that doesn’t have white spaces using the start command, it works fine:

start C:\ApplicationFolder\Application.exe

(This option would be good if we didn’t use Program Files for the deployment, but most people do)

and, finally, if you use the start command but take out the DOS path it works!

start ” ” “c:\Program Files\ApplicationFolder\Application.exe”

I checked the assemblies binding errors, the code access security for every assembly in the application, debugged the application, et-cetera without results.

Changing the old DOS path did the trick!!!

Why? I still have to get a hold on this script guy to ask him why :-p

Happy coding!

how to determine the assembly evidence at runtime

I ran into a problem the other day, one of the .NET applications we had deployed started crashing on some screens for no apparent reason. The application worked fine in the development environment and when called from the C drive in the test machine.
We tested for binding problems using the SDK tool fuslogvw.exe, but didn’t see any binding errors. The other SDK tool we tried was the .NET Framework configuration tool MScorcfg.msc, no luck. As the SDK doesn’t ship with the Framework 2.0 we had a trouble to do these tests on every single production machine…let alone that the Configuration tool does not show run-time evidence for a given assembly.
Maybe the enterprise policy had changed for the different zones and this .msi had been pushed without us knowing…
The MScorcfg.msc said otherwise…

This code and extra logs in our application did the trick on determining the evidence passed to the CLR:

private static void LogEvidence()

Zone myZone;
Url myURL;
Hash myHash;
Site mySite;

String strEvidence = “”;

log(” ===================== Assembly Evidence: ========================= “);

foreach (Object myEvidence in System.Reflection.Assembly.GetExecutingAssembly().Evidence)
strEvidence = myEvidence.GetType().ToString();

switch (myEvidence.GetType().ToString())
case “System.Security.Policy.Zone”:
myZone = (Zone)myEvidence;
strEvidence = strEvidence + “: ” + myZone.SecurityZone.ToString();
case “System.Security.Policy.Url”:
myURL = (Url)myEvidence;
strEvidence = strEvidence + “: ” + myURL.Value;
case “System.Security.Policy.Hash”:
myHash = (Hash)myEvidence;
strEvidence = strEvidence + “: ” + BitConverter.ToString(myHash.SHA1);
case “System.Security.Policy.Site”:
mySite = (Site)myEvidence;
strEvidence = strEvidence + “: ” + mySite.Name;


log(” ===================== End of Assembly Evidence: ==================== “);


Yet another complaint on the .NET Framework versioning

It just doesn’t make sense that in order to add up functionality to the 2.0 framework without touching the runtime, yet another framework version is created and deployed in a different folder. It is extremely confusing as to what will be the implications. Let’s say I have an existing 2.0 application and I want to take advantage of the WinFX in order to add/implement workflows. Do I have first to start worrying about how to migrate my current application from 2.0 to 3.0 or the classes we currently use from the 2.0 framework are still valid under the 3.0, amen of the new WinFX additions. Why not just adding a new namespace and new assembly for this piece, if it is dependent on the 2.0 framework but won’t replace it????
Migrating from 1.0 to 1.1 caused some pain, more pain (necessary evil IMHO) to migrate from 1.1 to 2.0. Do we have another migration at sight, or it would be just an add up?
It would be worth to have an article published on MSDN about the cause of this decision.

WinFX 3.0 Renamed .NET Framework 3.0


I found the article on MSDN, it still won’t explain why the versioning convention. As some bloggers have already discussed, having a Framework 3.0 and CLR 2.0 doesn’t make much sense when they precisely state “…because .NET Framework 3.0 is an additive release”
Deploying Microsoft .NET Framework Version 3.0