Visual Studio Hangs After Adding Post-Build-Event - batch-file

I am following this tutorial which explains how to attached post-build events to a project.
This is my .bat file (tried with and without the D: remd out):
CMD
ECHO parameter=%1
CD %1
rem D:
COPY WpfFileDeleter.exe temp.exe
"..\..\ILMerge.exe" /out:"WpfFileDeleter.exe" "temp.exe" "Microsoft.WindowsAPICodePack.dll" "Microsoft.WindowsAPICodePack.ExtendedLinguisticServices.dll" "Microsoft.WindowsAPICodePack.Sensors.dll" "Microsoft.WindowsAPICodePack.Shell.dll" "Microsoft.WindowsAPICodePack.ShellExtensions.dll"
DEL temp.exe
And I also added this ILMerge.exe.config as per the tutorial (I was getting the Unresolved assembly reference not allowed error):
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<requiredRuntime safemode="true" imageVersion="v4.0.30319" version="v4.0.30319"/>
</startup>
</configuration>
But when I build my project in VS it just hangs with this message in Output:
1>------ Rebuild All started: Project: WpfFileDeleter, Configuration: Debug Any CPU ------
I can see that some files have been copied to bin/debug, such as the .dlls I specified and temp.exe, but any WpfFileDeleter.exes cannot be run properly as it has not been merged properly.
My question is How can I debug this issue? Is there some way of outputting the results of ILMerge or the build process so that I can see where it is going wrong?

I was able to resolve this by specifying the targetFramework when calling ILMerge in the batch file:
"..\..\ILMerge.exe" /out:"WpfFileDeleter.exe" /targetPlatform:"v4" "temp.exe" "Microsoft.WindowsAPICodePack.dll" "Microsoft.WindowsAPICodePack.ExtendedLinguisticServices.dll" "Microsoft.WindowsAPICodePack.Sensors.dll" "Microsoft.WindowsAPICodePack.Shell.dll" "Microsoft.WindowsAPICodePack.ShellExtensions.dll"

Related

SWUpdate on RPi4 via yocto - error parsing configuration file

After booting SWUpdate yocto-generated image for the first time, executing swupdate results in error message:
Error parsing configuration file: 'globals' section missing, exiting.
I tried to strictly follow SWUpdate's documentation, but it gets short when it comes to yocto integration. I'm using meta-swupdate, meta-swupdate-boards, and meta-openembedded layers together with poky example repository all at Kirkstone tag, building via bitbake update-image and having modyfied local.conf as:
MACHINE ??= "raspberrypi4-64"
ENABLE_UART = "1"
RPI_USE_U_BOOT = "1"
IMAGE_FSTYPES = "wic ext4.gz"
PREFERRED_PROVIDER_u-boot-fw-utils = "libubootenv"
IMAGE_INSTALL:append = " swupdate"
Is there anything else I need to modify to generate the configuration file and be able to run SWUpdate binary properly?
Side question: In the documentation, it's recommended to append swupdate-www to achieve a better web server. However, if I append it, there is no swupdate-www binary inside the `/usr/bin' directory.
As with other recipes folders the recipes-support/swupdate/swupdate/raspberrypi4-64 folder was missing inside the meta-swupdate-boards layer. Therefore, an empty config file was always generated. After adding this folder and all related files, strongly inspired by raspberrypi3 folder, the error was gone and swupdate -h provided the expected output.
There was also one new error during build process thrown by yocto. It was related to missing systemd requirement and was solved by adding:
DISTRO_FEATURES_append = " systemd"
to local.conf

Jenkins - OpenCover batch command cant find pdb files

I am trying to follow these instructions for my system and am as far as step 8 (unit tests & coverage).
When I execute this command on the server it works succesfully:
"C:\Program Files (x86)\OpenCover\OpenCover.Console.exe" -register:user -target:"C:\Program Files (x86)\NUnit.org\nunit-console\nunit3-console.exe" -targetargs:"C:\workspace\Extensions\Extensions\ExtensionTests\bin\Debug\ExtensionsTests.dll -result=TestResult.xml;format=nunit2" -filter:+
If I add it as a Jenkins Batch command step I get:
"C:\Program Files (x86)\OpenCover\OpenCover.Console.exe" -register:user -target:"C:\Program Files (x86)\NUnit.org\nunit-console\nunit3-console.exe" -targetargs:"C:\workspace\Extensions\Extensions\ExtensionTests\bin\Debug\ExtensionsTests.dll -result=TestResult.xml;format=nunit2" -filter:+
Executing: C:\Program Files (x86)\NUnit.org\nunit-console\nunit3-console.exe
NUnit Console Runner 3.8.0
Copyright (c) 2018 Charlie Poole, Rob Prouse
Runtime Environment
OS Version: Microsoft Windows NT 6.3.9600.0
CLR Version: 4.0.30319.42000
Test Files
C:\workspace\Extensions\Extensions\ExtensionTests\bin\Debug\ExtensionsTests.dll
Run Settings
DisposeRunners: True
WorkDirectory: c:\workspace\Extensions
ImageRuntimeVersion: 4.0.30319
ImageTargetFrameworkName: .NETFramework,Version=v4.6.1
ImageRequiresX86: False
ImageRequiresDefaultAppDomainAssemblyResolver: False
NumberOfTestWorkers: 2
Test Run Summary
Overall result: Passed
Test Count: 37, Passed: 37, Failed: 0, Warnings: 0, Inconclusive: 0, Skipped: 0
Start time: 2018-02-23 10:40:58Z
End time: 2018-02-23 10:40:59Z
Duration: 1.106 seconds
Results (nunit2) saved as TestResult.xml
Committing...
No results, this could be for a number of reasons. The most common reasons are:
1) missing PDBs for the assemblies that match the filter please review the
output file and refer to the Usage guide (Usage.rtf) about filters.
2) the profiler may not be registered correctly, please refer to the Usage
guide and the -register switch.
I have tried setting the Jenkins to run under my ID and allowed it to interact with the desktop.
Can someone point me in the right direction to get it running please?
Ahh so I found the answer from this question, I just needed to move a quote to give:
"C:\Program Files (x86)\OpenCover\OpenCover.Console.exe" -register:user -target:"C:\Program Files (x86)\NUnit.org\nunit-console\nunit3-console.exe" -"targetargs:C:\workspace\Extensions\Extensions\ExtensionTests\bin\Debug\ExtensionsTests.dll -result=TestResult.xml;format=nunit2" -filter:+
Which works!

Unable to run a basic Sonar analysis from MSBuild.SonarQube.Runner

I am sure I am missing something but unable to figure out what.
The following commands are executed via the VS2015 command prompt.
D:\Sonar\Project1\msbuild\MSBuild.SonarQube.Runner.exe begin /k:"FC" /n:"FC" /v:"1.0"
msbuild.exe D:\Sonar\Project1\FC.sln
D:\Sonar\Project1\msbuild\MSBuild.SonarQube.Runner.exe end
The sonar-project.properties file that gets automatically created in the out directory under .sonarqube folder shows the following
E0566501-CF6F-454A-88CA-6AEFEA7D0EBC.sonar.projectKey=FC:E0566501-CF6F-454A-88CA-6AEFEA7D0EBC
E0566501-CF6F-454A-88CA-6AEFEA7D0EBC.sonar.projectName=FC
E0566501-CF6F-454A-88CA-6AEFEA7D0EBC.sonar.projectBaseDir=D:\\Sonar\\Project1\\FC
E0566501-CF6F-454A-88CA-6AEFEA7D0EBC.sonar.sources=\
D:\\Sonar\\Project1\\FileComparison\\Form1.cs,\
.
.
E0566501-CF6F-454A-88CA-6AEFEA7D0EBC.sonar.stylecop.projectFilePath=D:\\Sonar\\Project1\\FC\\FC.csproj
sonar.host.url=http://localhost:9000
sonar.sourceEncoding=UTF-8
sonar.visualstudio.enable=false
sonar.projectKey=FC
sonar.projectName=FC
sonar.projectVersion=1.0
sonar.projectBaseDir=D:\\Sonar\\Project1\\FC
sonar.working.directory=C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\.sonarqube\\out\\.sonar
# FIXME: Encoding is hardcoded
sonar.sourceEncoding=UTF-8
sonar.modules=E0566501-CF6F-454A-88CA-6AEFEA7D0EBC
Screenshot of console

Automatically log error and terminate application with SmartAssembly

I'm using SmartAssembly for both general code obfuscation as well as error reporting in an application.
If my application encounters an unhandled exception, I'd like the exception to be logged and then terminate the application without any user interaction. Is it possible to create a SmartAssembly project that allows this?
I've tried setting up the project in the SmartAssembly GUI, as well as on the command-line with no luck. Below is the command and arguments I've tried, but so far I can't determine how to get it to both terminate the app and log the error with no user input.
Create SA Project:
"C:\Program Files\Red Gate\SmartAssembly 6\SmartAssembly.com"
/create shell.saproj input=C:\Repositories\MyApp\src\shell.exe
/output=shell.exe
/reportappname="MyTestApp"
/errorreportingtemplate=standard;continueonerror=false,email:"my#email.com"
/reportprojectname="Shell"
/reportcompanyname="My Company"
Build the project:
"C:\Program Files\Red Gate\SmartAssembly 6\SmartAssembly.com" /build shell.saproj
SmartAssembly includes a few examples of custom ErrorReportingTemplates,
located in Red Gate/SmartAssembly 6/SDK/Exception Reporting/
The examples are lumped into a few categories:
Without UI
Standard
Custom UI
Via Email
Secured Proxy
Silverlight
Silverlight Basic
In each of these folders, there is a .csproj file that one can extend to get their desired results.
Inside the Without UI folder is the project we're after, titled Sample 01 - Without User Interface.csproj
If you're just after a .dll to use and don't care about a re-usable solution, edit this file directly and use the resulting .dll file (the alternative being to create a new project, and pull in the reference to SmartAssembly.SmartExceptionsCore).
Edit the OnReportException function to look like the following:
protected override void OnReportException(ReportExceptionEventArgs e)
{
for (int i=0; i<3; i++)
{
if (e.SendReport()) break;
}
e.TryToContinue = false;
System.Diagnostics.Process proc = System.Diagnostics.Process.GetCurrentProcess();
proc.Kill();
}
Here's a Gist of the final result, if you're confused.
Create the project file with the GUI or via cmd:
"C:\Program Files\Red Gate\SmartAssembly 6\SmartAssembly.com"
/create shell.saproj input=C:\Repositories\MyApp\src\shell.exe
/output=shell.exe
/reportappname="MyTestApp"
/errorreportingtemplate=MySmartAssemblyLogger.dll;continueonerror=false,email:"my#email.com"
/reportprojectname="Shell"
/reportcompanyname="My Company"
Build with the GUI or via cmd:
"C:\Program Files\Red Gate\SmartAssembly 6\SmartAssembly.com" /build shell.saproj
According to the example on the website http://www.red-gate.com/supportcenter/Content/SmartAssembly/help/6.7/SA_UsingTheCommandLine
You should replace "standard" with "auto" and that is supposed to send the error report without the user dialog appearing.

Problem Running Ant Script In Netbeans 6.1

I tried to import my ant script. And it successful. But when i compile it. I got this error:
run-selected-file-in-src:
java.io.FileNotFoundException: ..\sounds\voice.wav (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at com.sun.media.sound.WaveFileReader.getAudioInputStream(WaveFileReader.java:205)
at javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1162)
at SimpleSoundPlayer.<init>(SimpleSoundPlayer.java:35)
at SimpleSoundPlayer.main(SimpleSoundPlayer.java:12)
Exception in thread "main" java.lang.NullPointerException
at java.io.ByteArrayInputStream.<init>(ByteArrayInputStream.java:89)
at SimpleSoundPlayer.main(SimpleSoundPlayer.java:16)
D:\Windows\My Document\Latihan\Java\allsrc\ch04src\nbproject\ide-file-targets.xml:7: Java returned: 1
BUILD FAILED (total time: 0 seconds)
This is my folder structure
root
+-build(all *.class store here)
+-images
+-nbproject(netbeans create it)
+-sounds(voice.wav where i want to load)
+-src(all *.java - When i compile. All *.class will store to "build" folder)
+-build.xml
My question is why the class file(SimpleSoundPlayer.class) didn't find "..\sounds\voice.wav". But when i tried it from command-line "java SimpleSoundPlayer" it fine.
Why this happen?
This happens because you use a relative path to load the file : ..\sounds\voice.wav. When you do this, your app is very fragile, because it must be launched from a specific directory to work correctly.
I suspect that NetBeans launches your app from the root folder instead of launching it from the src or build folder.
I would recommend to put the voice.wav in your sources, so that it's copied into the build directory, along with your class files. Then you may load the file using the classloader, thanks to a call to Class.getResourceAsStream().
I FIGURE IT OUT!!!
Special Thx to "JB Nizet". Because him i know why it didn't find the wav file. So i just search how to change the default location(this case in root) netbeans to compile(I want netbeans to compile from "build" folder).
The key is in nbproject/ide-file-target.xml
root
+-build(all *.class store here)
+-images
+-nbproject(netbeans create it)
+-sounds(voice.wav where i want to load)
+-src(all *.java - When i compile. All *.class will store to "build" folder)
+-build.xml
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="../build" name="chap04 - Sound Effects and Music-IDE">
<!-- TODO: edit the following target according to your needs -->
<!-- (more info: http://www.netbeans.org/kb/41/freeform-config.html#runsingle) -->
<target name="run-selected-file-in-src">
<fail unless="run.class">Must set property 'run.class'</fail>
<java classname="${run.class}" failonerror="true" fork="true">
<classpath>
<pathelement path="build"/>
<pathelement location="."/>
</classpath>
</java>
</target>
So i just change on <project basedir=".." to <project basediir="../build" where i want netbeans to compile. With this change netbeans will compile that file in "build" folder. AND... WOWWW... That file run correctly :D

Resources