S
S
sorax12018-05-05 10:42:17
C++ / C#
sorax1, 2018-05-05 10:42:17

How to remove full path to .NET Core project files in exclusions?

There is a .NET Core project on a PC, where it is being developed, it lies in a directory, say /home/user/project/
When publishing a project and transferring it to a working machine, if exceptions occur in detail, you can see the full path to the project and the line where the exception was thrown out, for example /home/user/project/Program.cs:line 20
Tell me if it is possible to hide such details, especially the full path, remove them altogether or leave only the file name.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
basrach, 2018-05-05
@sorax1

This information is stored in *.pdb files. They are needed for the debugger. It is impossible to delete part of the path from them, but you can delete the entire file and then the exceptions will not contain information about the source code at all, there will be only a call stack (class name, method name, etc.). You can also add a condition to .csproj so that these files are not created during the release build:

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
  <DebugType>none</DebugType>
  <DebugSymbols>false</DebugSymbols>
</PropertyGroup>

Basically, these files are needed for debugging. Without them, the debugger will not work correctly, i.e. it will not be able to match the instruction with the source code in the general case. Accordingly, it is not worth disabling the generation of these files not in the release.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question