Setup Sonar properties files for multiple projects - sonarqube

I want to analyze multiple projects,and I would like to separate the two reports so i have one for the CA_Report package and one for the CallCenter package.I had tried the solutions from Setup sonar-runner for multiple java projects
and Sonar properties files
I tried to using sonar-project.properties to solve the following error,but it doesn't work with my following cmd.
Cmd
CD /D D:\trunk
SonarQube.Scanner.MSBuild.exe begin /k:"myProject" /n:"myProject" /v:"1.0"
"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" /t:Rebuild
Error
MSBUILD : error MSB1003:Specify a project or solution file. The current working directory does not contain a project or solution file.
I have a project that has the following package structure
-trunk(folder with sonar-project.properties)
-Center
-CA_Report(folder with source files)
-CA_Report.sln
-CallCenter(folder with source files)
-RBSolution.sln
-sonar-project.properties
My sonar-project.properties file looks as follows
sonar.host.url=http://localhost:9000
sonar.sourceEncoding=UTF-8
sonar.projectKey=FubonLifeCallCenterConfigureTest
sonar.projectName=FubonLifeCallCenterConfigureTest
sonar.projectVersion=1.0
sonar.sources=trunk/Center/CA_Report,trunk/Center/CallCenter
sonar.projectBaseDir=D:\\FubonLife\\trunk\\Center
sonar.modules=CA_Report,CallCenter
CA_Report.sonar.projectBaseDir=D:\\FubonLife\\trunk\\Center\\CA_Report
CA_Report.projectKey=CA_Report
CA_Report.projectName=CA_Report
CA_Report.sources=trunk/Center/CA_Report
CallCenter.sonar.projectBaseDir=D:\\FubonLife\\trunk\\Center\\CallCenter
CallCenter.projectKey=CallCenter
CallCenter.projectName=CallCenter
CallCenter.sources=trunk/Center/CallCenter

Related

VSTS Build with Gulp-Generated Files

I currently have a VSTS build that takes in a Visual Studio solution and builds it (C#) with the following build parameters:
/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:UseMerge=true /p:PrecompileBeforePublish=true /p:SingleAssemblyName=AppCode"
I also have various Gulp tasks that take in my front-end files and manipulate them (lint, minify, bundle, etc.) as part of this build. The problem is that the zip that is created from the solution build step doesn't include these distribution files (or any file that's not included in the solution.)
In general it's a bad idea to check in distribution files, you need to generate them as part of the production build. Can anyone point me in the right direction of how to get these files to generate (the build is working for this step) -AND- get them included as part of the zip file generated as part of the solution build?
To include Gulp-Generated Files into web application package zip file, you can get the web application package files into another directory (such as $(build.binariesdirectory)) and after execute all the Gulp tasks, you can add the Gulp-Generated Files into $(build.binariesdirectory). Then zip files from $(build.binariesdirectory) and publish the artifacts.
Detail settings as below:
In VS Build task, change MSBuild arrguments as:
/p:OutDir="$(build.binariesdirectory)\\"
Add a task (PowerShell task or Copy Files task etc) to copy the Gulp-Generated Files to $(build.binariesdirectory).
Add an Archive Files task to zip files from $(build.binariesdirectory) to $(Build.ArtifactStagingDirectory) as below example:
Now the zip file not only contains the package files of the web application, but also contains the Gulp-Generated Files.

Build using specified startup project

I am running the build command like this:
set MSBuildParams=/m:16 /target:Rebuild
/property:Configuration=""Release"";Platform=""x64"" msbuild
%MSBuildParams% C:\path\to\the\sln\Solution.sln
I'm using the following msbuild version:
Microsoft (R) Build Engine version 14.0.25420.1
Solution.sln contains 2 projects,
let's say Project1 and Project2.
Project1 is set as the startup project.
After I build the Solution.sln using this setup, I would like to
rebuild it, but this time using Project2 as the startup project.
Is there a way to do that, without changing the Solution.sln?
What would be the best practice to accomplish that?
You could use the specific command line to build/rebuild the specific project using MSbuild like the following case.
specify project file of a solution using msbuild
But we have to change certain files if you want to change the start up project without using the VS IDE, since the setting was stored into the ".SUO" file.
Actually there is no setting in ".SLN" file for startup project even if you don't want to change it,
In addition, the start up project was the running project of the solution, maybe you don't have to change it:
https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/b6347dce-8449-4cbb-a606-7b19407a1026/how-do-i-set-the-startup-project-in-the-sln-file?forum=vcgeneral

VS2017 MSB4057 The target "CreateManifestResourceNames" does not exist in the project

When VS2017 was used to create a stateful solution, producing the standard boilerplate code, the resulting two projects have two different MSBuild versions.
The application uses MSBuild version 1.5.0.
The service uses MSBuild version 1.6.0 (the current "latest").
If I run the solution this way, it runs fine on my local Service Fabric cluster.
But when after I use NuGet to update the application's MSBuild to 1.6.0 (so both application and server projects use the same), the following errors occur.
Severity Code Description Project File Line Suppression State
Error The OutputPath property is not set for project 'gt_strd5.sfproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' P follow a project-to-project reference to this project, this project has belatform='x64'. This error may also appear if some other project is trying toen unloaded or is not included in the solution, and the referencing project does not build using the same or an equivalent Configuration or Platform. gt_strd5 C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets 737
Severity Code Description Project File Line Suppression State
Error MSB4057 The target "CreateManifestResourceNames" does not exist in the project. gt_strd5 C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets 2630
I found that after the change, some references in the application's project file continued to reference MSBuild 1.5.0. In my case, the gt_strd5.sfproj file contained four references which needed to be updated from 1.5.0 to 1.6.0. See the snippets from the XML below.
Import Project="..\packages\Microsoft.VisualStudio.Azure.Fabric.**MSBuild.1.5.0**\build\Microsoft.VisualStudio.Azure.Fabric.Application.props" Condition="Exists('..\packages\Microsoft.VisualStudio.Azure.Fabric.**MSBuild.1.5.0**\build\Microsoft.VisualStudio.Azure.Fabric.Application.props')"
.....
Import Project="..\packages\Microsoft.VisualStudio.Azure.Fabric.**MSBuild.1.5.0**\build\Microsoft.VisualStudio.Azure.Fabric.Application.targets" Condition="Exists('..\packages\Microsoft.VisualStudio.Azure.Fabric.**MSBuild.1.5.0**\build\Microsoft.VisualStudio.Azure.Fabric.Application.targets')"
To verify this, I went back a couple times and was able to reproduce both the issue and this solution.
Hope it saves someone else some time.
Best Regards
I was getting this error into PCF control.
Run Developer Command Prompt VS2017/ VS2019
a) Remove white space from your folder like Test%20-%20PCFs (source control generated name) should be TestPCFs
b) Go to pcf project folder from cmd line & run msbuild /t:restore
b) Go to cds project folder from cmd line & run msbuild /t:restore
c) On cds project folder, run msbuild
d) For release deployment run msbuild /p:configuration=Release
For other types of projects
a) Remove white space from your folder name
b) run msbuild /t:restore
c) run msbuild

How to override all project properties for Visual Studio 2010 in msbuild through Powershell

I am trying to write a script where automatically build in 30+ Visual Studio 2010 (.sln) through PowerShell script using Msbuild command line.
I am able to build the build the modules, but I have some dependency and specific project setting for all 30+ modules. Project properties for all 30+ modules are same. So I want to pass all the project properties once in the script to set for all modules for building automatically.
But,
I am not able to pass all the project setting where as only 3 parameters I am able to pass such /t:build /p:configuration:Debug /p:TargetPaltform=x86.
Issue: I want to pass all project properties as arguments for msbuild in my pwoershell script.
Could you please provide some syntax or idea how can I pass more project properties parameters as command line?
Example Parameters List:
Output Directory
Intermediate Directory
Include Directories
Library Directories
Output File and sub sections. etc.

TeamCity, How to include original nunit, dotcover, fxcop xml log files in the artifact

im setting up different build steps for each of the tasks, Nunit/dotcover, fxcop.
is it possible to include the original xml files produced by nunit, dotcover, and fxcop as the build artifacts?
currently the artifacts are the generated html file from the original xml files.
thanks.
If the orginal xml files from nunit,dotcover and fxcop are located within your Build Folder you will be enter the path to them to include them as artifacts.

Resources