Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE
sswilliam Absent Member.
Absent Member.
3958 views

how to let nmdevenv use msbuild.exe to build project instead of using devenv.exe

Hi, Devpartner is used in my company for code coverage analysis. The one who worked on this before just left the company and my boss asked me to take his work. We want to upgrade DP from 10.5 to 11 and my boss let me do some investigation on DP 11. I have downloaded the trail version but I meet some problems. 

We have large amount of VC projects should be instrumented so we have some script to make build with DevPartner. I read the script and find actually nmdevenv.exe is used to make instrumented build for projects. The command line we used with DP 10.5 is

nmdevenv.exe /nologo /nmtxon \"$vcprojName\" /t:Rebuild  /p:useenv=true /p:Configuration=$mode /p:Platform=$platform   /fileloggerparameters:Summary;Verbosity=minimal;errorsonly;logfile=\"$resultFile\"";

I think msbuild.exe is actually called by nmdevent.exe since the parameters format is like msbuild format.

But after I use the same command against Devpartner 11. there is always some error message popped out: 


Invalid Command Line. Unknown Switch : t:Rebuild.

Use:
devenv [solutionfile | projectfile | anyfile.ext] [switches]

I think with DP11, devenv is used to build the project and the old parameters can't work now.

Is there any place that I can let nmdevenv .exe to call msbuild.exe instead of devenv.exe to build the projects?

Thanks

We are using DP 10.5 before and currently I am investigating on DP 11 and using nmdevenv.exe to make instrumented build for my vc project. In DP 10.5 it seems that msbuild 

0 Likes
2 Replies
mlevis Absent Member.
Absent Member.

RE: how to let nmdevenv use msbuild.exe to build project instead of using devenv.exe

I am guessing that you have also updated your version of Visual Studio?

It is quite easy to use MSBuild to instrument your projects. If you open your project in visual studio and select instrumentation this will save the option to instrument in your <project>.vcxproj.user files and MSBuild will read that.. So on the command line all you need to do is call MSBuils <sln> or <proj>.

MSBuild

VS2010 brought about MSBuild for C/C++ projects. MSBuild was the build tool for the rest of the projects previously and now there is one common build tool. If you turn on instrumentation for your project inside of visual studio all you have to do is open a command prompt, run VS2010 or vs2012’s VCVars batch file, navigate to your solution directory and run MSBuild <Sln> /p:<Configuration>.

If you do not turn on instrumentation and select the type in Visual Studio there is some more work that will need to be done. As mentioned in the building inside VS section DevPartner modifies the vcxproj.user files for VS2010 and 2012. These will need to be modified now to allow instrumenting of the application.

Given a sample MFC Application called MFCvs2010. Under the <root>\MFCvs2010\MFCvs2010 directory there is a file MFCvs2010.vcxproj.User.

 

<?xml version="1.0" encoding="utf-8"?>

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_BC|Win32'">

    <DevPartner_IsInstrumented>1</DevPartner_IsInstrumented>

   <DevPartner_Instrumented_Type> /NMbcOn</DevPartner_Instrumented_Type>

  </PropertyGroup>

</Project>

 

I trimmed out all the other Config | Platforms for ease of readability. There are two attributes added here the first is DevPartner_IsInstrumented. This value will tell MSBuild if it needs to call our compiler wrapper NMCL instead of CL. The other <DevPartner_Instrumented_Type> passes the instrumentation type to NMCL.

 

The other major change for VS2010 and VS2012 is setting of these flags based on Config | Platform. This means that for every different combination you may also have different settings.  Which means that  you may check these .User files into source control and all of your normal Debug & Release builds can be unchanged but you can have additional config | Platforms that are instrumented versions that also build on your build system. Below I have configurations for Debug_BC|x64 that compiles for Error Detection and another for Release|X64 that builds for Performance / Coverage. Also present a Release |x64 option that is not instrumented.

 

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_BC|x64'">

    <DevPartner_IsInstrumented>1</DevPartner_IsInstrumented>

   <DevPartner_Instrumented_Type> /NMbcOn</DevPartner_Instrumented_Type>

  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'==Release|x64'">

    <DevPartner_IsInstrumented>0</DevPartner_IsInstrumented>

   <DevPartner_Instrumented_Type> </DevPartner_Instrumented_Type>

  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">

    <DevPartner_IsInstrumented>1</DevPartner_IsInstrumented>

    <DevPartner_Instrumented_Type> /NMtxOn</DevPartner_Instrumented_Type>

  </PropertyGroup>

 

All of that also helps your build scripts as there are no changes to them at all. You just call MSBuild <Sln> /p:<Configuration>. To build all configurations just leave out the /p:<Configuration> option.

 

Getting ready to build

 

During the build you can see the “Instrumenting” messages.

 

 

Build completed

0 Likes
Highlighted
mlevis Absent Member.
Absent Member.

RE: how to let nmdevenv use msbuild.exe to build project instead of using devenv.exe

It seems that the reply stripped the screen shots out of the  answer. email me at mark <dot> levis <at> microfocus <dot> com and I will send you the full document on instrumenting from the command line.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.