Ismayil S
Ismayil S

Reputation: 243

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. enter image description here

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 ------

enter image description here

Regards.

Upvotes: 1

Views: 2270

Answers (2)

YoyoS
YoyoS

Reputation: 659

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
%}}%

Upvotes: 1

LoLance
LoLance

Reputation: 28086

Have reproduced same issue in my machine. And resolve it by workaround from it3xl.

  1. Create a Text Document file in desktop and copy the content from this xx.bat file into it. (for professional editon)

  2. Save and rename the text document from xx.txt to Test.bat

  3. Double click the Test.bat file, then this issue goes away when i rebuild them by devenv command.

Hope it helps.

Upvotes: 3

Related Questions