visual studio build xcopy command exited with code 2 - c#

I try to run a c# project. However, in builds. It said
Severity Code Description Project File Line Suppression State
Error The command "xcopy C:\Project\BusinessObject\bin\Debug\*.* "C:\Program Files (x86)\Telerik\Reporting Q3 2014\Report Designer\FM_DLLs" /r /y" exited with code 2.
I am using Windows 7 32 bit. And I found the "Program files (x86)" does not exist, is this the problem? How should I solve it?
Thanks

Related

Building .NET Framework 4.8 project in Docker fails with "Reached end of stream before end of read"

My Dockerfile looks like this:
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8 AS build
WORKDIR /projectName
COPY . .
RUN nuget restore
COPY . .
WORKDIR /repoName/projectName
RUN msbuild ./projectName.csproj /p:Configuration=Debug
Locally, the msbuild step gives me no problems. Without a .dockerignore file, the build fails:
Process is terminated due to StackOverflowException.
When I add a .dockerignore file that looks like this...
./.git
./.idea
./.vs
./gen
./packages
./irrelevantProject1
./irrelevantProject2
# etc
...the build fails again, but with a different error message:
CompilerServer: server failed - server rejected the request 'Error reading response: Reached end of stream before end of read.' - b6c5574e-55ea-4d7d-adb3-e156ebd65296
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets(71,5): error MSB6006: "csc.exe" exited with code -2146232797. [C:\repoName\projectName\projectName.csproj]
Done Building Project "C:\repoName\projectName\projectName.csproj" (default targets) -- FAILED.
Build FAILED.
"C:\repoName\projectName\projectName.csproj" (default target) (1) ->
(CoreCompile target) ->
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets(71,5): error MSB6006: "csc.exe" exited with code -2146232797. [C:\repoName\projectName\projectName.csproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:31.66
The command 'powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; msbuild ./projectName.csproj /p:Configuration=Debug' returned a non-zero code: 1
I've been stuck on this problem for days. Any advice would be greatly appreciated.
Allocating more memory to the build solved this problem.
docker build -t projectName -m 4g .
A collegue of mine points me this compiler bug https://github.com/dotnet/roslyn/issues/59336
According to comments, compiler crashes on anonymous delegate function declaration and also when preview features are used (like "!!" syntax) but then removed from recent compiler version.
Fix is not yet available in recent Docker SDK .Net 4.8 image

How to build Visual studio Setup project using command-line?

I have a sample WPF project and I created a Setup project to it. Now I want to build the project and Setup project through the command line.
I tried with this
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe
C:\Users\nandh\source\repos\CommendApp\CommendApp\CommendApp.csproj
command for build the project file it is successfully worked.
Then use with
devenv /build Debug
"C:\Users\nandh\source\repos\CommendApp\CommendApp.sln" /project
"C:\Users\nandh\source\repos\CommendApp\App\App.vdproj" /projectconfig
Debug
for build the setup project it shows error.
------ Starting pre-build validation for project 'App' ------
ERROR: An error occurred while validating. HRESULT = '8000000A'
------ Pre-build validation for project 'App' completed ------
Regards.
Have reproduced same issue in my machine. And resolve it by workaround from it3xl.
Create a Text Document file in desktop and copy the content from this xx.bat file into it. (for professional editon)
Save and rename the text document from xx.txt to Test.bat
Double click the Test.bat file, then this issue goes away when i rebuild them by devenv command.
Hope it helps.
Here is my build.bat script using Visual Studio Installer Projects Extension in Visual Studio 2022. Hope it helps someone.
#echo off
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
set "{{=setlocal enableDelayedExpansion&for %%a in (" & set "}}="::end::" ) do if "%%~a" neq "::end::" (set command=!command! %%a) else (call !command! & endlocal)"
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
del build.log
%{{%
"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\devenv.exe"
XXXX.sln
/out build.log
/build Release
/project XXX.Setup\XXX.Setup.vdproj
/projectconfig Release
%}}%

SonarQube analysis could not be completed because the analysis configuration file could not be found

SonarQube is giving me below error when i integrate the xamarin app with jenkins on windows sever
SonarQube Scanner for MSBuild 3.0
Default properties file was found at C:\SonarQube\bin\SonarQube.Analysis.xml
Loading analysis properties from C:\SonarQube\bin\SonarQube.Analysis.xml
Post-processing started.
13:49:43.952 SonarQube analysis could not be completed because the analysis configuration file could not be found: C:\Users\Administrator\.jenkins\workspace\Xamarin-ProjectTemplate\.sonarqube\conf\SonarQubeAnalysisConfig.xml.
13:49:43.952 Post-processing failed. Exit code: 1
I have followed the below guide https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+MSBuild
SonarQube.Scanner.MSBuild.exe begin /k:"org.sonarqube:sonarqube-scanner-msbuild" /n:"Project Name" /v:"1.0"
MSBuild.exe /t:Rebuild
SonarQube.Scanner.MSBuild.exe end
Please help me to resolve this issue
The errors reported at the end of a SonarQube report are sometimes less helpful than the errors when you begin.
Eg when I got this error, scrolling to the top of the log showed that I wasn't correctly setting the sonar.projectKey value, but this message the OP shared is still what showed up at the end.
I had the same problem. You need find correct MSBuild.exe.
I have several in c:\Windows\Microsoft.NET\Framework64\... and also in c:\Program Files (x86)
For my project in Visual Studio 2017 with .NETFramework,Version=v4.6.1 the correct MSBuild.exe is:
"c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\amd64\MSBuild.exe" /t:Rebuild
For the Enterpsie version is should be:
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild" /t:Rebuild
I got the same error and was able to fix it by excluding "/t:Rebuild" from second step. Also used the VS2017 MSBuild.exe
These are the 3 commands I ran in Windows Command Prompt (CMD):
1>> SonarScanner.MSBuild.exe begin /k:"MyProjectName"
2>> "C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/MSBuild/15.0/Bin/MSBuild.exe" "MySolution.sln"
3>> SonarScanner.MSBuild.exe end
Update I confront this error also , my solution was easy I just build the project in the visual studio then its succeeded.
I had this problem because I used a bad project key (it had a }) inside. I removed the }and the problem was gone.

A bit lost with ILMerge

Thanks for taking some time to help me out.
Using: Microsoft Visual C# 2010 Express
I have two files: RJFCModPackInstaller.exe and Ionic.Zip.dll That i'd like to merge in to one: RJFCModpackInstaller.exe
I've tried to do post-build and havetried multiple GUIs, what can/should I do?
I tried using this:
"$(SolutionDir)ILMerge\ILMerge.exe" /out:"$(SolutionDir)\deploy\$(TargetFileName)" "$(TargetDir)$(TargetFileName)" "$(TargetDir)*.dll" /target:exe /targetplatform:'v4, C:\Windows\Microsoft.NET\Framework64\v4.0.30319' /wildcards
But came out with this error:
Error 2 The command ""C:\Users\FusionD\documents\visual studio 2010\Projects\RJFCModPackInstaller\ILMerge\ILMerge.exe" /out:"C:\Users\FusionD\documents\visual studio 2010\Projects\RJFCModPackInstaller\\deploy\RJFCModPackInstaller.exe" "C:\Users\FusionD\documents\visual studio 2010\Projects\RJFCModPackInstaller\RJFCModPackInstaller\bin\Release\RJFCModPackInstaller.exe" "C:\Users\FusionD\documents\visual studio 2010\Projects\RJFCModPackInstaller\RJFCModPackInstaller\bin\Release\*.dll" /target:exe /targetplatform:'v4, C:\Windows\Microsoft.NET\Framework64\v4.0.30319' /wildcards" exited with code 3. RJFCModPackInstaller
EDIT:
If I change the code to:
C:\Program Files (x86)\Microsoft\ILMerge\ILMerge.exe /out:"$(SolutionDir)deploy\$(TargetFileName)" "$(TargetDir)$(TargetFileName)" "$(TargetDir)*.dll" /target:exe /targetplatform:'v4, C:\Windows\Microsoft.NET\Framework64\v4.0.30319' /wildcards
I get error 9009:
Error 1 The command "C:\Program Files (x86)\Microsoft\ILMerge\ILMerge.exe /out:"C:\Users\FusionD\documents\visual studio 2010\Projects\RJFCModPackInstaller\deploy\RJFCModPackInstaller.exe" "C:\Users\FusionD\documents\visual studio 2010\Projects\RJFCModPackInstaller\RJFCModPackInstaller\bin\Debug\RJFCModPackInstaller.exe" "C:\Users\FusionD\documents\visual studio 2010\Projects\RJFCModPackInstaller\RJFCModPackInstaller\bin\Debug\*.dll" /target:exe /targetplatform:'v4, C:\Windows\Microsoft.NET\Framework64\v4.0.30319' /wildcards" exited with code 9009. RJFCModPackInstaller
There's an extra \ here:
/out:"C:\Users\FusionD\documents\visual studio 2010\Projects\RJFCModPackInstaller\\deploy
^
|
So I'd suggest changing
$(SolutionDir)\deploy
to
$(SolutionDir)deploy
The 9009 error is because you've removed the quotes from around the command now (so it's trying to execute C:\Program). Put those quotes back (or revert to your original command, just without the extra \).

What does this funnelweb command mean in visual studio? and why did it exit with 4?

In visual studio on the post build event command line I have the following:
xcopy $(TargetPath) $(SolutionDir)FunnelWeb.Web\bin\Extensions\ /Y
and its creating the error:
Error 1 The command "xcopy C:\Users\Exitos\Desktop\FunnelWeb-2.0.2.572-source\src\FunnelWeb.Extensions.MetaWeblog\bin\Debug\FunnelWeb.Extensions.MetaWeblog.dll
C:\Users\Exitos\Desktop\FunnelWeb-2.0.2.572-source\src\FunnelWeb.Web\bin\Extensions\
/Y
xcopy C:\Users\Exitos\Desktop\FunnelWeb-2.0.2.572-source\src\FunnelWeb.Extensions.MetaWeblog\bin\Debug\CookComputing.XmlRpcV2.dll
C:\Users\Exitos\Desktop\FunnelWeb-2.0.2.572-source\src\FunnelWeb.Web\bin\Extensions\
/Y" exited with code 4. FunnelWeb.Extensions.MetaWeblog
Im confused as to where the $(TargetPath) and $(SolutionDir) are set, and why this error happened?
xcopy exit codes can be found here: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/xcopy.mspx?mfr=true
I suspect the problem is that you need double quotes around your paths:
xcopy "$(TargetPath)" "$(SolutionDir)FunnelWeb.Web\bin\Extensions" /Y
Becouse of spaces inside your path.
When you open a .sln, $(SolutionDir) is the directory where it came from. If you
want to change it, move the root folder for your .sln file.
Hope it helps.

Categories