Skip to content

Commit 611d8b4

Browse files
authored
Merge pull request #3564 from MicrosoftDocs/master636976862667899131
For protected CLA branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents 69ae273 + a10ad08 commit 611d8b4

File tree

5 files changed

+219
-0
lines changed

5 files changed

+219
-0
lines changed

docs/ide/media/attach-to-process.png

29.5 KB
Loading

docs/ide/msbuild-logs.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
---
2+
title: Troubleshoot and create logs for MSBuild problems
3+
ms.date: 06/27/2019
4+
ms.topic: conceptual
5+
helpviewer_keywords:
6+
- msbuild logs"
7+
author: mikeblome
8+
ms.author: mblome
9+
manager: jillfra
10+
dev_langs:
11+
- CSharp
12+
- VB
13+
- CPP
14+
ms.workload:
15+
- "multiple"
16+
ms.description: "Generate build logs for msbuild projects to collect helpful information when troubleshooting issues."
17+
---
18+
19+
# Troubleshoot and create logs for MSBuild problems
20+
21+
The following procedures can help you diagnose build problems in your Visual Studio project, and, if necessary, create a log to send to Microsoft for investigation.
22+
23+
## A property value is ignored
24+
25+
If a project property appears to be set to particular value, but has no effect on build, follow these steps:
26+
27+
1. Open the Visual Studio Developer Command Prompt that corresponds to your version of Visual Studio.
28+
1. Run the following command, after substituting the values for your solution path, configuration, and project name:
29+
30+
```cmd
31+
msbuild /p:SolutionDir="c:\MySolutionDir\";Configuration="MyConfiguration";Platform="Win32" /pp:out.xml MyProject.vcxproj
32+
```
33+
34+
This command produces a "preprocessed" msbuild project file (out.xml). You can search that file for a specific property to see where it is defined.
35+
36+
The last definition of a property is what the build consumes. If property is set twice, the second value overwrites the first. Also, MSBuild evaluates the project in several passes:
37+
38+
- PropertyGroups and Imports
39+
- ItemDefinitionGroups
40+
- ItemGroups
41+
- Targets
42+
43+
Therefore, given the following order:
44+
45+
```xml
46+
<PropertyGroup>
47+
<MyProperty>A</MyProperty>
48+
</PropertyGroup>
49+
<ItemGroup>
50+
<MyItems Include="MyFile.txt"/>
51+
</ItemGroup>
52+
<ItemDefinitionGroup>
53+
<MyItems>
54+
<MyMetadata>$(MyProperty)</MyMetadata>
55+
</MyItems>
56+
</ItemDefinitionGroup>
57+
<PropertyGroup>
58+
<MyProperty>B</MyProperty>
59+
</PropertyGroup>
60+
```
61+
62+
The value of "MyMetadata" for "MyFile.txt" item will be evaluated to "B" during build (not "A" and not empty)
63+
64+
## Incremental build is building more than it should
65+
66+
If MSBuild is unnecessarily rebuilding a project or project item, create a detailed or binary build log. You can search the log for the file which was built or compiled unnecessarily. The output looks something like this:
67+
68+
```output
69+
Task "CL"
70+
71+
Using cached input dependency table built from:
72+
73+
F:\test\Project1\Project1\Debug\Project1.tlog\CL.read.1.tlog
74+
75+
Outputs for F:\TEST\PROJECT1\PROJECT1\PROJECT1.CPP:
76+
F:\TEST\PROJECT1\PROJECT1\DEBUG\PROJECT1.OBJ
77+
Project1.cpp will be compiled because F:\TEST\PROJECT1\PROJECT1\PROJECT1.H was modified at 6/5/2019 12:37:09 PM.
78+
79+
Outputs for F:\TEST\PROJECT1\PROJECT1\PROJECT1.CPP:
80+
F:\TEST\PROJECT1\PROJECT1\DEBUG\PROJECT1.OBJ
81+
82+
Write Tracking Logs:
83+
Debug\Project1.tlog\CL.write.1.tlog
84+
```
85+
86+
If you are building in the Visual Studio IDE (with detailed output window verbosity), the **Output Window** displays the reason why each project is not up-to-date:
87+
88+
```output
89+
1>------ Up-To-Date check: Project: Project1, Configuration: Debug Win32 ------
90+
91+
1>Project is not up-to-date: build input 'f:\test\project1\project1\project1.h' was modified after the last build finished.
92+
```
93+
94+
## Create a binary msbuild log
95+
96+
1. Open the Developer Command Prompt for your version of Visual Studio
97+
1. From the command prompt, run one of the following commands. (Remember to use your actual project and configuration values.):
98+
99+
```cmd
100+
Msbuild /p:Configuration="MyConfiguration";Platform="x86" /bl MySolution.sln
101+
```
102+
103+
or
104+
105+
```cmd
106+
Msbuild /p:/p:SolutionDir="c:\MySolutionDir\";Configuration="MyConfiguration";Platform="Win32" /bl MyProject.vcxproj
107+
```
108+
109+
A Msbuild.binlog file will be created in the directory that you ran MSBuild from. You can view and search it by using the [Msbuild Structured Log Viewer](http://www.msbuildlog.com/).
110+
111+
## Create a detailed log
112+
113+
1. From the Visual Studio main menu, go to **Tools** > **Options** > **Projects and Solutions** >**Build and Run**.
114+
1. Set **Msbuild project build verbosity** to **Detailed** in both combo boxes. The top one controls build verbosity in the **Output Window** and the second one controls build verbosity in the \<projectname\>.log file that is created in the each project's Intermediate directory during build.
115+
1. From a Visual Studio developer command prompt, enter one of these commands, substituting your actual path and configuration values:
116+
117+
```cmd
118+
Msbuild /p:Configuration="MyConfiguration";Platform="x86" /fl MySolution.sln
119+
```
120+
121+
or
122+
123+
```cmd
124+
Msbuild /p:/p:SolutionDir="c:\MySolutionDir\";Configuration="MyConfiguration";Platform="Win32" /fl MyProject.vcxproj
125+
```
126+
127+
An Msbuild.log file will be created in the directory that you ran msbuild from.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
title: Create minidumps with all call stacks
3+
ms.date: 06/27/2019
4+
ms.topic: conceptual
5+
helpviewer_keywords:
6+
- minidumps for Visual Studio issues"
7+
author: mikeblome
8+
ms.author: mblome
9+
manager: jillfra
10+
dev_langs:
11+
- CSharp
12+
- VB
13+
- CPP
14+
ms.workload:
15+
- "multiple"
16+
ms.description: "Collect minidumps to send to Microsoft for help with troubleshooting issues with Visual Studio"
17+
---
18+
19+
# Create minidumps for a Visual Studio process with all call stacks
20+
21+
In some cases Microsoft might ask for a minidump of a running Visual Studio process with information for all call stacks. To collect this information, perform these steps:
22+
23+
## Create the minidump file
24+
25+
1. Start a new instance of Visual Studio.
26+
1. From the main menu, choose **Debug** > **Attach To Process**.
27+
1. Check the relevant **Managed** and **Native** check boxes and press **Attach**.
28+
29+
![Attach to process](../ide/media/attach-to-process.png)
30+
31+
1. Select the other Visual Studio instance to attach to from the list of running processes.
32+
1. From the main menu, choose **Debug** > **Break All**.
33+
1. From the main menu, choose **Debug** > **Save Dump As**.
34+
35+
## Get the call stacks from the minidump
36+
37+
1. Open the dump file in Visual Studio.
38+
39+
1. Got to **Tools** > **Options** > **Debugging** > **Symbols** and make sure that **Microsoft Symbol Servers** is checked in the **Symbol file (.pdb) locations**.
40+
1. Open the **Command** window (**View** > **Other Windows** > **Command Window**)
41+
1. Type ‘~*k’. The window displays all threads' call stacks.
42+
1. Copy all text from Command Window and save to a text file.
43+
1. Attach the txt file to the bug.

docs/ide/report-a-problem-perfview.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: Collect an ETL trace with PerfView
3+
ms.date: 06/27/2019
4+
ms.topic: conceptual
5+
helpviewer_keywords:
6+
- "perfview"
7+
- "ETL Trace"
8+
author: mikeblome
9+
ms.author: mblome
10+
manager: jillfra
11+
dev_langs:
12+
- CSharp
13+
- VB
14+
- CPP
15+
ms.workload:
16+
- "multiple"
17+
ms.description: "Use perfview.exe to collect ETL traces for troubleshooting issues with Visual Studio"
18+
---
19+
20+
# Collect an ETL trace with PerfView
21+
22+
PerfView is a tool that creates ETL (event trace log) files based on [Event Tracing for Windows](/windows/desktop/ETW/event-tracing-portal) that can be useful in troubleshooting some kinds off issues with Visual Studio. Occasionally when you report a problem, the product team may ask you to run PerfView to collect additional information.
23+
24+
## Install PerfView
25+
26+
Download PerfView from the [Microsoft Download Center](http://www.microsoft.com/download/details.aspx?id=28567).
27+
28+
## Run PerfView
29+
30+
1. Right-click on **PerfView.exe** in Windows Explorer and choose **Run as administrator** as admin
31+
1. On the Collect menu, choose **Collect**
32+
1. Check **Zip**, **Merge**, and **ThreadTime**.
33+
1. Increase **Circular MB** to 1000.
34+
1. Change **Current Dir** to save ETL traces to a specified folder and Data File if you are going to collect more than once.
35+
1. To start recording data, choose the **Start Collection** button.
36+
1. To stop recording data, choose the **Stop Collection** button. The PrefView.etl.zip file will be saved in the specified directory.
37+
38+
PerfView can store only the most recent data that fits into its buffer. Therefore, try to stop the collection as soon as possible after Visual Studio starts to freeze or slow down. Don't collect for more than 30 seconds after you hit a problem.
39+
40+
For more information, see [PerfView Tutorial on Channel9](http://channel9.msdn.com/Series/PerfView-Tutorial/PerfView-Tutorial-1-Collecting-data-with-the-Run-command).

docs/toc.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,6 +1204,15 @@
12041204
- name: Report a problem states and FAQ
12051205
displayName: Developer Community
12061206
href: ide/report-a-problem.md
1207+
- name: Create minidumps for a Visual Studio process with all callstacks
1208+
displayName: Create minidumps with call stacks
1209+
href: ide/report-a-problem-minidumps.md
1210+
- name: Create logs for MSBuild problems
1211+
displayName: Create logs for MSBuild problems
1212+
href: ide/msbuild-logs.md
1213+
- name: Collect an ETL trace with PerfView
1214+
displayName: ETL trace with PerfView
1215+
href: ide/report-a-problem-perfview.md
12071216
- name: Suggest a feature for Visual Studio
12081217
href: ide/suggest-a-feature.md
12091218
- name: Developer Community data privacy

0 commit comments

Comments
 (0)