Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

msbuild pack command includes directory structure

I'm using dotnet core 2.0, building in Visual Studio Team Services (VSTS). I added the built-in Visual Studio Build step and am using msbuild with the following arguments:

/p:DeployOnBuild=true
/p:WebPublishMethod=Package
/p:PackageAsSingleFile=true  
/p:SkipInvalidConfigurations=true  
/p:DeployIisAppPath="Default Web Site"  
/p:DesktopBuildPackageLocation="$(build.artifactstagingdirectory)\MyProject.BuildVersion.zip"

This would build a zip file, but the internal structure was ugly and included the entire artifact staging directory as subfolders. E.g., the path inside my zip file until I got to the actual website file structure was Content\d_C\a\1\s\src\MyProjectName\obj\Release\netcoreapp2.0\PubTmp\Out

Is there a way to zip up just the project files and have those in the root of the zip file? I have a workaround using a few extra steps, but it would be nice to be able to use a single build step that also zips everything.

Edit

We use Octopus Deploy for deploying to Azure.

like image 874
ps2goat Avatar asked Jul 19 '26 18:07

ps2goat


1 Answers

Since it is a dotnet core 2.0 project, you can publish project through .NET Core task:

enter image description here

For Visual Studio Build task, you can try to specify /P:PackageTempRootDir="" argument, it will remove source path.

On the other hand, with Azure App Service deploy, the folder structure won’t be remained after deploying to the azure, you can check the folder and files by accessing https://[app name].scm.azurewebsites.net/DebugConsole.

like image 161
starian chen-MSFT Avatar answered Jul 21 '26 07:07

starian chen-MSFT



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!