Proposed Error MSB3073 exited with code 3

  • Wednesday, December 07, 2011 6:08 PM
     
     

    I have converted a project from VC++ 6.0 to VC++ 2010, and these are the steps I went through when I compiled the project:

    • Clean Solution
    • Rebuild Solution or
    • Build Solution (The 1st time)

    Here is the error I get when I follow those steps above:

    error MSB3073: The command "regsvr32 /s /c "C:\SourceControl\MyProject\.\Debug\MyProject.dll"
    echo regsvr32 exec. time > ".\Debug\regsvr32.trg"
    echo Execute mtxrereg.exe before using MTS components in MTS

    :VCEnd" exited with code 3. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets 183 6

    However,  immediately after getting that error where I do just a “Build Solution” ONLY I get Build succeeded

    Under Project > Properties > Configuration Properties > Custom Build Step I have Command Line:

    regsvr32 /s /c "$(TargetPath)"
    echo regsvr32 exec. time > "$(OutDir)regsvr32.trg"
    echo Execute mtxrereg.exe before using MTS components in MTS

    Does anyone know why this happens and how I can resolve it?

    NOTE:  I do have VS 2010 set to “Run As Administrator”

    Thanks,

All Replies

  • Friday, December 09, 2011 6:52 AM
    Moderator
     
     
    Hi SAL,
     
    Thanks for your post in the MSDN Forum.
     
    Based my experience and analysis into this issue, I think there some possible reasons for this issue. For example, perhaps the DLL has already been registered successfully, maybe you have not got enough power to register it, and there may be some issues with the codes, etc. At present I am not able to decide which one is the root cause unfortunately.
     
    I suggest you try registering the DLL in command line. Please pay attention that you should run CMD as administrator. If this doesn't work, please post the error messages here and feel free to let us know. We'll continue working with you on this issue.
     
    Best regards,
    Helen

    Helen Zhao [MSFT]
    MSDN Community Support | Feedback to us
  • Friday, December 09, 2011 2:27 PM
     
     

    Hi Helen,

    Thanks for the suggestion.  My apologies I should have stated that I have admin rights on my workstation and I have been able to register various DLL’s before.  I even took the extra step to pin my CMD to the task bar with “Run As Administrator” set under Shortcut > Advanced.  With my Visual Studio 2010 I have done the same thing but I’ve also set “Run this program as an administrator” under the Compatibility tab as well.

    Just to recap my steps I did the following:

    • Clean Solution
    • Build Solution (The 1st time)

    I still get error MSB3073, but before I do just a Build ONLY I checked MyProject\Debug folder and it produced the following files:

    • MyProject.dll.intermediate.manifest
    • MyProject.dll.embed.manifest.res
    • MyProject.dll.embed.manifest
    • MyProject_manifest.rc

    NOTE: Under Project > Properties > Configuration Properties > Linker > General I have “Output File” putting MyProject.DLL in a different location (i.e. C:\Share\MyProject\Bin). So, MyProject.DLL is also created.  All 5 files have the same Datetime stamp.

    When I do a Build ONLY  the second time (NO Clean Solution or Rebuild Solution) it says Build succeeded.  So, I do not know what Build does differently the second time that it didn’t do the first time when it fails.

    NOTE: Rebuild ONLY produces error MSB3073 every time.

    Does having the Output file pointing to a different location make any difference?  I assume not since it compiled both times. 

    Keep in mind that this was upgraded from VC++ 6.0 to 2010 so this was part of the original settings:

    regsvr32 /s /c "$(TargetPath)"
    echo regsvr32 exec. time > "$(OutDir)regsvr32.trg"
    echo Execute mtxrereg.exe before using MTS components in MTS

    VC++ 6 have it under Project > Settings… > Custom Build tab, and VC++ 2010 puts it under Project > Properties > Configuration Properties > Custom Build Step

     

  • Tuesday, December 13, 2011 9:45 AM
    Moderator
     
     

    Hi SAL,
     
    Generally speaking, it is not easy to convert a project from VC++ 6.0 to VS2010. As in this case, we should make sure that the DLL has been built before the registration. In your project's Property Pages->Configuration Properties->Build Events->Post-Build Event->Command Line, type in the command you want to execute: "regsvr32 /s /c "C:\SourceControl\MyProject\.\Debug\MyProject.dll".
     
    Then, I suggest you try to get a more detailed build log. From Tools->Options->Projects and Solutions->Build and Run, select Detailed or Diagnostic option under "MSBuild project build log file verbosity". Please try to find out more information about the build step from the log file and try some methods to fix the issue.
     
    I hope this is helpful for you to solve the issue.
    Best regards,


    Helen Zhao [MSFT]
    MSDN Community Support | Feedback to us

  • Friday, December 16, 2011 1:03 PM
     
     

    Hi Helen,

    Yes your tips have been useful.  I know this is a difficult upgrade process but the goal in 2012 is to convert/rewrite the C++ project to C# anyways.  I thought it would be easier to upgrade the C++ first to 2010 then rewrite it.  I know VB.net, C# and ASP.net, but I know nothing about C++ which makes my task that much harder.

    Thanks,

    Sal

  • Monday, December 19, 2011 2:44 AM
    Moderator
     
     

    Hi SAL,

    I'd like  to mark my reply as answer. If you have any questions, you can post back an unmark it. We'll continue working with you on this issue.

    Thanks for your understanding.
    Helen


    Helen Zhao [MSFT]
    MSDN Community Support | Feedback to us
  • Wednesday, December 28, 2011 7:40 PM
     
     Proposed

    Hi Helen,

    The issue that causes "Error MSB3073 exited with code 3" happens to be with the VALUE in the Outputs property under Project > Properties > Configuration Properties > Custom Build Step.

    When I choose Edit for Outputs, a dialog box comes up.  I enter a value of "$(OutDir)\regsvr32.trg" in the upper textbox then click OK.  Now for some reason VS 2010 changes the display text to show "$(OutDir)\regsvr32.trg;%(Outputs)".  I'm not sure why or if that is the cause of the problem.

    However, I will get "Build Successful" if I change my Output value to "<inherit from parent or project defaults>" instead of choosing Edit and putting a value in.  No more Error MSB3073 exited with code 3.

    I guess I can say this issue is resolved but I'd like to know why/what causes this issue to begin with.

    Sal

  • Thursday, December 29, 2011 2:01 AM
    Moderator
     
     

    Hi Sal,

    According to your last reply, I think the error may be caused by the wrong path. That is, perhaps the path of the DLL was not set properly when being registered.

    I think you can try to find out the path of DLL in the log file, which will be generated if you select Detailed or Diagnostic option. please make sure that the DLL is actually in $(OutDir).

    Best regards,

    Helen


    Helen Zhao [MSFT]
    MSDN Community Support | Feedback to us
  • Wednesday, May 09, 2012 6:39 AM
     
     

    I found Visual Studio's build result isn't steady, i.e. output file's size.

    Perhaps the first time, you build a project, then register output file successfully. However, the following times, you'll fail to register it, because the file has changed to another size!

    I compared the different files, and found embedded manifest fragment in the original one.

    In project's property sheet, linker/general page, some items may interact internally.

    At last, if you disable incremental linking, you can register successfully.