locked
Cannot run Publicize.exe tool on Assembly RRS feed

  • Question

  • I am trying to run a unit test on an assembly, but I cannot build the unit test library because the Publicize.exe tool is failing to publicize the assembly I'm trying to test.

    Invoking the following command on the command line fails:

    Publicize C:\Users\***\Code\***.Modules.Geometry\bin\Debug\***.Modules.Geometry.dll

    Specifically, it fails with a FileNotFoundException: "Could not load file or assembly '***.Modules.Geometry, Version=1.0.0.0, Culture=netural, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified." The libraries referenced by the DLL I'm trying to publicize have not changed.

    Other assemblies can be publicized without a problem. Here's the Fusion Log for the assembly that cannot be publicized:

    *** Assembly Binder Log Entry  (1/22/2013 @ 11:31:56 AM) ***
    
    The operation failed.
    Bind result: hr = 0x80070002. The system cannot find the file specified.
    
    Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
    Running under executable  c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Publicize.exe
    --- A detailed error log follows. 
    
    === Pre-bind state information ===
    LOG: User = ***
    LOG: DisplayName = ***.Modules.Geometry, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
     (Fully-specified)
    LOG: Appbase = file:///c:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/
    LOG: Initial PrivatePath = NULL
    LOG: Dynamic Base = NULL
    LOG: Cache Base = NULL
    LOG: AppName = Publicize.exe
    Calling assembly : (Unknown).
    ===
    LOG: This bind starts in default load context.
    LOG: No application configuration file found.
    LOG: Using host configuration file: 
    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\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:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/***.Geometry.DLL.
    LOG: Attempting download of new URL file:///c:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/***.Modules.Geometry/***.Modules.Geometry.DLL.
    LOG: Attempting download of new URL file:///c:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/***.Modules.Geometry.EXE.
    LOG: Attempting download of new URL file:///c:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/***.Modules.Geometry/***.Modules.Geometry.EXE.
    LOG: All probing URLs attempted and failed.

    And here's the Fusion Log for another assembly that was successfully publicized:

    *** Assembly Binder Log Entry  (1/22/2013 @ 11:31:29 AM) ***
    
    The operation was successful.
    Bind result: hr = 0x0. The operation completed successfully.
    
    Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
    Running under executable  c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Publicize.exe
    --- A detailed error log follows. 
    
    === Pre-bind state information ===
    LOG: User = ICF-HQ\25029
    LOG: Where-ref bind. Location = C:\Users\***\Code\***.Modules.Authorization\bin\Debug\***.Modules.Authorization.dll
    LOG: Appbase = file:///C:/Users/***/Code/***.Modules.Authorization/bin/Debug
    LOG: Initial PrivatePath = NULL
    LOG: Dynamic Base = NULL
    LOG: Cache Base = NULL
    LOG: AppName = Publicize.exe
    Calling assembly : (Unknown).
    ===
    LOG: This is an inspection only bind.
    LOG: No application configuration file found.
    LOG: Using host configuration file: 
    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
    LOG: Attempting download of new URL file:///C:/Users/***/Code/***.Modules.Authorization/bin/Debug/***.Modules.Authorization.dll.
    LOG: Assembly download was successful. Attempting setup of file: C:\Users\25029\Code\Edt\Client\Modules\***.Modules.Authorization\bin\Debug\***.Modules.Authorization.dll
    LOG: Entering run-from-source setup phase.
    LOG: Assembly Name is: ***.Modules.Authorization, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
    LOG: Binding succeeds. Returns assembly from C:\Users\***\Code\***.Modules.Authorization\bin\Debug\***.Modules.Authorization.dll.



    Tuesday, January 22, 2013 8:06 PM

All replies

  • Hello Karl,

    Thank you for your post.

    Do you mean that you can’t build the unit test project because the assembly “Modules.Geometry” can’t be found after you use Publicize.exe to create private accessor to the unit test project?

    If yes, I suggest that you can directly create a private accessor from VS IDE through right click the private method in the assembly and select create a private accessor. I think that it is a easier way to create a private accessor.

    The libraries referenced by the DLL I'm trying to publicize have not changed.

    I would like to know if the Modules.Geometry assembly references other assembly. If yes, please check those assemblies and make sure their ‘Copy Local’ property is ‘True’.

    In still no help, please clarify your project scenario in details so that we can further look at this issue.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, January 23, 2013 6:16 AM
  • Do you mean that you can’t build the unit test project because the assembly “Modules.Geometry” can’t be found after you use Publicize.exe to create private accessor to the unit test project?

    No, that is not what I meant at all. Invoking the following command on the command line fails:

    Publicize C:\Users\***\Code\***.Modules.Geometry\bin\Debug\***.Modules.Geometry.dll

    The DLL I'm trying to publicize is still in the folder, before and after invoking the Publicize command. Nevertheless, the Publicize command throws a FileNotFoundException.


    Wednesday, January 23, 2013 6:53 PM
  • All assemblies were already copy local. None of the references or settings changed, it's just that the unit test suddenly stopped building due to the failure of Publicize.exe.
    Wednesday, January 23, 2013 7:01 PM
  • Hello Karl,

    Sorry for misunderstanding you.

    I suggest that you should check the assembly’s path. I noticed that in command line, the assembly path is C:\Users\***\Code\***.Modules.Geometry\bin\Debug\***.Modules.Geometry

    But in Fusion Log, you define the Appbase: c:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE, and ithe assembly seems to be downloaded from c:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE ***.Modules.Geometry/***.Modules.Geometry.DLL.

    And for another assembly, the Appbase is file:///C:/Users/***/Code/***.Modules.Authorization/bin/Debug. And downloaded from file:///C:/Users/***/Code/***.Modules.Authorization

    I would like to know where the Modules.Geometry assembly is. As my understanding, it it is in bin\Debug folder, should the Appbase be file:///C:/Users/***/Code/***.Modules.Geometry /bin/Debug.

    If still no help, I suggest that you can add the assembly to the GAC manually to check the result. Also you can try the same scenario on another machine. Maybe the issue is related to your test environment.

    In addition, I do a research and find a thread with the similar issue:

    http://social.msdn.microsoft.com/Forums/sa/windowssdk/thread/c0fa646e-c6c4-4538-b70d-01d968b7a0c1

    You can try Jialiang’s suggestion to use process monitor to troubleshoot this kind of binding issues. Process Monitor (http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx) is able to trace the file access actions of your process. You can see how your process searches for your assmebly in the procmon log.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, January 24, 2013 2:57 AM
  • You hit the nail on the head. Both the authorization and the geometry modules reside in my standard code folder. I have invoked publicize on the DLLs for both modules in the bin/Debug directory of their respective projects. Publicize uses the bin/Debug directory as the AppBase for the authorization module, but when invoked on the geometry module it completely ignores the file path I specified and tries to use the Visual Studio/Common7/IDE path as the AppBase instead.

    I have tried using the process monitor, but it did not elucidate the problem. According to the process monitor, publicize.exe never even bothered looking in the bin/Debug directory of the geometry module project.

    Thursday, January 24, 2013 7:20 PM
  • Hello Karl,

    If the geometry module is actually in the bin\Debug folder but Publicize.exe search it from Common7\IDE folder rather than bin\Debug, how about you copy the geometry module’s DLL into IDE?

     And I suggest that you re-create a geometry module project and then publicize its DLL to check if it can help. Sometimes corrupted project settings can cause problems.

    Also if you have other environment, you can try your scenario on another machine to check if you still get this issue. Maybe the issue is related to test environment.

    In addition, you could locate to the IDE folder then run these commands to check if they are helpful.

    C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE

    Devenv.exe /SafeMode: Launches the IDE in safe mode loading minimal windows.

    Devenv.exe /ResetSettings: Restores the IDE's default settings, optionally resets to the specified VSSettings file.

    Devenv.exe /ResetAddin: Removes commands and command UI associated with the specified Add-in.

    Devenv.exe /ResetSkipPkgs: Clears all SkipLoading tags added to VSPackages.

     Hope it can help you.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, January 25, 2013 1:19 AM
  • If the geometry module is actually in the bin\Debug folder but Publicize.exe search it from Common7\IDE folder rather than bin\Debug, how about you copy the geometry module’s DLL into IDE?

    This idea would work were I just trying to invoke the Publicize.exe command, but it's not a long term solution for building and running the unit tests automatically in Visual Studio.

    When the unit tests are run on the build server (as opposed to my workstation) I encounter the same problem.

    I have tried creating a new Visual Studio project from scratch, but that does not eliminate the problem.

    Friday, January 25, 2013 8:11 PM
  • Hello Karl,

    I doubt if there are anything wrong with the DLL itself. I would like to know if you create the DLL project under .NET Framework 4. If no, maybe it can affect the publicizing.

    And as far as I know publicize tool does not support delegates or events.

    For more information, see: Using Publicize to Create a Private Accessor

    Whether or not you have private or internal delegates and events in the DLL project?

    In addition, if you don’t specify the dll path in command line for example Publicize.exe myassembly.dll, will you get the same result?

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    • Edited by Amanda Zhu Tuesday, January 29, 2013 1:51 AM
    Monday, January 28, 2013 5:39 AM
  • Yes, the project is in .NET 4. There are classes that have events, but that didn't stop it from publicizing before. For example, there is are several view model classes that expose the PropertyChanged event. Before I started encountering these problems, publicize would create an accessor class for these view models that did not expose a PropertyChanged event but still exposed all the properties.

    Here's what happens if I don't specify a path:

    C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>publicize Icfi.Ecosystems
    .Edt.Modules.Geometry.dll
    Assembly Icfi.Ecosystems.Edt.Modules.Geometry.dll cannot be found.
    ...
    C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>cd C:\Users\***\Modules\***.Modules.Geometry\bin\Debug
    C:\Users\***\Modules\***.Modules.Geometry\bin\
    Debug>publicize ***.Modules.Geometry.dll
    Unhandled Exception: System.IO.FileNotFoundException: Could not load file or ass
    embly '***.Modules.Geometry, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file
    specified.
    ...

    Monday, January 28, 2013 6:40 PM
  • Hello Karl,

    Since private/internal delegates and events within an assembly actually are a restriction for using Publicize tool to provide access for this assembly, as my personal point of view even though you have some classes in the assembly that don’t expose a PropertyChanged event, maybe some issue still will occur and affect the publicizing result. I suggest that you don’t publicize an assembly having private or internal delegates or events in order to publicize an assembly successfully.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, January 29, 2013 1:51 AM
  • I really, really doubt that the PropertyChanged event is the problem. I have been able to build unit tests on this assembly for months without any trouble. Besides, there are no private or internal events, only public cones.
    Wednesday, January 30, 2013 2:01 AM
  • Hello Karl,

    I suggest that you create a new project which is similar to the Modules.Geometry but it has no PropertyChanged event. Then you use Publicize tool to publicize the dll file to check if the issue is related to PropertyChanged event.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, January 30, 2013 6:25 AM
  • Sorry, that did not work. The new project still won't publicize.
    Wednesday, January 30, 2013 5:38 PM
  • Hello Karl,

    If still no help, I’m afraid that I don’t have other good idea about this issue,
    but you could submit this feedback to Microsoft Connect feedback portal:
    http://connect.microsoft.com,
    Microsoft engineers will evaluate them seriously. Thanks for your understanding.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    • Edited by Amanda Zhu Thursday, January 31, 2013 12:57 AM
    Thursday, January 31, 2013 12:56 AM
  • Have the similar issue. But I managed to locate its reason-  my assembly has an Interface having a method with a parameter of type System.Action.

    Probably it is described in http://msdn.microsoft.com/en-us/library/bb514191(v=vs.90).aspx  (Publicize Does Not Support Delegates or Events)

    But the error that tool returned is completely unclear and wrong! 

    --

    Further finding:
    So I have a situation when the assembly declaring Interface with System.Action argument references System.dll of version v2.0.50727.
    But the assembly with the class implementing the interface references System.dll of version v4.0.30319. Of course the .Net framework versions are different (3.5 and 4)

    Publicize is called for the assembly implementing the interface. 
    Path to the tool: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Publicize.exe


    • Edited by Ivan Gorbliuk Tuesday, March 12, 2013 2:36 PM post update
    Tuesday, March 12, 2013 11:11 AM