Monday, March 20, 2006

.Net Framework Applications Writing to the Windows Root Directory (Part II)

As I expected, Microsoft had the answer for this one right away. In fact it was so simple I can't believe it didn't occur to me. I suppose it's an aspect of .Net that you take for granted these days: The temp directory in question is created by the JIT compiler while it's compiling the native image from the MSIL executable. It can't assume that the codebase directory is available for that since you could be running off of a CD or a read only network share. Although, I think %TEMP% would have been a better choice of location. In any case, they recommended that we try using NGen.exe to pre-compile the Winform apps we're deploying to Citrix.

That worked at first. Until I started playing around. I tried the debug switch, and I tried precompiling release and debug versions side-by-side. At some point I seem to have broken something on my machine. I am still seeing NGen store files under Assembly/NativeImages, and it appears from Fusion Viewer that they're loading from there, but FileMon is showing the temporary folder being used again. I've tried NGen /delete, and messed around with renaming/relocating the files, but no luck. Looks like we're going to have to find a solution that involves moving that temporary compilation folder.

Here's the Fusion Log Output when the native image is found. If you don't NGen the Exe, Fusion Log shows nothing.


*** Assembly Binder Log Entry (3/20/2006 @ 3:07:00 PM) ***

The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.

Assembly manager loaded from: C:\WINNT\Microsoft.NET\Framework\v1.1.4322\fusion.dll
Running under executable C:\Data\Experiments\ConsoleTest\bin\Release\ConsoleTest.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: DisplayName = ConsoleTest, Version=1.0.2270.26987, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = C:\Data\Experiments\ConsoleTest\bin\ReleaseLOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : (Unknown).
===

LOG: Not processing DEVPATH because this is a pre-jit assembly bind.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Post-policy reference: ConsoleTest, Version=1.0.2270.26987, Culture=neutral, PublicKeyToken=null
LOG: Found assembly by looking in the cache.


File Under: Technology,

No comments:

Post a Comment