How to publish multiple project (.csproj) file with individual folder using msbuild powershell
Asked Answered
A

0

1

I have Solution(.sln) file , SLN have multiple project(.csproj). I need to publish all project in individual project Folder. I am using below powershell command , This below command publish all project into one folder instead of Individual Project Folder , Is there any ways to publish in individual project folder.

Powershell Command:

$sln ="E:\Webproject.sln"
$msbuild = "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe"
& $msbuild $sln /p:Configuration=Test /p:DeployOnBuild=true /p:PublishProfile="E:\FolderProfile.pubxml" /MaxCpuCount:8 /p:Configuration=Release /t:Rebuild /p:Platform="Any CPU" -clp:ErrorsOnly

Here iS below E:\FolderProfile.pubxml File

<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121. 
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <DeleteExistingFiles>True</DeleteExistingFiles>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <PublishProvider>FileSystem</PublishProvider>
    <PublishUrl>C:\publishtemp</PublishUrl>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <SiteUrlToLaunchAfterPublish />
  </PropertyGroup>
</Project>
Araxes answered 27/8, 2021 at 11:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.