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
%}}%
Related
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.
I have a project developed in 4.0 framework and it is working fine when running with visual studio. But when i execute the same project with MSBuild in command prompt , the project not getting build which shows error of "Al.exe is not found"
"C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\Msbuild.exe"
The above issue occurs only if the project contains resource files and build with msbuild through command prompt.
The msbuild command runs through process start methods using the below code,
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Msbuild.exe";
psi.Arguments = "D:\Samples\Localization\cs\LocalizationDemo_2010.csproj" /p:Configuration=Release /nologo /noconlog /fileLogger /fileloggerparameters:logfile="D:\Samples\Localization\cs\build.log";
Process p = Process.Start(psi);
Please anyone help me if you have any ideas about this.
Regards,
Amal Raj
Ensure that your command line invocation of MSBuild uses the same set of build assemblies that your version of Visual Studio uses. You did not specify what version of Visual Studio you are using, but in any case this should set you in the right direction:
In Visual Studio, set the following to Diagnostic: Tools->Options->Projects and Solutions->Build and Run->"MSBuild project build output verbosity".
Build the project and then search the Output window's Build pane for MSBuildToolsPath.
Use that property's value (e.g. C:\Program Files (x86)\MSBuild\14.0\bin) as the path to msbuild.exe when you build from the command line.
EDIT
Now that we know you are using VS 2017 RC, and with credit to https://stackoverflow.com/a/40702534/704808, search for msbuild.exe under %programfiles(x86)%\Microsoft Visual Studio\2017\.
I'm trying to develop a Notepad++ plugin using a nppPlugin.netV0.6 template.
Downloaded from http://sourceforge.net/projects/sourcecookifier/files/other%20plugins/NppPlugin.NET.v0.6.zip/download
I got a build error [SDK path is empty.]
The same template is working in other system (XP also).
Can anyone give me an resolution for this issue?
The build process calls program ildasm.exe. The directory for that program may not have been added to the PATH environment variable. When I installed Visual Studio 2012 Express installer the directory was not added so I added it to the PATH and the build succeeded.
I tracked the problem down by increasing the amount of logging output written by the build process. (Via Tools => Options => Projects and Solutions => Build and run => MS Build ... verbosity.)
Not sure whether your error is identical. Before adding the directory to the PATH the errors below were generated:
1>------ Rebuild All started: Project: NppManagedPluginDemo.VS2010, Configuration: Debug Any CPU ------
1> NppManagedPluginDemo.VS2010 -> C:\Adrian\VS\NppPlugin.NET.v0.5\Demo Plugin\NppManagedPluginDemo\bin\Debug\Demo.dll
1> ILDasm: calling 'ildasm.exe' with /quoteallnames /unicode /nobar /linenum "/out:C:\Users\Adrian_2\AppData\Local\Temp\tmpAB1F\Demo.il" "C:\Adrian\VS\NppPlugin.NET.v0.5\Demo Plugin\NppManagedPluginDemo\bin\Debug\Demo.dll"
1>C:\Adrian\VS\NppPlugin.NET.v0.5\Demo Plugin\NppManagedPluginDemo\DllExport\NppPlugin.DllExport.targets(8,5): error : The system cannot find the file specified
There are several versions of ildasm.exe in sub directories of c:\Program Files (x86)\Microsoft SDKs\Windows\ of my current computer.
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 \).
I'm trying to create a script to compile an Windows Forms C# 2.0 project from the command line (I know, I know.. I'm reinventing the wheel.. again.. but if somebody knows the answer, I'd appreciate it).
The project is a standard Windows Forms project that has some resources and references a couple external assemblies. Here is a list of the files:
Program.cs // no need to expand on this on :)
frmMain.cs // this is a typical C# windows forms file
frmMain.designer.cs // .. and the designer code
frmMain.resx // .. and the resource file
MyClasses.cs // this contains a couple classes
Properties\AssemblyInfo.cs // the Properties folder -- again pretty standard
Properties\Resources.Designer.cs
Properties\Resources.resz
Properties\Settings.Designer.cs
Properties\Settings.settings
References\AnAssembly.dll // an assmebly that I reference from this application
So far I've identified the following programs/tools that I would need:
csc.exe // the C# compiler
al.exe // the assembly linker
resgen.exe // the resource compiler
And this is my script so far:
#echo off
set OUT=Out
set AL=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\al.exe
set RESGEN="C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\resgen.exe"
set COMPILER=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe
echo.
echo Compiler: %COMPILER%
echo.
if "%1"=="/help" goto help
:start
echo Starting...
set REFERENCES=.\References\AReferencedll
set SRCFILES=Program.cs frmMain.cs frmMain.designer.cs MyClasses.cs Properties\AssemblyInfo.cs Properties\Resources.Designer.cs Properties\Settings.Designer.cs
del /Q %OUT%\*
%RESGEN% /compile frmMain.resx,%OUT%\frmMain.resources
cd Properties
%RESGEN% /compile Resources.resx,..\%OUT%\Resources.resources
cd ..
%COMPILER% /target:module /out:%OUT%\app.module %SRCFILES% /reference:%REFERENCES%
%AL% %OUT%\app.module /embed:%OUT%\frmMain.resources /target:winexe /out:%OUT%\app.exe /main:App.Program.Main
goto done
:error
echo Ooooops!
:done
echo Done!!
In the end, no matter how I spin it I get different errors from the linker, or the final executable will just not run - it crashes.
Please help (MSDN didn't help too much..)!
I like to cheat for these kinds of things. Take a working project and run the following command on it
msbuild Project.csproj /t:rebuild /clp:ShowCommandLine
The output of that will show you the command msbuild uses to compile the project, which you can then take and modify as you like.
Is there a reason why you are not using msbuild? It can compile any visual studio project/solution in one command...
msbuild.exe <solution filename>
Just use MSBuild passing in the solution or project file.
The best way to use MSBuild is via the Visual Studio Command Prompt; it sets all the required environment variables for you. This command setup is also available in the SDK.