Compilation errors invisible when Code Analysis set on TFS2010 - compilation

I am getting my hands on TFS 2010, and I am starting with trying to set a continuous integration build up. For this purpose I am using the default build template (DefaultTemplate.xml) configured with Code Analysis set as Always.
Everything works fine... except when it does not. When there is an error in the build (or a test failure), the only error available in the TFS report is the following
Unable to read Code Analysis output report. Make sure that the directory is writable (default is the project output directory).
The original error is reported only when there is no code analysis. When no error, the code analysis reports are correctly output.
Any ideas?

About the "Unable to read Code Analysis output report" error:
If it happens when compiling in Visual Studio, it could be that the resulting log file path is too long (Ref).
If it happens when compiling in TFS build, it's because the project contains unneeded elements <CodeAnalysisLogFile> and <CodeAnalysisInputAssembly> (Ref).
In our solution, every project imports a Common.Targets file - I intend to override these and thus avoid the problem for all future projects.

What I expect is the following:
Code analysis off, no error: Build is fine
Code analysis off, build error: Workflow does not expect a code analysis file to be generated, original error is displayed, OK.
Code analysis on, no error: Analysis output is generated, and all goes fine.
Code analysis on, build error: Due to build error, code analysis is not performed, the ouput file is not generated. However the workflow expects to find an output file, which it does not find and this becomes the primary error logged in the build exception, hiding the original one.
So please inspect the order of items in your build template, to see if this is applicable and change it to make sure the code analysis output is not expected when a build error occurs.

I have built a solution with msbuild in parallel (/m switch) on our CI server and same error occurs (other file lock specific errors as well, like: The process cannot access the file x.y.z because it is being used by another process). Conclusion: Remove /m because it is not safe :-(

Related

The "GetMinimumOSVersion" task was not given a value for the required parameter "SdkVersion"

I am trying to run msbuild command line, but, I am getting in the last step of it, the error below (it is in portuguese, but is the same error in the title.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.Shared.targets(227,3): erro
r MSB4044: A tarefa "GetMinimumOSVersion" não recebeu um valor para o parâmetro obrigatório "SdkVersion". [E:\2-PROJETO
S\_ALGORIX\Projetos\ACCORD\SOLUTION\AppAlgorix\AppAlgorix.iOS\AppAlgorix.iOS.csproj]
My msbuild command is:
msbuild AppAlgorix.sln /p:Configuration=AppStore;Platform=iPhone /p:CFBundleVersion=1 /p:CFBundleShortVersionString=2.3.1 /p:ServerAddress={mac ip address} /p:ServerUser={mac user} /p:ServerPassword={mac pwd} /p:BuildIpa=true /p:IpaPackageDir="E:\8-IPAS\ACCORD" /t:Clean;Build /p:ArchiveOnBuild=false /p:IsAppDistribution=false /p:CodesignKey="{App ID identifier}" /p:CodesignProvision="{App Provisioning Profile}"
All the {} data are confidential, so I cropped them.
This command was working one day, but I don´t know when, but after some VS 2019 update, the command, stops working.
I have found some articles about it, but I can´t find a way to resolve this problem.
Onw of those articles is this:
https://www.gitmemory.com/issue/xamarin/xamarin-macios/10109/729614745
My VS 2019 is updated in version 16.8.4.
I have here, about 40 apps to build and get the ipa. I was running a dosbat to resolve it, and get those ipas, more quickly. Not having this msbuild command line working, will take me to a big problem, cause I almost every week have some updates in my apps, and build one by one, will not be a great idea.
And one more thing is.. I can build inside VS 2019, without any problem. The problem happens only via msbuild command line.
I used the post Visual Studio update (16.8.1) lead to CI build failures to resolve the error.
"This has reared it's head again in Visual Studio 2019 version 16.8.3.
Looks like they've moved the problem to: \MSBuild\Xamarin\iOS\Xamarin.Messaging.targets I was able to get
my builds running again by removing the _SayGoodbye dependency on line
52 for the _DisconnectAfterClean target."
Although I have resolved the error, now I cant generate the ios.ipa package. Now, I get only the file projectName.iOS.exe, instead of projectName.iOS.ipa.
I dont know if this workaround is the final solution for this bug, yet.
We resolved this by running the build twice in-a-row. (continue on error - ignore the failed first build)
The first time always fails with the error in the question title, but it must somehow sets things up so that the second build has what it needs to succeed. The IPA is generated, etc.
IMPORTANT: DO NOT CLEAN BETWEEN THE TWO BUILDS
I know this solution is a hack workaround, but I prefer it to manually making changes to the .targets files as I have seen suggested elsewhere (those suggestions did not work in our case anyway). Making changes like that without knowing the internals of the build process intimately could result in unintended side-effects.
NOTE: As this solution involves an expected failed partial first build, it does add to the build time, but it was only about a minute or two longer per build, and at least it works reliably.
Hope this is helpful to someone! 🤗

Error while building solution Arithmetic operation resulted in an overflow - CSC error CS7065: Error building Win32 resources

Got this error while building solution on CI server using VS2019 - 16.7.4
Any idea from where it could come from ? It doesn't happen all the time and only one solution. Can workaround by cleaning completely build working folder
CSC error CS7065: Error building Win32 resources : Arithmetic operation resulted in an overflow
First of all, please enter VS IDE, Tools-->Options-->Projects and Solutions-->Build and Run--> set MSBuild project build output verbosity to Detailed to get the detailed build log to locate the specific error.
If you use msbuild command line, you can add -v:detailed to get the detailed build log.
Then, try the following steps:
1) check every resource files, right-click on every that file-->Properties-->change its Build Action to Resource or Content`.
2) try to use Configuration Any CPU to build your project.
3) close VS Instance, delete .vs hidden folder, bin and obj folder and then rebuild your project again.
Besides, if the issue still persists, please share more detailed build log and description about the issue so that it will help us troubleshoot the issue quickly.
in my case, there was a weird combination of characters in the AssemblyInfo.cs
When I removed all these rubbish and changed that to
[assembly: AssemblyCopyright("Copyright © HP Inc. 2021")]
It built normal

DotTrace plugin to TeamCity - process filter is not excluding nunit3-console.exe

I'd like to ask for some help about setting up the DotTrace plugin for one of our TeamCity builds - so far I've followed the instructions here, and got a build that sometimes works:
https://blog.jetbrains.com/dotnet/2016/02/16/performance-profiling-in-continuous-integration-an-updated-dottrace-plugin-to-teamcity/
However, this is sometimes failing because the build produces two snapshots (snapshot.dtp and snapshot-2.dtp).
After much trial-and-error I've found out that sometimes the reason this fails is because my tests sometimes appear in the first .dtp file (which is the one used by DotTrace's Reporter.exe), and sometimes in the second file.
The other .dtp file appears to be associated with the nunit3-console.exe program, and so should be excluded, since I've added this program to "Process Filters" in the TeamCity build setup:
*nunit3-console.exe
(I've tried every combination here, including entering the fully qualified file path)
This has the effect of adding the following line to the dotTrace.project.xml file when the profiler is run:
<ProcessNameFilter>*nunit3-console.exe</ProcessNameFilter>
My understanding is that this should stop the named process from being profiled (so that the extra .dtp file isn't produced. However when the build is running, I see the following lines in the log file:
[16:01:04][Step 12/14] dotTrace Console Profiler 2018.3.2 build 777.0.20190124.112417. Copyright (C) 2019 JetBrains s.r.o.
[16:01:10][Step 12/14] Profiling in progress...
[16:01:10][Step 12/14] Executable='[file path]\nunit3-console.exe' (non-child) is being passed for filtering
[16:01:10][Step 12/14] Passed filter executable='[file path]\nunit3-console.exe'
This is showing that the nunit3-console.exe is not being excluded, as the filter would suggest.
The closest advice I can find is here, which appears to suggest what I'm doing, but is only for NUnit 2:
https://www.jetbrains.com/help/profiler/Profiling_Guidelines__Profiling_Unit_Tests.html
Does anyone know of a way to ensure nunit3-console.exe is excluded, so that it does not produce a snapshot file?
This plugin produces several snapshots by design and generates report based on all snapshots so filtering is not needed here.
I've created the issue

No code coverage results on TFS 2013 Build Server

So our TFS 2013 builds do everything correctly except report code coverage. I've seen similar questions here, e.g. TFS 2013 - No Code Coverage Results, but we've already tried the suggested fixes with no results.
UPDATE 1 — we've taken more steps to try to resolve this; here's the complete list:
Ensured Visual Studio Ultimate was installed on the build server
Tried setting the build definition's "CodeCoverageEnabled" to true as well as the "Code coverage is enabled" setting
Ensured the build was using the Debug configuration and that PDBs were being generated for the DLLs to be tested
Added a .runsettings file with the correct ModulePath included under <CodeCoverage> (verified in build log that the module path was being interpreted correctly; it would produce errors if we intentionally malformed it)
Checked in .runsettings file
Set build definition to "Custom" and pointed to .runsettings file
The build process itself works fine. We can get code coverage results when we build the project locally in the IDE. On the build server, both MSTest and NUnit test projects run fine, and we see pass/fail results as expected. The "No Code Coverage Results" message still plagues us though.
Update 2 -
Here is what we see in the run log:
Somebody suggested homegrown code-coverage calculator in https://stackoverflow.com/a/16198120/141508, but it'd be a crime to spend $150 bazillion-thousand dollars on TFS 2013 & VS Ultimate 2013 with MSDN and still not have this one basic function working.
Add a run settings file to source control. Set the tests to custom and point to the run settings file. More info on using the .runsettings file can be found on msdn: http://msdn.microsoft.com/en-us/library/jj159530.aspx
I was experiencing the same problem. My issue was with the ModulePath. The MSDN examples suggest you can just use the name of a target binary. That was not working for me. However, when I made the name a regular expression, it worked. I am also dumping build output into one folder so that pdb and other reference files are found. Hope that helps.
<ModulePath>.*Administration\.dll.*</ModulePath>
I am using local build server with Visual Studio online with a .runsettings file and I had exactly the same issue.
None of the trickery above helped, so I tested the build script on the hosted build controller and it worked fine, so I decided the problem must be the build server itself.
I changed the Build Service account from "Network Service" to a regular windows user account in the TFS Configuration Tool and now code coverage is collected. Note that this user will need access to the TFS build directories.
I found this question because I saw something peculiar on this article. (Look for the "Delay" setting that defaults to 60).
d. Add a new argument ‘Delay’, enter details as mentioned below
Name – Delay, Direction – In, ArgumentType-Int32, Default Value – 60
This argument is required to delay coverage check, so that required build details are filled up by the build agent, this delay varies from
system to system, in some cases this might not be required at all.
http://www.prowareness.com/blog/failing-build-on-insufficient-code-coverageblock-coverage-part-3/
Maybe try putting in a "delay" work-flow item in the template you are using.......

Get rid of Visual Studio message box when building solutions with checked in setups

I got a solution with multiple projects. Three of the projects are setup projects and they are the ones producing the error.
Each time I build the project I get multiple warnings saying "The command you are attempting cannot be completed since XXX.vdproj is under source control and is not checked out".
How can I get rid of those messageboxes?
Why isn't the warning(s) added a to the "Error list" as all other errors/warnings are?
(Edit: checking out the setup projects will of course work, but I want to get rid of that messagebox without having to do a checkout every time)
I would suggest creating a solution configuration in which the setup project is included in the build, and remove it from the regular Debug and Release configurations. That way you can (on a build server or in another context) build the setup when it makes sense.

Resources