@@ -76,23 +76,44 @@ If _both_ MSBuild properties and environment variables are provided, the MSBuild
76
76
77
77
# ## Setting MSBuild Properties
78
78
79
- MSBuild properties can be set in any MSBuild project file, such as those that are created by Visual Studio or the `dotnet` CLI
80
- (`YourProject.csproj`, `YourProject.vbproj`, `Directory.Build.props`, etc.).
79
+ Sentry's MSBuild properties can be set in any MSBuild project file, such as those that are created by Visual Studio
80
+ or the `dotnet` CLI (`YourProject.csproj`, `YourProject.vbproj`, `Directory.Build.props`, etc.).
81
+ We recommend using a dedicated property group, so that you can control when these features are used.
81
82
82
- You can add Sentry's MSBuild properties to any property group. For example :
83
+ In the following example, `Condition="'$(Configuration)' == 'Release'"` ensures that these features are enabled
84
+ only for release builds. This is the usual recommendation, because sending data to Sentry during debug builds
85
+ can slow down your development workflow.
86
+
87
+ Alternatively, you could control this using any MSBuild property or environment variable you like. For example,
88
+ if you only want these features enabled in a GitHub Actions CI workflow, you could use `Condition="'$(GITHUB_ACTIONS)' == 'true'"`.
83
89
84
90
` ` ` xml
85
- <PropertyGroup>
91
+ <!-- We recommend only using these features for release builds. -->
92
+ <PropertyGroup Condition="'$(Configuration)' == 'Release'">
93
+
94
+ <!-- Configure Sentry org and project -->
86
95
<SentryOrg>___ORG_SLUG___</SentryOrg>
87
96
<SentryProject>___PROJECT_SLUG___</SentryProject>
97
+
98
+ <!--
99
+ Each of the below features are opt-in.
100
+ Enable the features you wish to use.
101
+ -->
102
+
103
+ <!-- Sends symbols to Sentry, enabling symbolication of stack traces. -->
104
+ <SentryUploadSymbols>true</SentryUploadSymbols>
105
+
106
+ <!-- Sends sources to Sentry, enabling display of source context. -->
88
107
<SentryUploadSources>true</SentryUploadSources>
108
+
89
109
</PropertyGroup>
110
+
90
111
` ` `
91
112
92
113
Alternatively, they could be passed as parameters when building your project. For example :
93
114
94
115
` ` ` shell
95
- dotnet build YourProject.csproj -c Release -p:SentryOrg=___ORG_SLUG___ -p:SentryProject=___PROJECT_SLUG___ -p:SentryUploadSources=true
116
+ dotnet build YourProject.csproj -c Release -p:SentryOrg=___ORG_SLUG___ -p:SentryProject=___PROJECT_SLUG___ -p:SentryUploadSymbols=true -p: SentryUploadSources=true
96
117
` ` `
97
118
98
119
<Alert title="Tip">
@@ -131,16 +152,20 @@ There are a few additional properties available to control the Sentry CLI:
131
152
132
153
<ConfigKey name="SentryUploadSymbols">
133
154
134
- Controls uploading symbols to Sentry during the build. Defaults to `true` for builds in release configuration,
135
- or `false` otherwise.
155
+ Controls uploading symbols to Sentry during the build. Defaults to `false` (disabled).
156
+
157
+ Set this property to `true` to opt-in to sending symbols to Sentry as [debug information files](../../data-management/debug-files/),
158
+ which are used to perform symbolication of stack traces. This will allow you to view file names and line numbers within
159
+ a stack trace, instead of just a function name.
136
160
137
161
</ConfigKey>
138
162
139
163
<ConfigKey name="SentryUploadSources">
140
164
141
- Controls whether source code files are uploaded to Sentry during the build. Defaults to `false`.
165
+ Controls whether source code files are uploaded to Sentry during the build. Defaults to `false` (disabled) .
142
166
143
- Set this property to `true` to opt-in to enable [source context](../../data-management/debug-files/source-context/) when viewing stack traces.
167
+ Set this property to `true` to opt-in to sending source code to Sentry.
168
+ This enables the display of [source context](../../data-management/debug-files/source-context/) when viewing stack traces.
144
169
145
170
<Note>
146
171
@@ -153,8 +178,9 @@ you do not need to upload them to Sentry separately. In other words, use *eithe
153
178
154
179
<ConfigKey name="UseSentryCLI">
155
180
156
- Controls whether the Sentry CLI is enabled in your build. `true` by default.
157
- Set to `false` to disable the Sentry CLI completely, ignoring all other properties.
181
+ Controls whether the Sentry CLI is enabled in your build.
182
+ Defaults to `true` if any of the individual features are enabled.
183
+ Set to `false` to disable the Sentry CLI completely, ignoring the settings of each feature.
158
184
159
185
</ConfigKey>
160
186
0 commit comments