Simd library compilation fails - visual-studio

I'm trying to build the Simd library on Visual Studio 2017.
https://github.com/ermig1979/Simd
I opened the project from /prj/vs2017w.
I just modified the configuration type from dynamic to static lib.
And I uncommented the #define SIMD_STATIC from the file SimdConfig.h
After the compilation I get this error :
error MSB3073: The command "C:\Users\fullPath\Simd\prj\vs2017w\..\cmd\GetVersion.cmd
error MSB3073: :VCEnd" exited with code 9009
The problem is here when I click on the error :
<Target Name="PreBuildEvent" Condition="'$(PreBuildEventUseInBuild)'!='false'">
<Message Text="Description: %(PreBuildEvent.Message)" Condition="'%(PreBuildEvent.Message)' != '' and '%(PreBuildEvent.Command)' != ''"/>
<Exec Command="%(PreBuildEvent.Command)$(_BuildSuffix)" Condition="'%(PreBuildEvent.Command)' != ''"/>
</Target>
I tried to reload the project etc but nothing works.
Also tried with VS2015 from /prj/vs2015 but same issue.
I just to want to have the Simd.lib in every configuration (x64 / x86 debug & release) for my project.
Any solution ? Thanks for help

There was a bug in Visual Studio project file for Simd Library:
<Command>$(ProjectDir)\..\cmd\GetVersion.cmd</Command>
If project directory has a space then there is an error during calling of pre build script. The solution of this error is very simple - just add quotes to the project directory:
<Command>"$(ProjectDir)"\..\cmd\GetVersion.cmd</Command>

I resolved the issue.. By looking to the output I noticed that the script stops when there is a space in the path ... So he does not have access to the .cmd file.
Thanks

Related

MSB3073 exited with code 3 - Post Build Event in Visual Studio 2017

I am trying to perform registration of the DLL which was created during Build.
In project properties -> Build Events -> Post-Build-Event i have added the below command to perform registration,
regsvr32 /s /c "$(TargetPath)"
This command is used to perform registration of the DLL specified in Target Path.
When i try to Build my code, i am facing following error,
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5):
error MSB3073: The command "regsvr32 /s /c "D:\Project\Debug\x64\SDK.dll"
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5):
error MSB3073: :VCEnd" exited with code 3.
On clicking the error, it navigates to below tags within Microsoft.CppCommon.targets
<Target Name="PostBuildEvent" Condition="'$(PostBuildEventUseInBuild)'!='false'">
<Message Text="%(PostBuildEvent.Message)" Condition="'%(PostBuildEvent.Message)' != '' and '%(PostBuildEvent.Command)' != ''" Importance="High" />
<Exec Command="%(PostBuildEvent.Command)$(_BuildSuffix)" Condition="'%(PostBuildEvent.Command)' != ''"/>
I searched for error MSB3073: :VCEnd" exited with code 3 in few links and found that it occurs when the path specified is invalid or could not be found.
However, the path of the DLL was in the location i specified. I even tried to provide absolute path of DLL within the Post-Build-Event. Yet i'm facing same error.
Am i missing something while performing Post-Build-Event or is there anything to do with regsvr32 command?
MSB3073 exited with code 3 - Post Build Event in Visual Studio 2017
The issue is related to your dynamic library project and not related to VS.
And when you want to register a com dll, the dll project should contain a ID to register into system. However, the dynamic library project does not have the ID by default. So this type of project cannot used as DLLs that will to be registered.
If you still want to use dynamic library project, you should implement DllRegisterServer to add the ID.
You can use ATL projects which contain the ID as dll projects .
This is a similar issue about it.
Solution
1) Instead, you should create ATL projects.
2) Then, in the command, you should remove /c which was abandoned so far.
Or use like this command:
regsvr32 /n /i "$(TargetPath)" as command in post-build event.
=====================
Update 1
Since your project is an old WRT project, you can just create a new WRT runtime component project in VS2017 and then migrate the content of your old project into the new one. It will save you a lot of time and avoid a lot of tedious mistakes.
1) Please install C++/WinRT vs extension first.
2) Then create a new windows runtime componment project and then migrate your old project's content into the new one.
In my side, the project can works well with command regsvr32 /n /i "$(TargetPath)".

Xamarin Forms c# - java exited with code 1 in VS Studio for Windows

I am trying to compile an android app with XF. I am getting the infamous java.exe exited with code 1 error message. I have enabled proguard.
I have gotten the error just from enabling proguard.
The error only seems to happen in VS for Windows. I got a different error in VSMac, but don't have that right here in front of me.
Updating proguard from it's home on sourceforge doesn't seem to do anything for me.
I have put a new proguard.cfg file in my project and have set the build property to be a proguard configuration file.
I don't know what to do here. I'm looking for any suggestions.
TIA.
Update 1:
I didn't add the build output because I couldn't find a good exception in it. I just have the following that I can find in the build output.
I wish I could find the error easily. I had turned on the build output. the only exception i can find is listed below. I checked the targets file and the line reference is for the Proguard section.
1> at proguard.Initializer.execute(Initializer.java:485)
1> at proguard.ProGuard.initialize(ProGuard.java:271)
1> at proguard.ProGuard.execute(ProGuard.java:113)
1> at proguard.ProGuard.main(ProGuard.java:572)
1> Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2550,3):
Link to build output: https://www.dropbox.com/s/jl1o2hf7aeji243/BuildOutput.zip?dl=0

SonarQube Scanner for MSBuild on macOS using mono

I'm trying to use SonarQube Scanner for MSBuild on a Xamarin project on macOS using mono. As MSBuild 15.0 is now shipped with Xamarin, I figured this could actually work.
I can successfully run the scanner's "begin" using mono like so:
mono sonar-scanner-msbuild-2/SonarQube.Scanner.MSBuild.exe begin /k:"KEY"
The command creates the following files:
.sonarqube/conf/SonarQubeAnalysisConfig.xml
.sonarqube/conf/SonarQubeRoslyn-cs.ruleset
.sonarqube/conf/cs/SonarLint.xml
Before running MSBuild, I've added the following import to the csproj files of my solution:
<Import Project="/Users/someuser/.local/share/Microsoft/MSBuild/14.0/Microsoft.Common.targets/ImportBefore/SonarQube.Integration.ImportBefore.targets" />
I'm running MSBuild using:
msbuild /t:Rebuild
Now the build starts correctly but eventually terminates with two errors:
"/Users/someuser/Project/Project.sln" (Rebuild target) (1) ->
"/Users/someuser/Project/Project.UI.iOS/Project.UI.iOS.csproj" (Rebuild target) (2) ->
"/Users/someuser/Project/Project.Core/Project.Core.csproj" (default target) (3:3) ->
(CoreCompile target) ->
CSC : error CS2001: Source file `/additionalfile:/Users/someuser/Project/.sonarqube/conf/cs/SonarLint.xml' could not be found [/Users/someuser/Project/Project.Core/Project.Core.csproj]
CSC : error CS2001: Source file `/additionalfile:/Users/someuser/Project/.sonarqube/conf/Project.Core_AnyCPU_Debug_1267/ProjectOutFolderPath.txt' could not be found [/Users/someuser/Project/Project.Core/Project.Core.csproj]
Both files do exist in the filesystem, the first file was created in the scanner's begin invocation and the second file was created during the MSBuild execution.
Why would MSBuild not be able to find / access these two files? Is there anything that can be done about it?
After checking with the folks taking care of MSBuild, the solution has been provided in this Github issue thread:
To quote radical's comment from the Github issue:
You could try building with csc by passing /p:CscToolExe=csc.exe /p:CscToolPath=/Library/Frameworks/Mono.framework/Versions/4.8.0/lib/mono/msbuild/15.0/bin/Roslyn/ to msbuild
Unfortunately, even though MSBuild works with the above adjustments, SonarQube fails afterwards. I will follow up with the SonarQube people to see whether this can be worked around.

MSBuild: How to ensure AfterBuild target always runs in a C++ project

I have added the following AfterBuild task to a .vcxproj file:
<Target Name="AfterBuild">
<Message Text="Hi" Importance="high" />
</Target>
It seems to run only if the the C++ code is built (or if I do a rebuild):
1>------ Rebuild All started: Project: ConsoleApplication1, Configuration: Debug Win32 ------
1> stdafx.cpp
1> SomeClass.cpp
1> ConsoleApplication1.vcxproj ->
1> Hi
D:\Projects\CppTest\Debug\ConsoleApplication1.lib
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
It doesn't run when the the C++ code is up-to-date:
========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
How can I make it always run? I'm using Visual Studio 2015.
The line
========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
means that Visual Studio didn't run MSBuild at all.
For incremental builds VS uses File Tracker to intercept file operations being performed by compiler and linker. Results can be fould in ProjName.tlog folder. In subsequent builds VS checks dates of files listed in .read and .write files and decides whether to run MSBuild. This feature is described in Hashimi S., Bartholomew S. - Using MSBuild, 2nd Edition - 2013, "File Tracker" chapter.
Some of possible solutions:
Use FileTracker API in your custom build tool.
Manually write file name(s) produced by your tool in some .write file (this solution is simple but is not guaranteed to work in future VS versions).
Build your solution by MSBuild instead VS.
Build your solution from bat-file, which calls devenv first then your tool.
I got around this issue by adding the following lines to my .vcxproj file:
<PropertyGroup>
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
</PropertyGroup>
It seems to force the IDE to actually run MSBuild.
I tested it in Visual Studio 2015. Adding the same lines to an imported .targets file did not help.
There is a setting "Run the post-build event:" in project properties in Visual Studio, and you need to set it to: "Always" for the post-build event to run always.
I guess it's now set to "On successful build".
Build your project with detailed logging (/v:detailed or /v:diag) and find the target which being run last but present in both cases (lets say it's a made up target "FinalCleanup"), then hook your post-build target like this rather than by the special name
<Target Name="RunMyLastTarget" AfterTargets="FinalCleanup">
<Message Text="Hi" Importance="high" />
</Target>
I finally went with Custom Build Step. To ensure that it always runs I set the Outputs field to some dummy file path. Since the dummy file path is never present, the Custom Build Step always runs. It is hacky, but it gets the job done.

How to use MSBuild to build a Visual Studio Setup Project

I am trying to use MSBuild to build a Visual Studio Setup Project using the article below:
http://msdn.microsoft.com/en-us/library/ms404859.aspx
https://web.archive.org/web/20090218033835/msdn.microsoft.com/en-us/library/ms404859.aspx
I have followed all the steps mentioned in the article above with the exception of not using TFS in this case.
Instead of using the TFS option, I am trying to create a Demo.proj file and have included the below details:
** - Demo.proj**
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="AfterCompile">
<Exec Command=""$(ProgramFiles)\Microsoft Visual Studio 9.0\Common7\IDE\devenv" "C:\Users\sapatro\Documents\visual studio 2010\Projects\HelloWorldTest\HelloWorldTestInstaller\HelloWorldTestInstaller.vdproj" /Build "Debug|Any CPU""/>
<Copy SourceFiles="C:\Users\sapatro\Documents\visual studio 2010\Projects\HelloWorldTest\HelloWorldTestInstaller\Debug\HelloWorldTestInstaller.msi; C:\Users\sapatro\Documents\visual studio 2010\Projects\HelloWorldTest\HelloWorldTestInstaller\Debug\setup.exe" DestinationFolder="$(OutDir)" />
</Target>
</Project>
now when I trying to cmd prompt and trying the following command:
msbuild DemoBuild.proj /target:AfterCompile
I am getting the following error:
Build FAILED.
"C:\xxxxxxxxx\Documents\Visual Studio 2010\Projects\HelloWorldTest\DemoBuild.proj" (default target) (1) ->
(AfterCompile target) ->
C:\xxxxxxxxx\Visual Studio 2010\Projects\HelloWorldTest\DemoBuild.proj(4,5): error MSB3073: The command ""C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv" "C:\xxxxxxxxx\Documents\visual studio 2010\Projects\HelloWorldTest\HelloWorldTestInstaller\HelloWorldTestInstaller.vdproj" /Build "Debug|Any CPU"" exited with code 1.
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:01.25
Can anyone help me to resolve this issue.
Thanks & Regards,
Santosh Kumar Patro
This works for me:
<Exec Command=""$(ProgramFiles)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.com" your.vdproj /build "Debug|AnyCPU""/>
You don't need the space in any cpu and you need to call devenv.com, also assuming you have those build configuration existing?
James' answer helped me but I still got an error stating An error occurred while validating.
I had to also do this and finally got it working. For VS2015, add the registry key HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0_Config\MSBuild\EnableOutOfProcBuild and set the value to 0.

Resources