The Command...Exited With Code -532462766 - c#

This is the line that gives me the error.
<Exec Command=""$(MonoGameContentBuilderExe)"
/#:"%(ContentReferences.FullPath)" $(Header)"
WorkingDirectory="%(ContentReferences.RootDir)%(ContentReferences.Directory)" />
It is from the MonoGame.Content.Builder.targets file.
The full error is:
The command ""C:\Program Files
(x86)\MSBuild\MonoGame\v3.0\Tools\MGCB.exe"
/#:"C:\Users\Jake\documents\visual studio
2015\Projects\FirstGame\FirstGame\Content\Content.mgcb"
/platform:Windows /outputDir:"C:\Users\Jake\documents\visual studio
2015\Projects\FirstGame\FirstGame\Content\bin\Windows"
/intermediateDir:"C:\Users\Jake\documents\visual studio
2015\Projects\FirstGame\FirstGame\Content\obj\Windows" /quiet" exited
with code -532462766.
I have been converting this game from Visual Studio 2010 to Visual Studio 2015, which is when this error started. Does anyone have any insight into what may be causing this?

It turned out that I was attempting to load in an image file made in gimp which has an unsupported file type. I just needed to export it as a png and it worked fine.

In my case, the same error code was being thrown by the roslyn compiler when trying to compile cshtml files.
Turns out that the issue was being caused due to roslyn compiler version mismatch. Let me try and explain the problem:
My csproj had nuget references to roslyn compiler assemblies (Microsoft.Net.Compilers and Microsoft.CodeDom.Providers.DotNetCompilerPlatform).
I use git for source control
I had recently updated to the latest version of roslyn compiler on DEV branch
But my MASTER branch was still referencing the previous version of roslyn compiler and I was not yet ready to merge DEV to MASTER
Switching from dev to master branch from team explorer did not seem to trigger "nuget restore" for the mismatched packages
So manually deleting all the folders in the packages folder and performing a "nuget restore" resolved this error for me.

Related

MSBuild is being run from within the "Visual Studio Command Prompt"

I am using VS2017 Enterprise for first the time building my repository. Have cloned code from my VS repository and trying to build it but build failed.
And also i have set environment variable path -->
PATH : C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe
Error message :
Severity Code Description Project File Line Suppression State Error
MSBuild could not locate the Code Analysis tool at
'Drive:\Repo\NugetPackages\CarbonV2.FxCop.SDL.14.0.23107.0\Tools\FxCopCmd.exe'.
If MSBuild is being run from within the "Visual Studio Command
Prompt", specify the path to the Code Analysis tool by setting the
FXCOPDIR environment variable. Demo.Service.Common
Could you please help on this, did i missed any thing?
What's standing out to me is that i'm seeing NugetPackages - leading me to believe you're missing something from Nuget.
https://learn.microsoft.com/en-us/nuget/consume-packages/package-restore#restore-packages-automatically-using-visual-studio
You can install the FXCOP manually, or follow the instructions in that article to have NuGet attempt to get all of the missing packages automatically for you. Hope this helps!

Visual Studio default location issue, when loading external files

When trying to load a file from a target project directory using in C#
Directory.GetCurrentDirectory()
Visual Studio keeps looking for the file in
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\
The problem is that an annoying error about it keeps appearing, although the application builds, compiles and runs without issues, since the file exists in the project target directory.
Does anybody have any idea or previous experience?
Right click on the error -> Show error help, got me to this page, and by doing this, the error disappeared. I am yet to understand, how that had anything to do with the xaml designer.

Sonarqube show bugs number error in c# project

I want to install sonarqube. And I want to see bug etc in my C# project.
But I didn't get results. Can you help me with why I can't?
Install download sonarqube.
Install ms build sonar-scanner.
I write sonar.project-properties and scanner into the bin file.
sonar.projectKey= //projectkey
sonar.projectName= //this same projectkey
sonar.projectVersion=1.0
This project is put bin file.
I added the scanner to path path.
Enter localhost
Create project and enter project key and name (same as name and key in txt)
But this project is empty even though My project is passed.
The code appears when I enter the code section but fields like bug vurnelabilities don't appear.Bugs,vulnerabilities,code smells show zero but passed solution.I know it's the error so I can't 0
I want to appear with the error of my project code there bugs appear areas etc. But "this project is empty" looks like "passed "
Shouldn't code errors appear here?Why can't I see?
Are you aware of SonarLint for Visual Studio
To scan your C# code and push the results to SonarQube you need to use the SonarScanner for MSBuild, not the SonarScanner.
SonarLint is a Visual Studio extension that runs the SonarC# and SonarVB.Net analyzers in the IDE. It does not push the results to SonarQube.
SonarLint is available for VS2015 Update 3 and VS2017.

TeamCity with SonarQube for Code Analysis build fails

Very common problem for many users, that SonarQube Code Analysis fails with an error:
[10:06:05]No ProjectInfo.xml files were found. Possible causes:
[10:06:05]1. The project has not been built - the end step was called right
after the begin step, without a build step in between
[10:06:05]2. An unsupported version of MSBuild has been used to build the
project. Currently MSBuild 12.0 upwards are supported
[10:06:05]3. The build step has been launched from a different working folder
[10:06:05]Post-processing failed. Exit code: 1
[10:06:05]Process exited with code 1
A lot of references say that fix is to use full path for MSBuild.exe, but yes, I use full path, but also I use MSBuild 15.0 version with newest C# version, older MSBuild just fails for new C# features in code.
However I can't get rid of this error and I have no idea what can be done about it, so maybe any of you guys have already met this problem and could help me?
EDITED
I am pretty sure that none of these steps should be the reason for the fail, the second one only the closest one, because my build steps are
Team City build steps look like the following.
Step XX:
cd %projectDirectory%
"C:\sonarqube-5.3\bin\MSBuild.SonarQube.Runner\MSBuild.SonarQube.Runner.exe" begin ... params
"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\msbuild.exe" "MyProject.sln" /t:Clean;Rebuild
Step XY:
...
Step XZ: (the last)
cd %projectDirectory%
"C:\sonarqube-5.3\bin\MSBuild.SonarQube.Runner\MSBuild.SonarQube.Runner.exe" end
For me it looks very simple and easy to understand, but still I got that error and I have no idea why, the error is thrown in the last step (XZ).
You need to upgrade to a newer version of the Scanner for MSBuild. I'd suggest upgrading to the newest available version (v4.2 at the time of writing).
The scanner copies a targets file under the following location for each supported version of MBuild: %localappdata%\Microsoft\MSBuild[MSBuild version]\Microsoft.Common.targets\ImportBefore.
From the look of the log output you are using an version of the Scanner for MSBuild that pre-dates the release of MSBuild 15, so the file won't be copied to the MSBuild15-specific location. This will lead to the "no ProjectInfo.xml files were found" state.
It would be better if the warning message in the scanner log explicitly listed the range of MSBuild versions that were supported e.g. "This version of the Scanner supports MSBuild v12.0 to v14.0". I've created issue #502 to track this.

Xamarin Andorid Build Always Fails ("java.exe" exited with code 2)

I'm trying to build a Xamarin.Android app, but the build always fails with error MSB6006: "java.exe" exited with code 2. I've tried enabling ProGuard and multi-dex, deleting the bin and obj folders, updating all NuGet packages, switching to debug and release modes, and removing all unused references. The error always points to C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets on line 1965, but that does not help. I've been struggling with this issue for days and I have no idea what to do next. These are some SO questions that I've seen, but haven't helped:
"java.exe" exited with code 2
"java.exe" exited with code 2 Xamarin.Android project
Java.exe exited with code 2 in android app build in VS 2015
You can try to enable Multi-Dex in Android project.
Right click on Android project
Options
Android Build
General
Check: Enable Multi-Dex
Now Rebuild the project.
Issue for me was android-sdk path containing "space".
Run following command
mklink /J C:\andsdk "C:\Program Files (x86)\Android\android-sdk"
and change the SDK path in Tools > Options > Xamarin > Android Sdk Location
Enable MultiDex also if doesn't work.
My guess and it's just a guess is this is related to a poorly constructed keystore or something amiss in Java, like an incorrect path. But I don't know what to do next and in the meantime my project is halted.
I fixed this problem by creating a new project and copying the old project's code, resources, and packages to the new one.

Categories

Resources