TFS Build Server won't deploy my .pdbs - c#

The steps of my build:
NuGet Installer - get all packages for all solutions in the source tree
Visual Studio Build - Build the solution - no special parameters
Visual Studio Test - Run tests on built solution
Visual Studio Build - Publish specific website - MSBuild Arguments = /p:DeployOnBuild=true /p:PublishProfile=Publish /p:OutputPath=Publish /p:TeamDirectory="$(TeamName)\\" /p:ExcludeGeneratedDebugSymbol=false
Publish Build Artifacts
Additional configuration:
Going to properties for the website in VS, all build configurations have "Exclude generated debug symbols" unchecked. This is reflected in the .csproj file with <ExcludeGeneratedDebugSymbol>false</ExcludeGeneratedDebugSymbol> under each PropertyGroup.
Going to properties for the website in VS, under Build -> Advanced, all build configurations have Debug Info = pdb-only (except Debug, which has full). This is reflected in the .csproj file with <DebugType>pdbonly</DebugType> and <DebugSymbols>true</DebugSymbols>
The bin directory for all projects including the website contains appropriate .pdb files. The Publish directory and the generated artifact do not have any .pdb files except for Antlr3.Runtime.pdb, EntityFramework.MappingAPI.pdb, and RefactorThis.GraphDiff.pdb. Running publish locally through VS copies the .pdb files as expected.

I tested at my side, TFS has the same behavior with local VS, it's the default behavior.
Normally the Antlr3.Runtime.pdb and project project.pdb will display there, If you have other third packages, you need to make sure the .pdb files are included in them when get sources.
Whatever, have a try for these arguments /p:DebugSymbols=true /p:DebugType=full

Related

Is there any setting in the code, config or visual studio to NOT generate .PDB file in published code?

When I'm publishing the .net code via visual studio in RELEASE mode then it is creating .PDB files every time in the published folder.
Expected Result: Is that. I don't want .PDB files to generate after code publish.
If you right-click the project in the Solution Explorer and choose Properties, then go to the Build tab and click the Advanced button, you will see an option to control whether to generate debugging information. Set this to None in your release configuration and no PDB file will be generated.

Under what cases does a VSTS build produce an empty drop

I have a .Net (VS 2015) application that I manually build using VSTS. The build was successfully completed but no artifacts were generated. The agents/tasks used in this manual build are the NuGet tool installer, NuGet restore, Visual Studio build, publish build artifact.
Visual Studio Build parameters:
Publish Build Artifact parameters:
Variables added:
End Result:
A similar structure should be produced as per my expectation:
Before the "Publish artifacts" task, you need to copy to the folder a in the agent the files you want they will be in the artifacts.
For example:
Now in your artifacts folder (a on the agent) will be your release output and in the Publish task it will be published as artifacts.

Visual Studio 2015 builds my project without problems, MSBuild.exe cannot

I am developing simple Asp.net MVC 5 app which is working ok and visual studio 2015 can build it without any issues, but when i use MSBuild.exe command line tool it shows alot of errors which relates to typescript files compilation (primarily from node_modules folder).
I am trying to use Jenkins CI tool to automate my deployment routine, in order to do so i have to build my app using MSBuild.exe.
My project has tsconfing.json file in the root folder which contains following lines to exclude node_modules folder (it is inside #AngularComponents folder):
"exclude": [ "Scripts/**", "WrittenScripts/#AngularComponents/**" ]
But somehow MSBuild.exe command line tool just ignores it during build.
Does anyone have any ideas how to configure it to take into account my tsconfig? or tell MsBuild to not to build my node_modules folder?
Thank you in advance!
I finally figured it out.
First of all i have to use this MsBuild:
1) C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe;
Secondly, for some reason msbuild messed up my tools version 4.0 so I need to pass additional parameter to msbuild:
2) /tv:14.0
Thirdly, my typescript files have some /// references to node_modules\#types folder and for some reason it shows me any errors but not related to the reference one.
3) so i have to run npm install to recover #types packages.
After these steps msBuild builds successfully without any errors.
Thanks for all!

Microsoft.CSharp.Core.targets missing

I am building a webservice project on a TFS2017 Update 3 with build tools 2017. I get the following error
C:\Program Files (x86)\Microsoft Visual
Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.CSharp.CurrentVersion.targets(322,5):
Error MSB4019: The imported project "C:\Program Files (x86)\Microsoft
Visual
Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets"
was not found. Confirm that the path in the declaration is
correct, and that the file exists on disk.
What steps do I need to take to fix this error?
In my case, opening the existing Solution file (with .sln extension), it installed all the missing dependencies.
Otherwise check for missing target packages at nuget.org manually and install them (e.g. MSBuild.Microsoft.VisualStudio.Web.targets).
As per this GitHub issue, you'll need to set $(RoslynTargetsPath).
If MSBuild is installed on the machine and your tests run in a Visual Studio Developer Command Prompt, then you shouldn't need to do anything. However, MSBuild 15.0 no longer places itself in the registry which makes it impossible for MSBuild to find itself. This is because of a mandate by Visual Studio where you can have multiple side-by-side installations. MSBuild in this case would be installed once per Visual Studio instance. MSBuild now finds itself by looking at environment variables set by the VS command prompt.
If you want to fully redistribute MSBuild via a combination of our packages and all of the other packages needed to do full project evaluation, you will have to set RoslynTargetsPath before you load projects. You could argue this is an issue with NuGet since all packages' <contentFiles /> go to the the root of your output directory and you can't specify a subdirectory for certain packages.
If you're coming to this page from google/duckduckgo after trying to figure out why you're getting a similar message in Ubuntu 20.04, maybe this can help: https://askubuntu.com/a/1231973/1073658 (tl;dr apt install mono-roslyn from mono-project's repo)
First suggest you directly use msbuild command on the build agent with TFS build service account. This will narrow down if the issue is related to your agent environment or your TFS build definition.
According to your error info, the path C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets is looking the path of Visual Studio 2017.
However, for Build Tools the path is different should be C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\Roslyn
Seems you haven't installed VS2017 on your build agent. This maybe the root cause of the issue.
The simplest solution is installing VS2017 on your build agent. Note, you need to reconfigure the build agent or restart build agent service to capture those new capabilities. Otherwise you need to change the corresponding import section in your .csproj project files.
I updated to TFS2018 and the problem got solved.

How to include pdb files in MSI installer to deploy along side the rest of the app?

How to include pdb files in MSI installer to deploy along side the rest of the app?
I want to keep the line numbers and full stack trace in error logs we generate.
Update
The line numbers of the code are not reported in the stacktrace unless you distribute the pdb's, I've tested this.
How can when I build the MSI and I've asked the MSI installer project to include various project outputs (about 5) to also include the pdb's of those project outputs in the MSI? or how to get this information (code line numbers) from the Exception ex into the logs?
For a Visual Studio Deployment Project you should do:
Add -> Project Output -> Debug Symbols
Also make sure that the *.pdb generation is enabled in each project Build configuration.
I know this is a little late to the OP, but I found that the previous answer needed more clarification (at least for me). For VS2010, when you click Add -> Project Output -> Debug symbols, you need to specify the project in the drop down, and then ctrl+click the "Debug Symbols" for that project. Do this for all the projects that you have, which will entail you clicking Add -> Project Output -> Debug Symbols each time.
For newer versions of Visual Studio you can include .pdb files on deploy using the option under the Project Properties > Package/Publish Web, uncheck the checkbox "Exclude generated debug symbols" and your .pdb files will be published.

Categories

Resources