TwinCAT3 - Automation Interface - Display O/P on Jenkins console - c#

Using Automation Interface I could able to build and initiate Activate Configuration in TwinCAT 3.1.4024.4.
If same project under normal run and Activate Configuration, Messages and errors are displayed in the output console of VS2013.
In Automation Interface, Using ErrorItems errors = dte.ToolWindows.ErrorList.ErrorItems; I could only read and display message 1 to 10.
Other Messages has different format TwinCAT System (10000) or PlcTask (350):
Is this will not be captured by dte.ToolWindows.ErrorList.ErrorItems; ?
In the output console of VS2013 there are two options: Show output from build and Show output from twinCAT.
In Automation Interface,I think, i could only read messages from build and no Messages from TwinCAT
Is there any way to read TwinCAT messages Also?
VS2013 console output:
Message 1 The application is up to date 0 0
Message 2 Build complete -- 0 errors, 0 warnings : ready for download! 0 0
Message 3 Additional code checks ... 0 0
Error 4 SA0033: Unused Variable 'fbSum_Test' UnitTestJenkins (UnitTestJenkins\UnitTestJenkins)
Error 5 SA0033: Unused Variable 'fbDegreesToRadians' 4 1 UnitTestJenkins (UnitTestJenkins\UnitTestJenkins)
Error 6 SA0033: Unused Variable 'data' FB_DegreesToRadians_Test.DegreesToRadians_Test1 3 1 UnitTestJenkins (UnitTestJenkins\UnitTestJenkins)
Message 7 Additional code checks complete -- 3 errors 0 0
Message 8 Generate TMC information ... 0 0
Message 9 Import symbol information ... 0 0
Message 10 generate boot information... PLC.UnitTestJenkins 0 0 UnitTestJenkins (UnitTestJenkins\UnitTestJenkins)
Message 11 29.11.2019 09:52:58 477 ms | 'TwinCAT System' (10000): Ein Neustart des TwinCAT Systems wurde von AmsNetId: 10.73.8.239.1.1 Port 32867 angefordert.
Message 12 29.11.2019 09:52:58 614 ms | 'TwinCAT System' (10000): Konfiguration des COM Servers TcEventLogger wird gesichert!
Message 13 29.11.2019 09:52:59 440 ms | 'TwinCAT System' (10000): COM Servers TcEventLogger wird heruntergefahren!
Message 14 29.11.2019 09:53:01 467 ms | 'TwinCAT System' (10000): Konfiguration des COM Servers TcEventLogger wird geladen!
Message 15 29.11.2019 09:53:01 468 ms | 'TwinCAT System' (10000): COM Server TcEventLogger wird initialisiert!
Message 16 29.11.2019 09:53:01 517 ms | 'TwinCAT System' (10000): TcIo Server wurde gestartet: TcIo.
Message 17 29.11.2019 09:53:01 530 ms | 'TwinCAT System' (10000): TcPlc30 Server wurde gestartet: TcPlc30.
Message 18 29.11.2019 09:53:01 537 ms | 'TwinCAT System' (10000): TcRtsObjects Server wurde gestartet: TcRtsObjects.
Message 19 29.11.2019 09:53:01 543 ms | 'TwinCAT System' (10000): TcRTime Server wurde gestartet: TcRTime.
Message 20 29.11.2019 09:53:01 660 ms | 'License Server' (30): license validation status is Valid(3)
Message 21 29.11.2019 09:53:01 704 ms | 'TCRTIME' (200): Intel(R) Core(TM)-i 4'th generation detected
Message 22 29.11.2019 09:53:02 078 ms | 'TwinCAT System' (10000): COM Server TcEventLogger wird gestartet!
Error 23 29.11.2019 09:53:02 108 ms | 'PlcTask' (350): FAILED TEST 'PRG_TEST.fbSum_Test#TwoPlusTwoEqualsFour', EXP: 4, ACT: 3, MSG: The calculation is not correct
Error 24 29.11.2019 09:53:02 168 ms | 'PlcTask' (350): FAILED TEST 'PRG_TEST.fbDegreesToRadians#DegreesToRadians_Test1', EXP: 0.0, ACT: 0.01745329, MSG: The calculation is not correct
Error 25 29.11.2019 09:53:02 228 ms | 'PlcTask' (350): FAILED TEST 'PRG_TEST.fbDegreesToRadians#DegreesToRadians_Test2', EXP: 1.0, ACT: 0.01745329, MSG: The calculation is not correct
Error 26 29.11.2019 09:53:02 388 ms | 'PlcTask' (350): | ==========TESTS FINISHED RUNNING==========
Error 27 29.11.2019 09:53:02 708 ms | 'PlcTask' (350): | Test suites: 2
Error 28 29.11.2019 09:53:03 028 ms | 'PlcTask' (350): | Tests: 4
Error 29 29.11.2019 09:53:03 348 ms | 'PlcTask' (350): | Successful tests: 1
Error 30 29.11.2019 09:53:03 668 ms | 'PlcTask' (350): | Failed tests: 3
Error 31 29.11.2019 09:53:03 988 ms | 'PlcTask' (350): | ======================================
Output on the Jenkins Console: [Could read only first 10 messages]
ActivateConfiguration Errors count: 10
vsBuildErrorLevelLow: Description: The application is up to date
vsBuildErrorLevelLow: Description: Build complete -- 0 errors, 0 warnings : ready for download!
vsBuildErrorLevelLow: Description: Additional code checks ...
vsBuildErrorLevelHigh: Description: SA0033: Unused Variable 'fbSum_Test'
vsBuildErrorLevelHigh: Description: SA0033: Unused Variable 'fbDegreesToRadians'
vsBuildErrorLevelHigh: Description: SA0033: Unused Variable 'data'
vsBuildErrorLevelLow: Description: Additional code checks complete -- 3 errors
vsBuildErrorLevelLow: Description: Generate TMC information ...
vsBuildErrorLevelLow: Description: Import symbol information ...
vsBuildErrorLevelLow: Description: generate boot information...
Exit code is 1
C# Code:
//5.4.1 ITcPlcProject - Automation Interface document
ITcSmTreeItem plcProjectRootItem = sysMan.LookupTreeItem("TIPC^UnitTestJenkins");
ITcPlcProject iecProjectRoot = (ITcPlcProject)plcProjectRootItem;
iecProjectRoot.BootProjectAutostart = true;
iecProjectRoot.GenerateBootProject(true);
sysMan.ActivateConfiguration();
sysMan.StartRestartTwinCAT();
ErrorItems ActivateConfigurationErrors = dte.ToolWindows.ErrorList.ErrorItems;
Console.WriteLine("ActivateConfiguration Errors count: " + ActivateConfigurationErrors.Count);
for (int i = 1; i <= ActivateConfigurationErrors.Count; i++)
{
ErrorItem item = ActivateConfigurationErrors.Item(i);
Console.WriteLine(item.ErrorLevel + ": " + "Description: " + item.Description);
}
Please look in to screenshots of the outputs:
Build&TwinCAToutput

I see that you are using TcUnit.
The problem is that you’re not waiting for TcUnit to finish before you are collecting your ErrorItems. You are only collecting the error items after doing the ActivateConfiguration() and StartRestartTwincat() (that’s why you only get the first 10). You need to wait for TcUnit to finish.
Wrap the running of TcUnit in a while-loop, and ask TcUnit for the results. Once all results are returned (which is done when you have all prints done), you can then use your ErrorItems. So basically, collect the ErrorItems in a while-true loop (but make sure to use a sleep every second or so), and once you have all the results from TcUnit (in other words, the lines ==========TESTS FINISHED RUNNING========== and everything that follows), you can print all error items (or parse them, or do whatever you want with them).
Good luck!

Thank you #Jakob
Your suggestion helped to solve this issue.
After restart, 10 seconds of wait and after each read, 5 seconds of sleep.
sysMan.ActivateConfiguration();
sysMan.StartRestartTwinCAT();
System.Threading.Thread.Sleep(10000);
ErrorItems ACErrors = dte.ToolWindows.ErrorList.ErrorItems;
ErrorItem ACErrorsItems;
int j = 1;
do
{
System.Threading.Thread.Sleep(5000);
ACErrorsItems = ACErrors.Item(j);
j++;
if (ACErrorsItems.ErrorLevel != vsBuildErrorLevel.vsBuildErrorLevelLow)
{
Console.WriteLine("Description: " + ACErrorsItems.Description);
}
} while (!ACErrorsItems.Description.Contains("| 'PlcTask' (350): | ================"));

Independent of the VS ErrorList, another way to access the output window, e. g. to catch the build information:
// access output window in VS
EnvDTE.OutputWindow outWin = ((DTE2)dte).ToolWindows.OutputWindow;
try
{
// get specific output window of the collection
EnvDTE.OutputWindowPane Buildpane = outWin.OutputWindowPanes.Item("Build");
// get text document of the selected pane
EnvDTE.TextDocument BuildtextDoc = Buildpane.TextDocument;
// select all text in the output window
EnvDTE.EditPoint BuildeditPoint = BuildtextDoc.StartPoint.CreateEditPoint();
string Buildtext = BuildeditPoint.GetText(BuildtextDoc.EndPoint);
Console.WriteLine(Buildtext);
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}

Related

Missing "Microsoft.CodeAnalysis" in .net 3.1 install on Ubuntu

I have a .net project that runs in windows with VS code with no issues.
I am trying to run the same project in Ubuntu 20.04.2 with VS code. Run trying to run it with F5, I get the errors:
CSC : error CS8032: An instance of analyzer System.Text.Json.SourceGeneration.JsonSourceGenerator cannot be created from /home/one/.nuget/packages/system.text.json/6.0.6/analyzers/dotnet/roslyn3.11/cs/System.Text.Json.SourceGeneration.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.11.0.0, Culture=neutral, PublicKeyToken=****'. The system cannot find the file specified.. [/home/one/github/fhir/Foo.Service/Foo.Service/Foo.Service.csproj]
CSC : error CS8032: An instance of analyzer System.Text.Json.SourceGeneration.JsonSourceGenerator cannot be created from /home/one/.nuget/packages/system.text.json/6.0.6/analyzers/dotnet/roslyn4.0/cs/System.Text.Json.SourceGeneration.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.11.0.0, Culture=neutral, PublicKeyToken=******'. The system cannot find the file specified.. [/home/one/github/fhir/Foo.Service/Foo.Service/Foo.Service.csproj]
I verified the files are on my system:
roslyn3.11
% lr /home/one/.nuget/packages/system.text.json/6.0.6/analyzers/dotnet/roslyn3.11/cs/System.Text.Json.SourceGeneration.dll
-rwxrw-r-- 1 one one 148K Aug 19 19:48 /home/one/.nuget/packages/system.text.json/6.0.6/analyzers/dotnet/roslyn3.11/cs/System.Text.Json.SourceGeneration.dll
roslyn4.0
one#work ~
% lr /home/one/.nuget/packages/system.text.json/6.0.6/analyzers/dotnet/roslyn4.0/cs/System.Text.Json.SourceGeneration.dll
-rwxrw-r-- 1 one one 164K Aug 19 19:48 /home/one/.nuget/packages/system.text.json/6.0.6/analyzers/dotnet/roslyn4.0/cs/System.Text.Json.SourceGeneration.dll
csproj
one#work ~
% lr /home/one/github/fhir/Foo.Service/Foo.Service/Foo.Service.csproj
-rw-rw-r-- 1 one one 1.8K Nov 10 16:59 /home/one/github/fhir/Foo.Service/Foo.Service/Foo.Service.csproj
It looks like "Microsoft.CodeAnalysis" was missing. So, I installed it with nuget in VS code. I added 'nuget: add package' in VS code to install 'Microsoft.CodeAnalaysis' version 3.11.0.
I have verified it successfully lives on my system:
one#work ...packages/microsoft.codeanalysis/3.11.0
% pwd
/home/one/.nuget/packages/microsoft.codeanalysis/3.11.0
one#work ...packages/microsoft.codeanalysis/3.11.0
% lr
total 80K
drwxrwxr-x 2 one one 4.0K Nov 14 10:08 .
drwxrwxr-x 4 one one 4.0K Nov 14 10:08 ..
-rw-rw-r-- 1 one one 178 Nov 14 10:08 .nupkg.metadata
-rwxrw-r-- 1 one one 19K Aug 10 2021 .signature.p7s
-rwxrw-r-- 1 one one 6.9K Apr 30 2021 Icon.png
-rwxrw-r-- 1 one one 2.2K Aug 3 2021 ThirdPartyNotices.rtf
-rw-rw-r-- 1 one one 28K Nov 14 10:08 microsoft.codeanalysis.3.11.0.nupkg
-rw-rw-r-- 1 one one 88 Nov 14 10:08 microsoft.codeanalysis.3.11.0.nupkg.sha512
-rwxrw-r-- 1 one one 2.4K Aug 3 2021 microsoft.codeanalysis.nuspec
I still get the errors mentioned above.

Configure MSBuild.exe cli builds to run incrementally like in Visual Studio builds

Context
For learning purposes, I am trying to develop using a text editor and MSBuild from the command line. My goal is to be able to build as quickly as possible using MSBuild.exe through cli, by skipping already built dependencies.
As described in this link:
There are some significant differences between when projects build in Visual Studio vs. when you invoke MSBuild directly. [...] In MSBuild, when referenced projects are required, a build actually occurs; that is, it runs tasks and tools, and generates the output. [...] When a Visual Studio build finds a referenced project, MSBuild only returns the expected outputs from the referenced project; it lets Visual Studio control the building of those other projects.
Problem Statement
Can I configure my csproj files so that, just like in Visual Studio...
Given a csproj project called A
And there are changes in A since last build
And A has a dependency on a project B that is up to date (already built, no changes since last build)
And A has a dependency on a project C that is not up to date (already built, but there are changes since last build)
When I run MSBuild on project A
Then B is not re-compiled
And C is re-compiled
And A is re-compiled
?
What I tried
I read about incremental build.
I tried to append the following Targets at the bottom of the <Project> node in my csproj files:
 
<Target Name="Build" Inputs="#(CSFile);#(Content)" Outputs="$(TargetFileName)">
<Csc Sources="#(CSFile)" OutputAssembly="$(TargetFileName)"/>
</Target>
This is the configuration depicted in "How to: Build incrementally" by Microsoft
I got MSBuild errors saying the source files were not found
 
<Target Name="Build" Inputs="#(Compile);#(Content)" Outputs="$(TargetFileName)">
<Csc Sources="#(Compile)" OutputAssembly="$(TargetFileName)"/>
</Target>
The same configuration, using Compile item list instead of CSFile item list
I got better results. But...
I got errors saying dependencies were not found
 
<Target Name="Build"
Condition=" '$(_InvalidConfigurationWarning)' != 'true' " DependsOnTargets="$(BuildDependsOn)" Returns="#(TargetPathWithTargetPlatformMoniker)"
Inputs="#(Compile);#(Content)" Outputs="$(TargetFileName)">
<Csc Sources="#(Compile)" OutputAssembly="$(TargetFileName)"/>
</Target>
The same configuration, but expanding from MSBuild's default Build definition
I get plenty of CS0103 and CS0234 errors:
CS0103: The name 'foobar' does not exist in the current context
CS0234: The type or namespace name 'foo' does not exist in the namespace 'bar' (are you missing an assembly reference?)
 
<Target Name="Build"
Condition=" '$(_InvalidConfigurationWarning)' != 'true' " DependsOnTargets="$(BuildDependsOn)" Returns="#(TargetPathWithTargetPlatformMoniker)"
Inputs="#(Compile);#(Content)" Outputs="$(TargetDir)$(TargetFileName)">
<Csc Sources="#(Compile)" OutputAssembly="$(TargetFileName)"/>
</Target>
The same configuration, using $(TargetDir)$(TargetFileName) Output instead of $(TargetFileName)
I don't have errors anymore
But building a second time, with no change whatsoever, still takes time (14 seconds using minimal verbosity on a single csproj inside a 120-projects solution with its dependencies already built from the first build)
58 occurrences of Skipping target "Build" because all output files are up-to-date with respect to the input files.
79 occurrences of Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
Here is an extract of the performance report from diagnostic verbosity :
============================== Build Hierarchy (IDs represent configurations) =====================================================
Id : Exclusive Time Total Time Path (Targets)
----------------------------------------------------------------------------------------------------------------------------------- (TaskId:0)
0 : 19.251s 572.393s some_path () (TaskId:0)
| 55 : 0.000s 0.000s some_path () (TaskId:0)
| 21 : 0.245s 0.963s some_path (GetTargetFrameworks) (TaskId:0)
...
| 43 : 1.465s 10.801s some_path () (TaskId:0)
| 44 : 3.959s 48.216s some_path () (TaskId:0)
| | 55 : 2.260s 5.435s some_path () (TaskId:0)
| 52 : 6.762s 7.694s some_path () (TaskId:0)
| . 112 : 1.089s 1.089s some_path (GetNativeManifest) (TaskId:0)
| 64 : 5.494s 25.018s some_path () (TaskId:0)
| | 139 : 0.212s 0.807s some_path (GetTargetFrameworks) (TaskId:0)
| | . 157 : 0.595s 0.595s some_path (GetTargetFrameworksWithPlatformForSingleTargetFramework) (TaskId:0)
Project Evaluation Performance Summary:
42 ms some_path 1 calls
...
159 ms some_path 1 calls
175 ms some_path 1 calls
213 ms some_path 1 calls
261 ms some_path 2 calls
Project Performance Summary:
2079 ms some_path 18 calls
615 ms GetNativeManifest 6 calls
17 ms GetCopyToOutputDirectoryItems 6 calls
2094 ms some_path 40 calls
247 ms GetTargetFrameworks 10 calls
437 ms GetNativeManifest 10 calls
1 ms GetCopyToOutputDirectoryItems 10 calls
2352 ms some_path 8 calls
260 ms GetTargetFrameworks 2 calls
840 ms GetNativeManifest 2 calls
0 ms GetCopyToOutputDirectoryItems 2 calls
2374 ms some_path 68 calls
292 ms GetTargetFrameworks 17 calls
855 ms GetNativeManifest 17 calls
15 ms GetCopyToOutputDirectoryItems 17 calls
2378 ms some_path 24 calls
266 ms GetTargetFrameworks 6 calls
895 ms GetNativeManifest 6 calls
14 ms GetCopyToOutputDirectoryItems 6 calls
2413 ms some_path 12 calls
241 ms GetTargetFrameworks 3 calls
932 ms GetNativeManifest 3 calls
13 ms GetCopyToOutputDirectoryItems 3 calls
...
34668 ms some_path 8 calls
281 ms GetTargetFrameworks 2 calls
4564 ms GetNativeManifest 2 calls
1 ms GetCopyToOutputDirectoryItems 2 calls
44339 ms some_path 20 calls
252 ms GetTargetFrameworks 5 calls
8828 ms GetNativeManifest 5 calls
0 ms GetCopyToOutputDirectoryItems 5 calls
46147 ms some_path 4 calls
474 ms GetTargetFrameworks 1 calls
4288 ms GetNativeManifest 1 calls
0 ms GetCopyToOutputDirectoryItems 1 calls
52157 ms some_path 16 calls
239 ms GetTargetFrameworks 4 calls
3703 ms GetNativeManifest 4 calls
0 ms GetCopyToOutputDirectoryItems 4 calls
352737 ms some_path 4 calls
419 ms GetTargetFrameworks 1 calls
19594 ms GetNativeManifest 1 calls
0 ms GetCopyToOutputDirectoryItems 1 calls
572226 ms some_path 1 calls
Target Performance Summary:
0 ms BuildGenerateSources 1 calls
0 ms SelectResourceCompile 1 calls
0 ms AfterResourceCompile 1 calls
0 ms _ResourceCompile 1 calls
0 ms AfterBuildCompileEvent 1 calls
0 ms _BuildCompileAction 1 calls
0 ms BuildCompile 1 calls
0 ms BuildLinkTraverse 1 calls
0 ms ComputeLegacyManifestEmbedding 1 calls
0 ms BeforeLink 1 calls
0 ms BeforeResourceCompile 1 calls
0 ms CreateSatelliteAssemblies 80 calls
0 ms ComputeRCGeneratedLinkInputs 1 calls
0 ms _AfterCompileWinFXInternal 59 calls
0 ms AfterCompileWinFX 59 calls
0 ms ComputeCustomBuildOutput 1 calls
0 ms ComputeLinkInputsFromProject 1 calls
0 ms PreLinkEvent 1 calls
0 ms _Xsd 1 calls
0 ms _Link 1 calls
0 ms BeforeCompile 79 calls
0 ms ComputeRCOutputs 1 calls
0 ms _ALink 1 calls
0 ms _ClCompile 1 calls
0 ms _SGenCheckForOutputs 1 calls
0 ms ComputeMIDLGeneratedCompileInputs 1 calls
0 ms _SelectedFiles 1 calls
0 ms PreBuildEvent 1 calls
0 ms BeforeBuildGenerateSources 1 calls
0 ms BuildGenerateSourcesTraverse 1 calls
0 ms AfterMidl 1 calls
0 ms SetCABuildNativeEnvironmentVariables 1 calls
0 ms _Midl 1 calls
0 ms AfterBuildGenerateSources 1 calls
0 ms AfterClCompile 1 calls
0 ms AfterBuildGenerateSourcesEvent 1 calls
0 ms _BuildGenerateSourcesAction 1 calls
0 ms BuildCompileTraverse 1 calls
0 ms BeforeClCompile 1 calls
0 ms ComputeCLInputPDBName 1 calls
0 ms AfterBuild 80 calls
0 ms ComputeReferenceCLInput 1 calls
0 ms FixupCLCompileOptions 1 calls
0 ms SelectCustomBuild 1 calls
0 ms SelectClCompile 1 calls
0 ms _PrepareForReferenceResolution 1 calls
0 ms _Manifest 1 calls
0 ms AfterLink 1 calls
0 ms ResolveLockFileAnalyzers 20 calls
0 ms GenerateAssemblyInfo 20 calls
0 ms _Appverifier 1 calls
0 ms _Deploy 1 calls
0 ms _BuildLinkAction 1 calls
0 ms AfterMarkupCompilePass1 59 calls
0 ms BuildLink 1 calls
0 ms MakeDirsForBscMake 1 calls
0 ms _gRPC_PrepareCompileOptions 4 calls
0 ms AfterResolveReferences 80 calls
0 ms Protobuf_BeforeCompile 4 calls
0 ms AddImplicitDefineConstants 20 calls
0 ms GenerateFakes 20 calls
0 ms InitializeSourceControlInformation 20 calls
0 ms AddSourceRevisionToInformationalVersion 20 calls
0 ms _DefaultMicrosoftNETPlatformLibrary 20 calls
0 ms ComputeCLCompileGeneratedSbrFiles 1 calls
0 ms _BscMake 1 calls
0 ms PrepareProjectReferences 80 calls
0 ms ComputeCLCompileGeneratedXDCFiles 1 calls
0 ms PrepareResources 79 calls
0 ms ResGen 79 calls
0 ms BeforeBuild 79 calls
0 ms CreateCustomManifestResourceNames 80 calls
0 ms _RemoveZipFileSuggestedRedirect 2 calls
0 ms SetWin32ManifestProperties 79 calls
0 ms ResolvedXDCMake 1 calls
0 ms MakeDirsForXdcMake 1 calls
0 ms Protobuf_Compile 4 calls
0 ms _XdcMake 1 calls
0 ms Protobuf_AfterCompile 4 calls
0 ms BeforeResolveReferences 80 calls
0 ms _Protobuf_Compile_BeforeCsCompile 4 calls
1 ms CoreBuild 79 calls
1 ms Protobuf_PrepareCompileOptions 4 calls
1 ms _Protobuf_GatherStaleSimple 4 calls
1 ms GenerateMSBuildEditorConfigFile 79 calls
1 ms ResolvePackageDependenciesForBuild 20 calls
1 ms PrepareResourceNames 80 calls
1 ms GenerateMSBuildEditorConfigFileShouldRun 79 calls
1 ms ComputeManifestGeneratedLinkerInputs 1 calls
1 ms BeforeResGen 79 calls
1 ms AfterCompile 79 calls
1 ms MakeDirsForMidl 1 calls
1 ms ComputeManifestInputsTargets 1 calls
1 ms DoLinkOutputFilesMatch 1 calls
1 ms gRPC_ResolvePluginFullPath 4 calls
1 ms CollectPackageReferences 20 calls
1 ms _CheckWindowsSDKInstalled 1 calls
1 ms AddAssemblyAliasToBclAsync 1 calls
1 ms AfterResGen 79 calls
1 ms _Protobuf_EnforceInvariants 4 calls
1 ms PrepareForRun 80 calls
2 ms _Protobuf_CoreCompile 4 calls
2 ms Compile 79 calls
2 ms FinalizeBuildStatus 1 calls
2 ms BeforeGenerateFakesAssemblies 20 calls
2 ms GenerateBindingRedirects 1 calls
3 ms ResolveReferences 80 calls
3 ms GetTargetPath 79 calls
3 ms MainResourcesGeneration 1 calls
3 ms _CopySourceItemsToOutputDirectory 80 calls
3 ms ComputeIntermediateSatelliteAssemblies 5 calls
3 ms CopyAdditionalFiles 79 calls
4 ms WarnCompileDuplicatedFilename 1 calls
5 ms CopyFileToFolders 1 calls
6 ms SetTelemetryEnvironmentVariables 1 calls
7 ms _PrepareForBuild 1 calls
9 ms MakeDirsForCl 1 calls
10 ms ResourceCompile 1 calls
12 ms GetResolvedWinMD 1 calls
12 ms _ComputePackageReferencePublish 20 calls
12 ms ComputeLinkSwitches 1 calls
12 ms _Protobuf_SanityCheck 4 calls
13 ms _CheckForObsoleteDotNetCliToolReferences 20 calls
13 ms MakeDirsForResourceCompile 1 calls
13 ms Protobuf_ReconcileOutputs 4 calls
14 ms MakeDirsForLink 1 calls
15 ms PlatformPrepareForBuild 1 calls
16 ms InitializeBuildStatus 1 calls
18 ms Protobuf_ResolvePlatform 4 calls
20 ms EnsureNuGetPackageBuildImports 3 calls
22 ms _Protobuf_GatherStaleFiles 4 calls
23 ms _ComputeTargetFrameworkItems 10 calls
27 ms GetNativeManifest 79 calls
28 ms IncludeTransitiveProjectReferences 20 calls
28 ms _Protobuf_AugmentLanguageCompile 4 calls
30 ms ComputeCLOutputs 1 calls
31 ms _CheckForUnsupportedNETStandardVersion 20 calls
31 ms _Protobuf_SelectFiles 4 calls
32 ms EnableIntermediateOutputPathMismatchWarning 20 calls
34 ms ComputeCLGeneratedLinkInputs 1 calls
42 ms Link 1 calls
43 ms SetBuildDefaultEnvironmentVariables 1 calls
46 ms _CheckForUnsupportedCppNETCoreVersion 20 calls
48 ms CoreGenerateAssemblyInfo 20 calls
52 ms _CheckForLanguageAndFeatureCombinationSupport 20 calls
56 ms GenerateSatelliteAssemblies 14 calls
56 ms GetAssemblyAttributes 20 calls
57 ms _ComputeSkipAnalyzers 79 calls
60 ms ResolveCodeAnalysisRuleSet 23 calls
65 ms CheckForImplicitPackageReferenceOverrides 20 calls
68 ms GetCopyToOutputDirectoryXamlAppDefs 60 calls
70 ms _GetProjectJsonPath 20 calls
73 ms Protobuf_PrepareCompile 4 calls
73 ms GetAssemblyVersion 20 calls
74 ms _CopyAppConfigFile 16 calls
102 ms MarkupCompilePass1 1 calls
104 ms ResolveLockFileCopyLocalFiles 20 calls
106 ms _CollectTargetFrameworkForTelemetry 20 calls
107 ms ExpressionBuildExtension 59 calls
110 ms ExpandSDKReferences 80 calls
111 ms _BeforeVBCSCoreCompile 79 calls
113 ms _Protobuf_GatherStaleBatched 14 calls
117 ms ResolveSDKReferences 80 calls
121 ms CleanXsdCodeGen 59 calls
121 ms CreateGeneratedAssemblyInfoInputsCacheFile 20 calls
122 ms ClCompile 1 calls
122 ms GetTargetFrameworksWithPlatformForSingleTargetFramework 78 calls
130 ms GetTargetPathWithTargetPlatformMoniker 79 calls
135 ms FileClassification 59 calls
149 ms ValidationExtension 59 calls
150 ms CopyAutoMapperAssembly 6 calls
155 ms GenerateBuildDependencyFile 20 calls
155 ms BuildOnlySettings 79 calls
156 ms CheckForDuplicateItems 20 calls
158 ms _CopyOutOfDateSourceItemsToOutputDirectory 58 calls
158 ms ApplyImplicitVersions 20 calls
158 ms _PopulateCommonStateForGetCopyToOutputDirectoryItems 80 calls
160 ms _GetRestoreProjectStyle 20 calls
164 ms CreateManifestResourceNames 5 calls
183 ms GenerateTargetFrameworkMonikerAttribute 79 calls
192 ms PreXsdCodeGen 59 calls
194 ms _SetTargetFrameworkMonikerAttribute 79 calls
195 ms Build 80 calls
196 ms _CheckForCompileOutputs 80 calls
196 ms _GenerateSatelliteAssemblyInputs 80 calls
220 ms _SetEmbeddedWin32ManifestProperties 79 calls
225 ms _GenerateCompileInputs 79 calls
238 ms GetFrameworkPaths 80 calls
254 ms PrepareForBuild 80 calls
272 ms ResolveComReferences 1 calls
280 ms GenerateSerializationAssemblies 1 calls
284 ms GetTargetFrameworks 78 calls
286 ms _GetCopyToOutputDirectoryItemsFromThisProject 80 calls
316 ms GetReferenceAssemblyPaths 80 calls
345 ms _ComputeUserRuntimeAssemblies 20 calls
394 ms _CopyOutOfDateSourceItemsToOutputDirectoryAlways 2 calls
402 ms PostBuild 4 calls
431 ms SplitResourcesByCulture 80 calls
480 ms ResolvePackageAssets 20 calls
668 ms AssignTargetPaths 80 calls
965 ms _CheckForInvalidConfigurationAndPlatform 80 calls
1201 ms CopyFilesToOutputDirectory 80 calls
1437 ms CoreResGen 79 calls
1443 ms _SplitProjectReferencesByFileExistence 80 calls
1723 ms AssignProjectConfiguration 70 calls
1744 ms CoreCompile 79 calls
3608 ms ResolveLockFileReferences 20 calls
3660 ms ImplicitlyExpandDesignTimeFacades 59 calls
4645 ms PostBuildEvent 7 calls
4820 ms _CopyFilesMarkedCopyLocal 71 calls
5002 ms ImplicitlyExpandNETStandardFacades 59 calls
6157 ms GetTargetFrameworksWithPlatformFromInnerBuilds 10 calls
6522 ms _GetCopyToOutputDirectoryItemsFromTransitiveProjectReferences 80 calls
8423 ms GetCopyToOutputDirectoryItems 80 calls
14762 ms FindReferenceAssembliesForReferences 79 calls
15969 ms _GenerateCompileDependencyCache 79 calls
15971 ms _ComputeReferenceAssemblies 20 calls
16716 ms IncrementalClean 79 calls
17131 ms _HandlePackageFileConflicts 79 calls
37032 ms _CleanGetCurrentAndPriorFileWrites 79 calls
46860 ms _GetProjectReferenceTargetFrameworkProperties 80 calls
91992 ms ResolveAssemblyReferences 80 calls
1123554 ms ResolveProjectReferences 80 calls
Task Performance Summary:
0 ms ProtoToolsPlatform 4 calls
2 ms CreateItem 5 calls
2 ms GenerateBindingRedirects 1 calls
2 ms FileClassifier 1 calls
3 ms GetFrameworkPath 79 calls
5 ms GetOutOfDateItems 1 calls
8 ms CheckForImplicitPackageReferenceOverrides 20 calls
10 ms RC 1 calls
25 ms AllowEmptyTelemetry 20 calls
25 ms GetAssemblyVersion 20 calls
28 ms ProtoCompilerOutputs 4 calls
32 ms ProtoReadDependencies 4 calls
42 ms Link 1 calls
43 ms SetEnv 8 calls
43 ms ResolveCodeAnalysisRuleSet 23 calls
63 ms MakeDir 101 calls
84 ms CreateCSharpManifestResourceName 7 calls
87 ms GetRestoreProjectStyleTask 20 calls
99 ms MarkupCompilePass1 1 calls
107 ms AssignCulture 81 calls
120 ms CL 2 calls
120 ms GetReferenceAssemblyPaths 59 calls
123 ms CheckForDuplicateItems 60 calls
128 ms ApplyImplicitVersions 20 calls
131 ms Delete 139 calls
169 ms FindAppConfigFile 79 calls
174 ms WriteLinesToFile 100 calls
182 ms Touch 77 calls
257 ms ResolveComReference 1 calls
272 ms Message 246 calls
279 ms SGen 1 calls
376 ms AddFacadesToReferences 3 calls
419 ms ResolvePackageAssets 20 calls
826 ms AssignTargetPath 540 calls
945 ms GenerateResource 4 calls
1526 ms ReadLinesFromFile 80 calls
1570 ms GetDependsOnNETStandard 57 calls
1583 ms AssignProjectConfiguration 70 calls
1948 ms Hash 99 calls
3071 ms RemoveDuplicates 158 calls
3206 ms GetReferenceNearestTargetFrameworkTask 70 calls
3273 ms JoinItems 20 calls
5045 ms Exec 11 calls
5246 ms Copy 234 calls
5592 ms FindUnderPath 403 calls
7557 ms CallTarget 219 calls
9394 ms ResolvePackageFileConflicts 79 calls
13711 ms ConvertToAbsolutePath 79 calls
91537 ms ResolveAssemblyReference 79 calls
1170684 ms MSBuild 327 calls
Anyone knows if/how I can get my configuration to do the minimum required actions?
You are missing a nuget restore task on your project.
MSBuild command line does not execute the nuget restore task automatically but VS IDE does.
So I suggest you could add a additional target for restore.
Note: you should change the content target to use Outputs="$(TargetDir)$(TargetFileName)" to make the target find the final output file.
Solution One
If your projects are all net core projects, you could directly restore the missing packages like this:
msbuild xxx\xxx.csproj -t:restore,build -p:RestorePackagesConfig=true
Solution Two
Or just integrate them into the csproj file:
<Target Name="Build"
Condition=" '$(_InvalidConfigurationWarning)' != 'true' " DependsOnTargets="$(BuildDependsOn)" Returns="#(TargetPathWithTargetPlatformMoniker)"
Inputs="#(Compile);#(Content)" Outputs="$(TargetDir)$(TargetFileName)">
<Csc Sources="#(Compile)" OutputAssembly="$(TargetFileName)"/>
</Target>
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="msbuild -t:restore -p:RestorePackagesConfig=true" />
</Target>
Then, invoke the command line to build it:
msbuild xxx\xxx.csproj -t:build
Conclusion
I suggest you would better use Solution One. Once, you already restored the nuget packages, you do not have to add -t:restore the second time, just use msbuild xxx\xxx.csproj -t:build.

Xamarin.iOS unknown crash when app starts

So I have a weird behavior with an iOS app I'm working on.
When I build my app in Release mode in Visual Studio, it works fine, deploys and runs OK on my iPhone.
Then I do the same thing using XBuild via command line, create the .ipa, deploy it to the same phone, and I get a crash right after the system splashscreen.
The same command line, executed on another mac, provides an .ipa that does not crash.
And the crash stacktrace provided by XCode does not help much:
Date/Time: 2017-06-19 11:22:01.279 +0200
Launch Time: 2017-06-19 11:21:59.536 +0200
OS Version: iOS 8.3 (12F70)
Report Version: 105
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread: 0
Thread 0 name: tid_907 Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x0000000195e37270 __pthread_kill + 8
1 libsystem_pthread.dylib 0x0000000195ed516c pthread_kill + 108
2 libsystem_c.dylib 0x0000000195daeb14 abort + 108
3 MyApp 0x0000000101f9df20 mono_handle_native_crash (mini-exceptions.c:2615)
4 libsystem_platform.dylib 0x0000000195ecc958 _sigtramp + 64
5 libsystem_pthread.dylib 0x0000000195ed516c pthread_kill + 108
6 libsystem_c.dylib 0x0000000195daeb14 abort + 108
7 MyApp 0x00000001020b29c0 mono_log_write_asl (mono-log-darwin.c:40)
8 MyApp 0x00000001020c6188 monoeg_g_log (goutput.c:125)
9 MyApp 0x0000000101f68078 load_aot_module (aot-runtime.c:2060)
10 MyApp 0x0000000101fbd2fc mono_assembly_load_from_full (assembly.c:2099)
11 MyApp 0x0000000101fbce5c mono_assembly_open_a_lot (assembly.c:1779)
12 MyApp 0x00000001020d3168 assembly_preload_hook(_MonoAssemblyName*, char**, void*) (monotouch-main.m:137)
13 MyApp 0x0000000101fbef24 mono_assembly_load_corlib (assembly.c:1478)
14 MyApp 0x0000000101fdf248 mono_init_internal (domain.c:556)
15 MyApp 0x0000000101faa7e8 mini_init (mini-runtime.c:3680)
16 MyApp 0x00000001020d2e84 xamarin_main (monotouch-main.m:420)
17 MyApp 0x0000000101e29b78 main (main.m:245)
18 libdyld.dylib 0x0000000195d1ea04 start + 0
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x0000000195e1cc24 kevent64 + 8
1 libdispatch.dylib 0x0000000195d01e6c _dispatch_mgr_invoke + 272
2 libdispatch.dylib 0x0000000195cf3998 _dispatch_mgr_thread + 48
Thread 2 name: SGen worker
Thread 2:
0 libsystem_kernel.dylib 0x0000000195e37078 __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x0000000195ed2f28 _pthread_cond_wait + 620
2 MyApp 0x00000001020a6228 thread_func (mono-os-mutex.h:146)
3 libsystem_pthread.dylib 0x0000000195ed3dc4 _pthread_body + 160
4 libsystem_pthread.dylib 0x0000000195ed3d20 _pthread_start + 156
5 libsystem_pthread.dylib 0x0000000195ed0ef4 thread_start + 0
Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x0000000000000036
x4: 0x000000016fd10c18 x5: 0x0000000000000000 x6: 0x0000000000000000 x7: 0x0000000000000fa0
x8: 0x0000000008000000 x9: 0x0000000004000000 x10: 0x0000000125d18000 x11: 0x0000000000000fff
x12: 0x0000000000000036 x13: 0x0000000125d14000 x14: 0x0000000000003fff x15: 0x0000000000003fff
x16: 0x0000000000000148 x17: 0x0000000000000010 x18: 0x0000000000000000 x19: 0x0000000000000006
x20: 0x0000000199d10310 x21: 0x0000000102170a64 x22: 0x0000000102170b16 x23: 0x000000016fd11678
x24: 0x0000000000000000 x25: 0x000000012680d080 x26: 0x0000000000000000 x27: 0x00000001023c70b0
x28: 0x00000001023c4c20 fp: 0x000000016fd11610 lr: 0x0000000195ed5170
sp: 0x000000016fd115f0 pc: 0x0000000195e37270 cpsr: 0x00000000
Any ideas, leads, possible origin would be highly appreciated !

Why does my text not print?

Realizing that I should be using Line Print mode (as opposed to label mode) for sending CPCL to the Zebra QL 220 belt printer, I'm in the process of refactoring my working code (Why does everything print on the same line, even though I'm adding crlfs?) to this:
serialPort.Write("! 0 200 200 210 1\r\n");
serialPort.Write(string.Format("! U1 setvar {0} {1}", "device.languages", "line_print"));
serialPort.Write("Hallo die Welt\r\n\r\n"); //Bonjour le Monde --- Hola el Mundo --- Hallo die Welt
serialPort.Write("BARCODE-TEXT 7 0 5\r\n");
serialPort.Write(string.Format("BARCODE 128 1 1 50 150 130 {0}\r\n\r\n", barcode));
serialPort.Write("POSTFEED 120\r\n"); // empirical observation shows 120 is about the right amount of extra tape to expel after printing
serialPort.Write("PRINT\r\n");
This prints the barcode and its human-readable number beneath it (the value in "barcode"),but the text "Hallo die Welt" is not printed. Why not? Do I need a call to Print after each line, or...???
UPDATE
It still prints the barcode only (not "Hallo die Welt") with this code:
serialPort.Write("! 0 200 200 210 1\r\n");
serialPort.Write("! U1 SETLP 7 0 24\r\n");
serialPort.Write("Hallo die Welt\r\n\r\n");
serialPort.Write("BARCODE-TEXT 7 0 5\r\n");
serialPort.Write(string.Format("BARCODE 128 1 1 50 150 130 {0}\r\n\r\n", barcode));
serialPort.Write("POSTFEED 120\r\n");
serialPort.Write("PRINT\r\n");
UPDATE 2
This works (label mode):
serialPort.Write("! 0 200 200 210 1\r\n");
serialPort.Write("TEXT 4 0 30 40 Hallo die Welt\r\n\r\n"); //Bonjour le Monde --- Hola el Mundo --- Hallo die Welt
serialPort.Write("BARCODE-TEXT 7 0 5\r\n");
serialPort.Write(string.Format("BARCODE 128 1 1 50 150 130 {0}\r\n\r\n", barcode));
serialPort.Write("POSTFEED 120\r\n");
serialPort.Write("PRINT\r\n");
It prints:
~~~~~~~~~~~~~~~~~~~~~~~
Hallo die Welt
<barcode as a barcode>
<barcode as a number>
~~~~~~~~~~~~~~~~~~~~~~~
...but this doesn't work (line print mode):
serialPort.Write(string.Format("! U1 setvar {0} {1}", "device.languages", "line_print"));
serialPort.Write("! U1 SETLP 7 0 24\r\n");
serialPort.Write("Hallo die Welt\r\n\r\n");
serialPort.Write("! U1 BARCODE-TEXT 7 0 5\r\n");
serialPort.Write(string.Format("! U1 BARCODE 128 1 1 50 150 130 {0}\r\n\r\n", barcode));
serialPort.Write("! U1 SETLP 5 2 46");
serialPort.Write(barcode);
serialPort.Write("! U1 PRINT\r\n");
The problem is, I need to use Line Print mode.
You also need a \r\n after every SGD command (your setvar in this case)
It should be
! U1
setvar "device.languages" "line_print"\r\n
You also need to put the double quotes around the 2 parameters of the SETVAR command.
UPDATE:
oh, btw, just because the printer is in line_print mode, doesn't mean that it doesn't understand CPCL code. So the code above in your example is CPCL code, not just line print. If you put TEXT in front, it should work

Windows Task Scheduler - Last Run Time and Last Run Result

We have several scheduled jobs running in our various servers. I was looking if I could do something to see all the scheduled tasks along with the last run time and the last run result.
I have looked at this CodeProject article but I couldn't find anything for the last run details.
Also, I have looked at the XML file located at
C:\Windows\System32\Tasks
Using this file I can get the jobs but not the last run details.
I would like to know how I should proceed to get the jobs along with their last run details from remote computers.
You might want to try the managed wrapper for the scheduler API: http://taskscheduler.codeplex.com/
Project is migrated to https://github.com/dahall/taskscheduler
From this 2015 blog post, you can get this data running this PowerShell command:
Get-ScheduledTask | where state -EQ 'ready' | Get-ScheduledTaskInfo | Export-Csv -NoTypeInformation -Path C:\scheduledTasksResults.csv
The result will be on a CSV file, which you can open with Excel and export it as the bellow table:
LastRunTime | LastTaskResult | NextRunTime | ...
21-12-17 20:24 | 0 | 0 | ...
15-05-18 | 12:55 | 0 | ...
14-05-18 19:13 | 0 | 0 | ...
14-05-18 | 19:14 | 0 | ...
30-11-99 01:00 | 267011 | 0 | ...
15-05-18 12:25 | 0 | 16-05-18 | ...
14-05-18 19:13 | 2147500037 | 0 | ...
15-05-18 | 14:15 | 0 | ...
14-05-18 | 19:15 | 0 | ...
15-05-18 | 12:25 | 0 | ...
__
Related with:
Get last run date of task in Windows Scheduled Tasks from ASP.NET

Categories