VC++ Migration from VS2010 to VS2019 Error

Chandra Sekhar K 40 Reputation points
2023-03-20T19:59:27.0933333+00:00

Hi,

While doing migration of VC++ solution/project (windows service) from VS2010 to VS2019, getting below error which stopping library project in building (compilation).

While building (compiling) library project, below are errors are coming.

errno 2 trying to open file <..>. It is coming in <..msgs>.mc file which has message information.

Error    MSB8066    Custom build for 'asrmsgs.mc' exited with code 1.    asrmsgs    C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets    241

-- Here are the project properties. Visual Studion 2013 is the before migration "Platform Toolset".

Configuration Properties > General
Windows SDK Version = 10/0 (latest installed version)
Platform Toolset = Visual Studion 2019 (v142)
C++ Language Standard = Default (ISO C++ 14 Standard)
C Language Standard = Default (Legacy MSVC)


Please suggest what could be the issue. Thanks in advance.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,055 questions
0 comments No comments
{count} votes

Accepted answer
  1. RLWA32 45,236 Reputation points
    2023-03-21T15:42:17.4366667+00:00

    It appears that your Custom Build for the message compiler file asrmsgs.mc does not include the necessary steps to run the message compiler and specify inputs/outputs.

    For example, I have a VS2019 solution that builds a windows service. The solution includes a project to build a resource DLL using a .mc file and the message compiler. The related custom build steps from the project file (.vcxproj) appears as follows -

      <ItemGroup>
        <CustomBuild Include="CppWindowsServiceMsg.mc">
          <FileType>Document</FileType>
          <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">mc.exe -U %(Filename).mc</Command>
          <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(Filename).rc;%(Filename).h;MSG00409.bin</Outputs>
          <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Generating message dll for service</Message>
          <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">mc.exe -U %(Filename).mc</Command>
          <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Generating message dll for service</Message>
          <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(Filename).rc;%(Filename).h;MSG00409.bin</Outputs>
          <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">mc.exe -U %(Filename).mc</Command>
          <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">mc.exe -U %(Filename).mc</Command>
          <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Generating message dll for service</Message>
          <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Generating message dll for service</Message>
          <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(Filename).rc;%(Filename).h;MSG00409.bin</Outputs>
          <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(Filename).rc;%(Filename).h;MSG00409.bin</Outputs>
        </CustomBuild>
      </ItemGroup>
    

2 additional answers

Sort by: Most helpful
  1. Michael Taylor 53,896 Reputation points
    2023-03-20T21:09:12.28+00:00

    That error indicates it cannot find the file. But it looks like you are posting a sample you put together of the error message rather than posting the actual error message from the mc compiler. Please confirm that the message file is in the directory that you expect it to be in and turn on diagnostic logging. Then verify that the mc compiler is getting passed the correct path to the file.

    If that still doesn't help then please post the actual error message instead of truncated message.


  2. Chandra Sekhar K 40 Reputation points
    2023-03-24T10:20:04.72+00:00

    Thanks a lot. I have corrected the path of .mc fine in project file (.vcxproj) and able to Build the solution without any errors.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.