how to make Fine code coverage ignore the program file
I don't know how it work to exclude file
You have a typo in your exclude entry.
If you want to exclude the Program.cs file you need to insert **/Program.cs.
Related
I've tried **\*.xaml.cs and **\*View*\**\*.xaml.cs but dotCover still picking up those .xaml.cs files.
Exclude file masks should be able to filter them out.
I've been trying to write C# code that retrieves data from a file in compilation-time, and not in run-time.
The thing is that I need to get a version of a file that exists in my machine,
but not in machines that would run this DLL. (The version can be changed tomorrow, so I want to able to retrieve that dynamically).
In run-time, those machines have no access to the file, and that's why I need to get this data before.
Anyone as an idea how to do so ?
Thanks.
The C# code that you are compiling will not be run during the compilation.
You should make a pre-build step that extracts the version information. That custom build step could in itself be a C# program if you want. Make that program output a small .cs file containing the version number of the dll and include that .cs file in the source for the main program.
If you want to do something before or after a project is built you can write a command line statement in pre-build event command line or in post-build command line in Build Events section of project properties.
I have a C# program that is installed using Nullsoft installer script and I have discovered that the program is littering files :) .
The program is using:
Properties.Settings.Default.Save
to store settings. These settings seems to end up in a folder with a very nontrivial name like:
$user/appdata/local/$publisher/myprogram_Url_sad546a5s4d6a5sd1adsd6/$version/
So my question is:
How do I find this name from NullSoft so I can remove the files?
A quick and dirty solution would of course be to remove every older containing the name "myprogram" but that would prevent having several versions of the program.
You can search for files/folders with the ${Locate} "$localappdata\$publisher" "/L=D /G=0 /M=myprogram_*" MyCallbackfunc macro and check in MyCallbackfunc if that folder contains a $version folder. You can also call FindFirst directly if you don't want to use a macro...
I have a question about recompiling different components of C# console app after making changes
Program.cs --> needs to be rebuilt to see changes
App.config --Not sure
Also i have a folder called UserFiles which has a csv file that I refer in my Program.cs file. If I make changes to either App.config or csv file should I recompile the program. Can someone explain to me how this works please?
Thanks
R
Correct
The App.config file is essentially just a XML file that your program can read settings from when it runs. You don't need to recompile if you make changes to that.
No. Your CSV has absolutely nothing to do with the compilation of your program
I want someone to just be able to fire up my solution, and in the Program have it run and just put this csv at the root of the project for example so that it just picks it up in my method that's gonna read this csv file.
File.ReadLines(filePath).Select(a => a.Split(';'));
Problem is, not sure how to get this so that if someone copies my solution to their c drive, what this filepath should look like..I want them to be able to fire this solution up, run the console app, and since this file is already in the same directory as my project, just want to basically hard code the filename via constant and not worry about ok, where is this file..it's always gonna be here after they copy it for testing purposes.
So what should I do, include the .csv in my .net project then just make the constant "filename.csv"? I tried that, does not work.
I end up with this which fails:
File.ReadLines("someFile.csv").Select(a => a.Split(';'));
and I've included that file in my project...the main console project where the program is running from.
here's my solution structure
SomeTest (.NET solution and it's the root solution folder)
SomeTest (console project)
Constants.cs
SomeTest.BL
SomeTest.DL
filename.csv
I've moved the actual csv to my DL as I'm using it as the test data source.
So when they copy my SomeTest solution folder down to their c drive, wherever they put it, I need that constant to read C:\\root path to wherever they copied SomeTest folder to\\SomeTest.DL\\filename.csv see what I mean? I need to hard code the SomeTest.DL after the root path..but I just can't get the root path, in my case C:\www and grab that part and then I'll append for example the \SomeTest.DL\filename.csv" string to it.
I think the safest option is to add the csv file to your project and set its BuildAction to None and set Copy To Output Directory to copy.
Then users can always access using File.ReadLines("MyDataCsv.csv"), plus you can view/edit the csv from the Visual Studio IDE which I assume the other programmers will want.