How to do code coverage and create reports in Visual Studio 2012 Professional - visual-studio-2012

I'm trying to do code coverage and create reports in VS2012 Pro, which doesn't include the CodeCoverage.exe and the rest of the tools (As in Ultimate and Premium). I've looked through a lot of examples, and they usually seem to take the generated data file and convert it into xml. When I try to use (compile) that code, it complains about missing assemblies, which in turn seem related to the fact that I'm using the Pro version (as opposed to the Premium and Ultimate).
I have a script that generates the coverage data to a .vsp file, but when using the VSPerfReport.exe (which seemed like a good fit), it fails with:
Error VSP1712: Invalid File: myexename.vsp
Error: VSP1804: Did not successfully open the file.
I want to create an html page in the end, and can probably do that by getting an xml first.
I also tried to open the coverage file in VS but it couldn't read the file.
So, I wonder if it's at all possible to do this with the tools provided in the Pro version?
Here is the script:
#echo off
set EXE=<path to exe>\<exename>
set OUTPATH=.\coverage
set OUT=%OUTPATH%\<exename>
set ARGS=<some args>
rem I've seen this extension in several examples, but it generates:
rem Error VSP1712: No readers configured for the .coverage file extension. Check the ReaderFactoryConfig file.
rem set VSP=%EXE%.coverage
rem This extension generates the error message:
rem Error VSP1712: Invalid File: <path to exe>\<exename>.vsp
rem Error: VSP1804: Did not successfully open the file.
set VSP=%EXE%.vsp
mkdir %OUTPATH%
vsinstr.exe %EXE% -coverage -outputpath:%OUTPATH%
vsperfcmd.exe -start:coverage -output:%VSP%
echo Running exe!
%OUT% %ARGS%
vsperfcmd.exe -shutdown
VSPerfReport.exe %VSP% /Xml /Summary:all
rm %OUT%
Edit
I use C++ programs. And free is good, so I'd like to see what my options are.

Related

Cannot save/run GAMS file to/from mapped SharePoint network drive

I am trying to run a model in GAMS (using the Windows GAMS 64, version 24.5). The model .gms file is located on a Z drive that is mapped to a SharePoint folder. We use this setup all the time with other programming languages without problem. But when I try to run or save my model, I get the following error:
Unable to save file:
Z:\[my file path]\mymodel.gms
Error 123: The filename, directory name, or volume label syntax is incorrect
When I try to run the file, I also get the following message in the process window:
*** Error: Error writing GAMSNext: Invalid argument
Exit code = 113
SharePoint is really useful in tracking versions and letting the teams collaborate using a tool they are already familiar with (and our IT dept will not let us install git or similar). So I'd like to figure out how to get this to work, if possible, and why it is only a problem in GAMS.
Any insights? In particular, anyone know what the GAMSNext file that GAMS seems to be trying to write is? Also, why is GAMS perfectly able to save files to SharePoint when I create my project file (the .gpr file was, in fact, saved just fine), but not when I try to save a change to my .gms file? What is the difference in the GAMS save process for a .gms file and a .gpr file?
I have seen this issue before - GAMS not running a file on a network path/drive and give a 'UNC path error' or so.
If I recall, the issue was solved when we took the project file out of the "My Documents" folder. If it is a shared drive created for windows, you may have a "My Documents" folder which has a path with "Documents". Create your GAMS folder from the root and create your .gpj and .gms files there.
Hope this helps.

Visual studio export template replaces original projectname with $safeprojectname$

My project is a mvc4 project in visual studio 2013 ultimate.
I tryd to send my project by following the steps :
File > Export template > (leave all the options as default)
I get a zip that i unpack. If i open the unpacked solution and run the program i get alot of errors. It looks like visual studio replaced all the text that contained the projectname with $safeprojectname$. How can i export the project without visual studio replacing all the 'projectname' spots so that i can run my program.
I tryed creating a new project (console application) with no code in it, if i export it and import it i get the same message first i get :
Warning 1 Load of property 'RootNamespace' failed. The string for the root namespace must be a valid identifier. SvenEind
and after running i get
190 errors 31 warnings
I tryd importing http://www.asp.net/mvc/tutorials/getting-started-with-ef-5-using-mvc-4/building-the-ef5-mvc4-chapter-downloads and that worked for me.
So i guess the problem is in some kind of settings for exporting files.
replaced all the text that contained the projectname with $safeprojectname$
This is very much by design. You created a project template, a cookie-cutter for new projects. You are not supposed to do anything with the .zip archive. It should sit patiently in your "My Exported Templates" folder. Until the day arrives that you want to start a new project.
You then can pick the template instead of using one of the built-in ones that were preinstalled by the Visual Studio installer. Visual Studio prompts you for the project name. It then unzips the archive, copying the files into your new project directory. And modifies the files, $safeprojectname$ is substituted by the new project name you entered. You now have a good start for your new project, using the settings and assets that you saved earlier when you created the template.
Sounds like you had an entirely different use in mind, I can't guess at the intention from the question.
Hmmm. I got this error on Build:
The app manifest must be valid as per schema: Line 42, Column 18, Reason: '$safeprojectname$' violates pattern constraint of '([A-Za-z][A-Za-z0-9]*)(\.[A-Za-z][A-Za-z0-9]*)*'. The attribute 'Id' with value '$safeprojectname$' failed to parse.
So I grabbed the project name from the VS Configuration Manger and put it in the app manifest like this.
<Applications>
<Application
Id="CordovaApp.Windows10"
And the error went away and the project built. HTH.

Can not load symbols when profiling on Azure webrole with VS 2013

Tried a lot different things, but what should be a simple thing never works for me. VSP file downloaded, but doesn't show my function names, only hex codes. It does give an error:
Error 1 DA0002: It appears that the file was collected without properly setting the environment variables with VSPerfCLREnv.cmd. Symbols for managed binaries may not resolve. C:\work\AbleAzure\Downloaded Profiling Logs\AbleAzureWeb24201441226PM\AbleWebRCore_0_(f1da3c).vsp 0 0
I checked the folder C:\work\AbleAzure\Downloaded Profiling Logs\AbleAzureWeb24201441226PM, it has all the PDB files in it.
I have no idea about the error "the file was collected without properly setting the environment variables", is it the Azure side or local? I don't see any place to set variable for Azure side.
Screenshot:
When you make the call to VSPerfReport to visualize your report, you need to specify the symbol locations:
https://msdn.microsoft.com/en-us/library/dd255404.aspx
They must match the versions etc.

ANTLR4 Generating Lexer in JAVA instead of C Sharp

When doing
java -cp C:\Tools\Libraries\antlr4-csharp-complete.jar org.antlr.v4.Tool Hello.g4
I get the following files:
HelloBaseListener.cs
Hello.tokens
HelloListener.cs
HelloParser.cs
HelloLexer.tokens
HelloLexer.java
My question is about the last file. Why is it .java instead of .cs?
I'm using antlr4-csharp-4.0.1-SNAPSHOT-complete.jar
Grammar is:
grammar Hello; // Define a grammar called Hello
options
{
language=CSharp_v4_0;
}
r : 'hello' ID ; // match keyword hello followed by an identifier
ID : [a-z]+ ; // match lower-case identifiers
WS : [ \t\r\n]+ -> skip ; // skip spaces, tabs, newlines, \r (Windows)
Hello Sam! I only have visual studio express so I can't install the extension. This is the code that I'm using but it is still generating the HelloLexer.java.
AntlrClassGenerationTaskInternal a = new AntlrClassGenerationTaskInternal();
List<String> files = new List<string>();
files.Add(#"C:\Tools\Grammars\Hello.g4");
a.JavaVendor = "JavaSoft";
a.ToolPath = #"C:\Tools\Libraries\antlr4-csharp-complete.jar";
a.JavaInstallation = "Java Development Kit";
a.SourceCodeFiles = files;
a.OutputPath = #"C:\Tools\Grammars\CSharp\";
a.Execute();
By the way, visual studio complained because it was not able to find Antlr4ClassGenerationTask.IsFatalException(ex)
I appreciate your help on this.
Regards,
Omar.
I think it's a bug, I had got the same problem, but there is a solution.
1) If you want you can remove
options
{
language=CSharp_v4_0;
}
I think is ignored by the code generator
2) create a BAT file with the follow code
#echo OFF
IF "%CLASSPATH%" == "" (SET CLASSPATH=.;.\antlr4-csharp-4.0.1-SNAPSHOT-complete.jar;%CLASSPATH%)
java org.antlr.v4.Tool %* -Dlanguage=CSharp_v4_5
put antlr4-csharp-4.0.1-SNAPSHOT-complete.jar in the same path, now you can use this file to comile. To resolve the issue the magic command line argument is "-Dlanguage=CSharp_v4_5" or the version of C# you are using.
The generated files now have inside the Lexer.cs
Edit 11/20/13: Updated instructions are now available on the project wiki
https://github.com/sharwell/antlr4cs/wiki/Installation
Here are a few messages I sent over the past few months related to this issue. If you don't want to install the Visual Studio extension described below, you'll need to use the source code of Antlr4ClassGenerationTaskInternal.cs to determine a set of command line options that will work.
Also, you can remove the language=CSharp_v4_0; option because it's passed on the command line now.
The C# target wasn't designed for command line usage. You will need to integrate the code generation into your project file according to the instructions on the following page, and the parsers will be generated automatically when you build your project.
https://github.com/sharwell/antlr4cs
You do need to include the .g4 file in your project and configure a few properties of the file. If you install the following extension before adding the grammar to your project, all the other options will be configured for you automatically.
ANTLR Language Support for Visual Studio 2010-
2012
If you already have the .g4 file in your project, and want to still use the extension to automatically configure the proper settings, you can do the following:
Install the extension.
Click the project in Solution Explorer and enable Show All Files (button on the Solution Explorer toolbar). This step greatly simplifies step 4.
Right click the .g4 file in the project, and select Exclude From Project.
Right click the .g4 file again and select Include In Project.
(Optional) You can disable Show All Files when you no longer need it.

Microsoft.VisualStudio.SharePoint.targets(418,7): error MSB4131: The "IsDebugging" parameter is not supported

I'm using Visual Studio 2012 to build a empty SharePoint 2013 project (added a test list). However when I try to deploy the project I receive the following:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SharePointTools\Microsoft.VisualStudio.SharePoint.targets(418,7): error MSB4131: The "IsDebugging" parameter is not supported by the "SetPackagingProperties" task. Verify the parameter exists on the task, and it is a gettable public instance property.
I've tried commenting out various lines but it just leads to more problems. Furthermore it then does not package the solution.
The setPackagingProperties task, as documented here http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.sharepoint.tasks.setpackagingproperties.aspx, indeed does not include a IsDebugging property. Therefore is the file C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SharePointTools\Microsoft.VisualStudio.SharePoint.targets incorrect? I'm using SharePoint Found Server 2013.
Thanks for any help - this one is doing my head in!
Turns out that the solution was simple: a conflict of DLLs.
To anyone else with the same problem:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SharePointTools\Microsoft.VisualStudio.SharePoint.Tasks.dll DOES contain the IsDebugging property (undocumented!). My problem was that I had VS 2010 installed with the SP developer tools. This meant that VS 2012 was referencing the incorrect DLL version of Microsoft.VisualStudio.Sharepoint.Tasks.dll. My solution was simple to therefore search the entire system for this DLL and delete all copies apart from the one referenced in the path above.
Pareto's ratio: 80% of time wasted is attributable to just 20% of problems encountered, like this one!!!

Resources