1

I am unable to publish my web application. It never completes and also never gives any errors. Rebuild solution works without any issues, it is just when I try to publish to a folder that it does not work.

Web site folder: "Inetpub\wwwroot\mysite" I have few ASP.NET Web Service files.

enter image description here

enter image description here

Target framework: .net 4.8 Visual Studio version: Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.1.0

Any recommendations on what to do?

Darrel K.
  • 1,611
  • 18
  • 28
  • Does this answer your question? [Project builds but can't publish](https://stackoverflow.com/questions/48103014/project-builds-but-cant-publish) – Glen Little Jun 10 '22 at 20:30
  • Thank you. I will give it a try and let you know. In the meantime, I created a PowerShell script to build and publish my applications. – Darrel K. Jun 13 '22 at 04:38

3 Answers3

0

Had the same problem. After a 'Clean Solution' and a rebuild the publish worked fine.

pexxxy
  • 489
  • 1
  • 6
  • 17
0

After trying everything, I finally created a PowerShell script to do the publishing for me.

$MSBuildPath="C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin"

cd $MSBuildPath

.\MSBuild.exe "C:\path\to\project.sln" /p:Configuration=RELEASE /p:publishDir="$env:TEMP\path\to\project\build" /p:WebPublishMethod=FileSystem /p:DeployOnbuild=True /p:GenerateProjectSpecificOutputFolder=false /p:UseWPP_CopyWebApplication=true /p:PipelineDependsOnBuild=false /p:OutDir="$env:TEMP\path\to\project\build"  /p:DefineConstants="NET45 $oraConstant" /p:Platform="Any CPU"

copy "$env:TEMP\path\to\project\build_PublishedWebsites\project\*" "C:\final\path\Publish\" -recurse -Force
Darrel K.
  • 1,611
  • 18
  • 28
0

I tried the other answers to no avail. Tried cleaning solution, deleting obj/bin folders and I also tried updating Visual Studio.

Solution:

I needed to remove the read-only properties on the folder I was publishing to.

Assumption:

I assume this is due to the batch commands in the pre-build event that my service project was using.

Nick4814
  • 302
  • 2
  • 9