El TecnoBaúl de Kiquenet

Kiquenet boring stories

Archive for the ‘Herramientas’ Category

WMI Troubleshooting: WMIDiag

Posted by kiquenet en 28 julio 2014

WMI troubleshooting tool, WMIDIAG 2.1.

The WMI Diagnosis Tool is a VBScript based-tool for testing, validating, and analyzing WMI installation/issues. The tool collects data from WMI installations on all Microsoft Operating Systems at any or no service pack level.

WMI Diagnostics 2.1 requires you to have Local Administrator rights as well as Windows Script Host (WSH) enabled.

To download this tool, please click here.

After you download WMIDiag.exe, run it and extract the files to a local folder. If you double-click WMIDiag.vbs, the following message will appear:

clip_image001

If you want to see its activity, then you would run “cscript WMIDiag.vbs” from the command prompt.

WMIDIAG can be run from Windows Explorer, or from the command line. Each time it runs, the WMI Diagnosis Tool creates the following three files in the %TEMP% directory:

  • .LOG file containing all the WMI Diagnosis Tool activity as well as a WMI report at the end
  • .TXT file containing the WMI Diagnosis Tool report
  • .CSV file containing statistics that can be used to measure trends and issues

When the WMI Diagnosis Tool terminates, the ERRORLEVEL environment variable is set to one of the following values:

0 = SUCCESS

  • WSH has a script execution timeout setup (in machine or system environment)
  • Machine reports suspicious improper shutdowns
  • User Account Control (UAC) status is reported (Vista and above)
  • Local account token filter policy is reported (Vista and above)
  • Unexpected binaries in the WBEM folder
  • The Windows Firewall is enabled
  • Some WMI service installed in the machine are dependent on the WMI service (i.e. "SMS Agent)
  • WMI ADAP has a status different than ‘running’
  • Some WMI namespaces require a packet privacy encryption for a successful connection
  • Some WMI permanent subscriptions or timer instructions are configured
  • Some information about registry key configurations for DCOM and/or WMI was reported

1 = ERROR

  • System32 or WBEM folders are not in the PATH
  • WMI system file(s)\ repository is/are missing
  • WMI repository is inconsistent (XP SP2, 2003 SP1 and above)
  • DCOM is disabled
  • WMI service is disabled
  • The RPCSS and/or the WMI service(s) cannot be started
  • WMI DCOM setup issues
  • Expected default trustee or ACE has been removed from a DCOM or WMI security descriptor
  • The ADAP status is not available
  • One or more WMI connections failed
  • Some GET operations\WMI class MOF representations\WMI qualifier retrieval operations failed
  • Some critical WMI ENUMERATION operations\WMI EXECQUERY\WMI GET operations failed
  • Some WRITE operations in the WMI repository\PUT\DELETE operations failed
  • One of the queries of the event log entries for DCOM, WMI and WMIADAPTER failed
  • Some critical registry key configurations for DCOM and/or WMI were reported

2 = WARNING

  • System32 or WBEM folders are further in the PATH string than the maximum system length
  • System drive and/or Drive type reporting are skipped
  • DCOM has an incorrect default authentication level (other than ‘Connect’)
  • DCOM has an incorrect default impersonation level (other than ‘Identify’)
  • WMI service has an invalid host setup
  • WMI service (SCM configuration) has an invalid registry configuration
  • Some WMI components have a DCOM registration issue
  • WMI COM ProgID cannot be instantiated
  • Some WMI providers have a DCOM registration issue
  • Some dynamic WMI classes have a registration issue
  • Some WMI providers are registered in WMI but their registration lacks a CLSID
  • Some WMI providers have a correct CIM/DCOM registration but the corresponding binary file cannot be found
  • A new ACE or Trustee with a denied access has been modified to a default trustee of a DCOM or WMI security descriptor
  • An invalid ACE has been found for an actual DCOM or WMI security descriptor
  • WMI ADAP never ran on the examined system
  • Some WMI non-critical ENUMERATION operations failed\skipped
  • Some WMI non-critical EXECQUERY operations failed\skipped
  • Some non-critical WMI GET VALUE operations failed
  • Some WMI GET VALUE operations were skipped (because of an issue with the WMI provider)
  • The WRITE operations in the WMI repository were not completed
  • The information collection for the DCOM, WMI and WMIADAPTER event log entries was skipped
  • New event log entries for DCOM, WMI and WMIADAPTER were created during the WMI Diagnosis Tool execution
  • Some non-critical registry key configurations for DCOM and/or WMI were reported

3 = Command Line Parameter errors

4 = User Declined (Clicked the Cancel button when getting a consent prompt)

  • WMIDiag is started on an unsupported build or OS version
  • WMIDiag has no Administrative privileges
  • WMIDiag is started in Wow environment (64-bit systems only)

When you run the WMI Diagnosis Tool via command line:

C:\>CSCRIPT WMIDiag.vbs

clip_image003

The generated report “%TEMP%\WMIDIAG-V2.1_WIN7_.CLI.SP1.64_MYPC_2012.02.02_12.53.07-REPORT.TXT“ contains two types of figures:

  • WARNING – Information that is useful if certain actions are executed
  • ERROR – Problems that need to be solved to avoid errors reported by WMI

WMI DIAG 2.1 FAQ:

1. Where can I get the WMI Diagnosis Tool?

The WMI Diagnosis Tool can be downloaded from the Microsoft Download Center at http://www.microsoft.com/download/en/details.aspx?id=7684. More information about the WMI Diagnosis Tool usage can be found in the document (WMIDiag.doc) which comes along with the download.

2. Is it possible to “officially” engage Microsoft for feedback on this tool?

There is no official support for WMI Diagnosis Tool. However, feedback for the tool is welcome and can be sent to WMIDiag@microsoft.com.

3. Can the WMI Diagnosis Tool diagnose a remote computer?

The WMI Diagnosis Tool is not designed to diagnose remote computers. This is due to the fact that WMI remote access is mainly based on the WMI infrastructure. Because the aim of WMI Diagnosis Tool is to diagnose WMI, the WMI Diagnosis Tool does not use WMI to perform its core operations. That’s why the WMI Diagnosis Tool must be run locally. However, the WMI Diagnosis Tool can be deployed remotely using Group Policy, Systems Management Server (SMS), or Microsoft Operations Manager (MOM) via a Management Pack. With Windows Vista, the WMI Diagnosis Tool can also be remotely executed through WinRM/WinRS, provided you configure and enable these features (WinRM/WinRS are not enabled by default). Microsoft SysInternals tool PSEXEC.EXE can also be used.

4. Does the WMI Diagnosis Tool fix problems it discovers?

No. The WMI Diagnosis Tool executes in read-only mode. Even though the WMI Diagnosis Tool diagnoses the situation and provides procedures to fix problems, at no time does the tool automatically fix a problem. This is by design, because the correct repair procedure depends on the context, the usage, and the list of applications installed on the computer.

I hope this new tool will help you identifying potential WMI issues in your environment. Don’t forget to read the support document (WMIDiag.doc) included in the WMIDIAG 2.1 download. Until my next post, take care!

WMI Diagnosis Tool FAQ
http://blogs.msdn.com/b/wmi/archive/2006/05/12/wmi-diagnosis-tool-general-questions.aspx

References:
http://blogs.technet.com/b/askperf/archive/2012/02/03/wmidiag-2-1-is-here.aspx
http://joes-tech-blog.blogspot.com.es/2011/01/fixing-wmidiag-to-run-on-windows-7-and.html

Anuncios

Posted in Herramientas | Etiquetado: , , | Leave a Comment »

Convert DOC (Office 97-2003) to DOCX (Office 2010) programatically or Bulk

Posted by kiquenet en 20 febrero 2014

Option 1) OMPM – Using  Office File Converter (OFC) and Version Extraction Tool

Download Office Migration Planning Manager (OMPM) to the machine that hosts the files.

Office Migration Planning Manager (OMPM): Office Compatibility
The Office Migration Planning Manager (OMPM) 2010 is a group of tools designed to help administrators during the planning and testing phases of a Microsoft Office 2010 or Office 365 deployment.
http://www.microsoft.com/en-us/download/details.aspx?id=11454

The installer extracts all tools and resource files by default to C:\OMPM

If your machine does not have Office 2003 installed, which by now it probably does not, then you will also need to install the Office compatibility pack to convert the files.

Módulo de compatibilidad de Microsoft Office para formatos de archivos de Word, Excel y PowerPoint
http://support.microsoft.com/kb/923505


Once that is installed, open the C:\OMPM\Tools folder that contains tools the Office File Converter (OFC) and Version Extraction Tool (VET)

Using OMPM tools
Use the Office File Converter (OFC) to do bulk conversions of specific Office files that are in version 97 through 2003 file formats to the Office 2010 file formats.
http://technet.microsoft.com/en-us/library/cc179179(v=office.14).aspx

Steps:

Edit OFC.INI file.

For the OFC.exe to work there must be a [FoldersToConvert] entry in the OFC.INI file.

Fldr=C:\OMPM\TOOLS\EXAMPLE FOLDER\ (in this case I put all the files I wanted to convert into the “EXAMPLE FOLDER”)

You can put multiple folders under this folder,


OFC.exe will follow this path a convert all DOC and XLS files into DOCX and XLSX files.

It will leave the old DOC file in the folder and create the new DOCX file right alongside.

The date created field will NOT change for the new DOCX or XLSX files


All the new files will be created in the appropriate folder, even if there are multiple layers of folders under the original location

In this case, the SourcePathTemplate and the DestinationPathTemplate listings in the OFC.INI file are just:

SourcePathTemplate=*\*\*\*\

DestinationPathTemplate=*1\*2\*3\*4\


Option 2) PowerShell

Requires Office 2010 installed

The main:

$CompatMode = [Enum]::Parse([Microsoft.Office.Interop.Word.WdCompatibilityMode], "wdWord2010")
$saveFormat = [Enum]::Parse([Microsoft.Office.Interop.Word.WdSaveFormat],"wdFormatDocumentDefault");

Clear-Host
$word = new-object -comobject word.application
$word.Visible = $False

Get-ChildItem -path $folderpath -recurse -include $fileType | % {

    SaveDocumentWithCompatibilityMode $word $_
    ConvertDocument $word $_
}

#Clean up
$word.quit()
$rc = [System.Runtime.Interopservices.Marshal]::ReleaseComObject($word)
$word = $null
[gc]::collect()
[gc]::WaitForPendingFinalizers()

Save Document with Compatibility

Function SaveDocumentWithCompatibilityMode($word, $document)
{
    $opendoc = $word.documents.open($document.FullName)
    $savename = ($document.Fullname).substring(0,($document.FullName).lastindexOf("."))
   
    $savename = $savename + "_test1.docx"
   
    $opendoc.saveas([ref]"$savename", [ref]$saveFormat);
    $opendoc.close();
    
    $converteddoc = Get-ChildItem -Path $savename
    $opendoc = $word.documents.open($converteddoc.FullName)
    $opendoc.SetCompatibilityMode($CompatMode);
    $opendoc.save()
    $opendoc.close()
}


I prefer Convert Document

Function ConvertDocument($word, $document)
{
    $opendoc = $word.documents.open($document.FullName)
    #$opendoc = $word.documents.open($document.FullName,$false,$true);
   
    $savename = ($document.fullname).substring(0,($document.FullName).lastindexOf("."))
    $savename = $savename + "_test2.docx"
    
    $opendoc.Convert()
    $opendoc.saveas([ref]"$savename", [ref]$saveFormat);
    $opendoc.close();
   
   
    # Stop Winword Process
    #$opendoc.quit()
    #$rc = [System.Runtime.Interopservices.Marshal]::ReleaseComObject($opendoc)
       
}

Referencias:
http://mongell.blogspot.com.es/2013/11/using-ompm-or-how-to-bulk-convert-pre.html

http://mykbit.blogspot.com.es/2011/10/bulk-convert-office-972003-files-to.html

http://blogs.msdn.com/b/ericwhite/archive/2008/09/19/bulk-convert-doc-to-docx.aspx

http://social.msdn.microsoft.com/Forums/sharepoint/en-US/04718fc5-ab83-45d9-a413-e3cd9d18926f/how-to-convert-doc-files-to-docx-in-a-sharepoint-library-programmatically?forum=sharepointdevelopmentprevious

http://row5is.wordpress.com/2012/07/06/convert-doc-to-docx-using-powershell/

http://stackoverflow.com/questions/16534292/basic-powershell-batch-convert-word-docx-to-pdf

http://blogs.technet.com/b/heyscriptingguy/archive/2010/06/22/hey-scripting-guy-how-can-i-use-windows-powershell-2-0-to-convert-doc-files-to-docx-files.aspx

Posted in Herramientas, Productividad, Scripts | Etiquetado: , , , , | Leave a Comment »

Despertadores Online

Posted by kiquenet en 8 abril 2013

Las siguientes 7 herramientas servirán como despertadores online gratuitos con diferentes opciones.

Algunos nos permiten configurar una canción para que suene, otros para que se reproduzca un video, etc.

Despertadores online

  1. Kuku Klok
  2. Online Alarm Clock
  3. MetaClock
  4. Online Video Clock
  5. Sleep.FM
  6. AlarmTube

http://www.140geek.com/7-servicios-online-para-que-uses-como-despertador/6877/

Posted in Herramientas | Etiquetado: , | Leave a Comment »

Limpiar Windows Installer correctamente

Posted by kiquenet en 24 octubre 2012

En algunas situaciones la carpeta %SYSTEMDRIVE%\Windows\Installer puede llegar a ocupar varios GBs, lo cual pueder mermar el espacio libre en la partición C: de sistema.

Nota: Con herramientas como WinDirStat podemos ver la ocupación en disco de todas las carpetas.

El borrado manual de dicha carpeta puede tener efectos indeseados, pues implica a instalables MSI de los productos instalados en el sistema.

En todo caso, una posible solución es utilizar Windows Installer Cleanup Utility

Nota: Dicha utilidad ya no está soportada por Microsoft.
Se puede encontrar en http://www.majorgeeks.com/files/details/windows_installer_cleanup_utility.html

Después de instalar la herramienta en

C:\Archivos de programa\Windows Installer Clean Up

Ejecutar vía consola cmd:

C:\Program Files\Windows Installer Clean Up\msizap G!

La herramienta gráfica es:
msicuu.exe

http://blogs.msdn.com/b/heaths/archive/2007/01/31/how-to-safely-delete-orphaned-patches.aspx

Posted in Herramientas, Windows | Leave a Comment »

Paint.NET Portable using IExpress

Posted by kiquenet en 16 agosto 2012

a useful tool for compressing these files into a self-extracting executable, and it has shipped with Windows for quite some time: iexpress.exe.

Its purpose is to extract files and run a setup application, but nothing precludes it from running another application such asPaint.NET.exe. Run iexpress.exe which starts a simple wizard. The most important steps to remember are to have it executePaint.NET.exe, and to store the files using long names. The latter step will prevent the package from running on Windows 95, but the .NET Framework 2.0 which at least Paint.NET v2.62 requires isn’t supported on Windows 95 anyway.

The result was a 595 KB executable. It quickly extracts the files to a sub-directory under %TMP% and runs Paint.NET.exe. When you close Paint.NET.exe the temporary files are cleaned-up. Sure, better compression rates are likely possible using different tools but this is a good start to compress Paint.NET even more without adding extra steps to start the application.


http://hstewart.members.winisp.net/downloads/paint.net.exe

Reference:
http://blogs.msdn.com/b/heaths/archive/2006/05/11/595674.aspx

Posted in Herramientas | Leave a Comment »

Decompilar un .MSI con WiX

Posted by kiquenet en 29 junio 2011

If you have built an MSI and need to verify the contents to ensure that your automated build is functioning correctly and you have WiX installed, simply open up a Command Shell and tap out the following:

%WiXDir%\dark.exe -x c:\%OutPutDir% MyInstaller.msi c:\%OutPutDir%\MyInstaller.wxs

where %WiXDir% is the path to your WiX install directory and %OutPutDir% is the path you want to dump the contents to.

Fuente:
http://consultingblogs.emc.com/howardvanrooijen/archive/2006/06/14/DecompileAnMSIFileUsingWiX.aspx

http://wix.codeplex.com/

Posted in .NET, Herramientas | Leave a Comment »

FUSLOGVW, Assembly Binding Log Viewer

Posted by kiquenet en 16 febrero 2011

ASSEMBLY PROBING, FUSION AND FUSLOGVW IN 5 MINUTES

Introduction

A couple of days ago I received the following mail:

Hi Bart,
I’m trying to add an install functionally that will just basically copy the whole CD content to a local C drive folder. Executing the launcher.exe in that local folder works fine but if I create a desktop shortcut that targets the launcher.exe produced a file not found error for cassinilight.dll. I was wondering if you have an idea in what location was the application looking for cassinilight.dll.  Any help is highly appreciated.

The short answer is really short: probing. Probing is the technique employed by the CLR’s assembly loader to find a dependent assembly based on searching for it in various folders. Strongly named assemblies (those you signed using an sn.exe generated public/private key pair) are being searched for in the GAC (and paths specified in codeBase configuration elements, see further; and the "standard locations"). Weakly named assemblies are also probed, by looking in the same folder as the application and in subfolders named after the dependent assemblies themselves. However, sometimes it’s not that easy and you really want to see what’s going on (a common problem is an assembly being loaded from the GAC while you have recompiled it to your bin\Debug folder in Visual Studio which leads to unexpected debugging results).

In this post, I’m showing you how to make a jumpstart with Fusion, assembly probing and the "Fusion log viewer" aka fuslogvw.exe. For the record, Fusion is the codename of the assembly loader component of the CLR which (you can still see this in the SSCLI source tree under sscli20\clr\src\fusion).

A faulty application

Right, let’s create a plain simple demo to illustrate the principle. It’s so simple it fits in one console window using "copy con" file generation:

The code is:

foo.cs (compile using csc /t:library foo.cs)
public class Foo
{
}

bar.cs (compile using csc /t:library /r:foo.dll bar.cs)
class Bar
{
   public static void Main()
   {
      new Foo();
   }
}

Now you should have two assemblies: foo.dll and bar.exe. Run the application, it should just run (although it doesn’t do anything useful, it doesn’t produce any errors either).

Time has come to make the app faulty. Create a subfolder called "oops" and move the foo.dll file to it. Now bar.exe will fail:

And guess what, you shouldn’t even read my blog to find out what’s wrong. The runtime is so kind to tell you to enable Fusion:

To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.

Setting up Fusion

Redundant info maybe, but here are two ways to enable Fusion.

For modern developers – PowerShell

PS C:\Users\Bart> new-itemproperty -path HKLM:\SOFTWARE\Microsoft\Fusion -n EnableLog -t Dword -va 1

PSPath       : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\               Microsoft\Fusion
PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\               Microsoft
PSChildName  : Fusion
PSDrive      : HKLM
PSProvider   : Microsoft.PowerShell.Core\Registry
EnableLog    : 1

For command-line freaks – reg.exe

C:\temp>reg add HKLM\Software\Microsoft\Fusion /v EnableLog /t REG_DWORD /d 1
The operation completed successfully.

For UI lovers – regedit.exe

You should be able to find out yourself :-).

Analyzing the problem

Run bar.exe again after you’ve enabled Fusion. This time you get a realm of information:

The most interesting portion is the last part:

LOG: Attempting download of new URL file:///C:/temp/foo.DLL.
LOG: Attempting download of new URL file:///C:/temp/foo/foo.DLL.
LOG: Attempting download of new URL file:///C:/temp/foo.EXE.
LOG: Attempting download of new URL file:///C:/temp/foo/foo.EXE.

These are the locations where the system attempted to find the referenced assembly "foo". The "oops" folder isn’t there obviously, so the probing operation fails.

Now run fuslogvw.exe and you should see the following log information:

If you double-click on the last line, you’ll see the following in a browser window:

*** Assembly Binder Log Entry  (12/10/2006 @ 12:16:56) ***
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable  C:\temp\bar.exe
— A detailed error log follows.
=== Pre-bind state information ===
LOG: User = Bart-PC\Bart
LOG: DisplayName = foo, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///C:/temp/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = bar.exe
Calling assembly : bar, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/temp/foo.DLL.
LOG: Attempting download of new URL file:///C:/temp/foo/foo.DLL.
LOG: Attempting download of new URL file:///C:/temp/foo.EXE.
LOG: Attempting download of new URL file:///C:/temp/foo/foo.EXE.
LOG: All probing URLs attempted and failed.

Since there’s no application configuration file to specify probing locations, the default probing process is used, effectively looking in the same folder as the application (seeAppbase) and in a subfolder with the assembly name (without the extension, i.e. Appbase\AssemblyName, in our example c:\temp\foo). All logs end up in the IE temporary files cache, but you can override this in fuslogvw (or by setting registry entries):

where "c:\temp" is set in the LogPath REG_SZ value in the Fusion registry key. The logging info will end up in a subfolder called "NativeImage":

Setting a custom probing path

You can drive the probing mechanism by specifying probing paths in a configuration file. So create the following bar.exe.config file in the bar.exe folder (c:\temp on my system):

<?xml version="1.0"?>
<configuration>
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <probing privatePath="oops" />
      </assemblyBinding>
   </runtime>
</configuration>

Now bar.exe works fine again:

If you configure Fusion to log all binds to disk, like this:

you’ll see log entries appear after re-running the bar.exe applicatin again:

This time with the following logging info:

*** Assembly Binder Log Entry  (12/10/2006 @ 13:01:05) ***
The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.
Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable  C:\temp\bar.exe
— A detailed error log follows.
=== Pre-bind state information ===
LOG: User = Bart-PC\Bart
LOG: DisplayName = foo, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///C:/temp/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = bar.exe
Calling assembly : bar, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Private path hint found in configuration file: oops.
LOG: Using application configuration file: C:\temp\bar.exe.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/temp/foo.DLL.
LOG: Attempting download of new URL file:///C:/temp/foo/foo.DLL.
LOG: Attempting download of new URL file:///C:/temp/oops/foo.DLL.

LOG: Assembly download was successful. Attempting setup of file: C:\temp\oops\foo.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: foo, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
LOG: Binding succeeds. Returns assembly from C:\temp\oops\foo.dll.
LOG: Assembly is loaded in default load context.

As you can see, the oops path is being probed and the assembly is found thanks to our "private path hint" in the configuration file.

Conclusion

Once the FileNotFoundExceptin might have been your worst nightmare (actually MissingMethodException should deserve that spot) but when things get bad, Fusion comes to the rescue. Happy probing!

Enable Fusion Assembly Binding Logging

The WRN: Assembly binding logging is turned off message is annoying but assembly binding logging can be extremely helpful when you need to know how .NET is (or isn’t) locating the assemblies you’ve referenced. The message is annoying because, if you’re like me, you never have logging enabled and the registry key cited is a bit unusual:

To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.

What does the exclamation mark mean? Presumably EnableLog is a DWORD in the Fusion key but it’s all a bit unclear for my liking. Once you’ve set this DWORD, you need to figure out what to do next and for many people that will likely involve firing up the Fusion Log Viewerfuslogvw.exe or the Windows/.NET SDK. But then what?

Gary Kindel was kind enough to post the following details in response to a related Stack Overflow question:

Add the following values to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion
DWORD ForceLog set value to 1
DWORD LogFailures set value to 1
DWORD LogResourceBinds set value to 1
String LogPath set value to folder for logs ie) C:\FusionLog\

Make sure you include the backslash after the folder name. I also found an IISRESET was necessary in a web context.

Since I wanted to enable this logging in an environment without Visual Studio or the Windows SDK installed, the above option was clean and lightweight. Log files were dumped to the expected location in .html format and it was then a case of locating the assembly I was interested in… and, oh yeah, fixing the problem 😉 The issue was also detailed in the ASP.NET error message returned by IIS.

Advanced geeks: because Fusion logging supposedly affects performance, you might want to create a reg file/batch script to toggle logging on and off. Here’s a starting point—put this into a file called EnableFusionLogging.reg and double-click to run it:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion]
"ForceLog"=dword:00000001
"LogFailures"=dword:00000001
"LogResourceBinds"=dword:00000001
"LogPath"="C:\\Temp\\FusionLog\\"

I actually call this from a batch script which also resets IIS and I have a mirror reg file that disables logging.

http://community.bartdesmet.net/blogs/bart/archive/2006/10/23/Assembly-probing_2C00_-Fusion-and-fuslogvw-in-5-minutes.aspx

http://blog.mediawhole.com/2010/08/enable-fusion-assembly-binding-logging.html

http://stackoverflow.com/questions/255669/how-to-enable-assembly-bind-failure-logging-fusion-in-net/1527249#1527249

Posted in .NET, Herramientas | Etiquetado: | Leave a Comment »