After execute MSbuild task (under TFS2017) with the following parameters:
/m /property:StyleCopTreatErrorsAsWarnings=false /property:StyleCopEnabled=true /p:SkipInvalidConfigurations=true
the compilation succeed. The warning is shown under Summary / build but my expectation is that the compilation would have to finish with error.
The warning is:
Warning : CA1822 : Microsoft.Performance : The 'this' parameter (or 'Me' in Visual Basic) of ...
Are the MsBuild parameters set incorrectly?
By default all rules for code analysis - warnings. You have to set for critical rules an error property:
Select code analysis:
Update the rule properties:
That`ll generate a new ruleset file to your project
You get a failed build
Also you may create any custom ruleset and use it for your builds: How do I specify a ruleset from MSBuild
Related
When using SonarScanner, following the suggested manual recipe for classic .NET and MSBuild - so all required properties and variable are passed to the CLI tool - I find the following error at the bottom lines:
ERROR: Project not found. Please check the 'sonar.projectKey' and 'sonar.organization' properties, the 'SONAR_TOKEN' environment variable, or contact the project administrator.
What's wrong? How to resolve this?
Task("Nunit")
.Does(() => {
DotNetCoreTest("D:\Workspace\Proj14\test\test\WebAutomation\NUnit\UserManageLMTWS.cs", );
});
Currently have by build.cake defining the task as such as listed in the https://cakebuild.net/api/Cake.Common.Tools.DotNetCore/DotNetCoreAliases/8191BBC4 example. I don't have any settings, as I guess I'm building into Debug instead of Release, but I am getting the following errors when running the task:
Error: Bootstrapping failed for 'D:/Workspace/Proj14/test/test/Nunit'.
Nunit, line #0: Could not find script 'D:/Workspace/Proj14/test/test/Nunit'.
Do I need to pass NUnit into the DotNetCoreTest method somehow?
DotNetCoreTest is meant to test projects and not individual files.
So you specify either the <PROJECT> | <SOLUTION> | <DIRECTORY> file i.e.
DotNetCoreTest("./test/Project.Tests/", settings);
DotNetCoreTest("./test/My.sln", settings);
DotNetCoreTest("./test/Project.Tests/Project.Tests.csproj", settings);
DotNetCoreTest calls to the .NET SDK CLI command dotnet test.
The error you're receiving though is because the path to the specified script is wrong / doesn't exist. There's no file called D:/Workspace/Proj14/test/test/Nunit which is why error message says Could not find script 'D:/Workspace/Proj14/test/test/Nunit'
I'm using the Microsoft.CodeAnalysis.Emit to compile a Visual Basic project and generate .dll file with following compilation options.
VisualBasicCompilationOptions(OutputKind.DynamicallyLinkedLibrary, optimizationLevel: OptimizationLevel.Debug);
Following error is thrown by the emitter for all VB projects I tried to compile. Please advice how to resolve this.
vstest.executionengine.x86.exe Error: 0 : xxxxx -,
C:\Projects\xxxx\xxxxx\My Project\Settings.Designer.vb(67,48): error
BC30002: Type 'Global.xxxx.xxxx.Console.VBTestApp.My.MySettings' is
not defined.
To compile the generated Settings.Designer.vb file correctly, you have to set the root namespace of the project to the same one the file was generated with. In your case, that seems to be xxxx.xxxx.Console.VBTestApp, so your options should be:
new VisualBasicCompilationOptions(
OutputKind.DynamicallyLinkedLibrary,
optimizationLevel: OptimizationLevel.Debug,
rootNamespace: "xxxx.xxxx.Console.VBTestApp")
I have a small assignment where I used TensorFlow to create music:
https://github.com/tensorflow/magenta
When I run the code --- bazel test //magenta:all
I get the following error:
WARNING: /home/admin/.cache/bazel/_bazel_admin/fb30f33370a5b97d4f9b1dde06f8f344/external/protobuf/protobuf.bzl:90:19: Variables HOST_CFG and DATA_CFG are deprecated in favor of strings "host" and "data" correspondingly.
WARNING: /home/admin/.cache/bazel/_bazel_admin/fb30f33370a5b97d4f9b1dde06f8f344/external/protobuf/protobuf.bzl:96:28: Variables HOST_CFG and DATA_CFG are deprecated in favor of strings "host" and "data" correspondingly.
INFO: Found 2 targets and 0 test targets...
INFO: Elapsed time: 4.977s, Critical Path: 0.66s
ERROR: No test targets were found, yet testing was requested.
When you run
bazel test magenta:all
This means "execute all *_test rules defined in file magenta/BUILD.
When I look at that file, there are no tests defined there.
https://github.com/tensorflow/magenta/blob/master/magenta/BUILD
You should try:
bazel test magenta/...
This translates to all things that are included in magenta folder, including other packages. For more information, please see:
https://bazel.build/versions/master/docs/command-line-reference.html
Hello I've a problem with the configuration of jenkins in order to use the plugin of Sonar.
I've set the properties into the file sonar-project.properties, that looks like the following code:
pom.groupId=groupID
pom.artifactId=artifactID
sonar.sourceEncoding=iso-8859-15
sonar.java.target=1.5
sonar.java.source=1.5
sonar.projectKey=projectkey
sonar.projectName= projectname
sonar.projectVersion=1.0.0
While I'm trying to do the building I got the following error in the console of Jenkins:
Exception in thread "main" org.sonar.runner.RunnerException: You must define mandatory properties: sources
at org.sonar.runner.Runner.checkMandatoryProperties(Runner.java:92)
at org.sonar.runner.Runner.execute(Runner.java:75)
at org.sonar.runner.Main.main(Main.java:61)
Build step '**** custom Sonar analysis' marked build as failure
Finished: FAILURE
Do you have any suggestion? Where do I set this properties?
Thanks in advance.
"sonar.sources" property is mandatory: it tells SonarQube where your source files are located.
Everything is explained in the online documentation:
Analysis Parameters
How to run an analysis with SonarQube Runner