How To Solve “GatherAllFilesToPublish” Error?

Issue:

I’m getting an error “GatherAllFilesToPublish”  when tried to publish my code. What’s happening to my csproj file?

---------------------------
Publish failed
---------------------------
Publish has encountered an error.

Build failed. Check the Output window for more details.


A diagnostic log has been written to the following location:

"C:\Users\username\AppData\Local\Temp\1\tmpC98.tmp"
---------------------------
OK   
---------------------------

Error MSB4057: The target "GatherAllFilesToPublish" does not exist in the project

 

Environment:

Windows 10, Visual Studio 2019, C# Project with Framework 4.0

Resolution:

This error is due to incorrect setting on project file (*.csproj). Please follow step-by-step instructions below.

Step-by-step instructions:-

  1. Open you project under Visual Studio
  2. Right click on project name and select “Unload Project”
  3. Right click on project name again and select “Edit *.csproj”
  4. Scroll down to the bottom of the file and you should see following line:
    <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
  5. Replace above line with following two lines:
    <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
    
    <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />

  6. Save the file and right click on project name to Reload the project
  7. Try publish again to see if it solves the issue

Troubleshoot:

If fail again, please verify by going through step 2 to 4 to see if two lines still there.

 

HTTP Error 503. The service is unavailable.

Issue:

I’m getting an error 503 when visited a newly created site in IIS with AppPool account. Is it error in my code?

Service Unavailable
HTTP Error 503. The service is unavailable.

Environment:

Windows 2012 R2, IIS 8.5, ASP.Net

Resolution:

This error happened usually is because app pool is down. To start an app pool service, please follow following steps.

Step-by-step instructions:-

  1. Open IIS Manager on your web server
  2. Browse to “Application Pools”
  3. Verify app pool status by checking status column next to app pool name that is being used by the app
  4. Right click on app pool name and select “Start” to start app pool service
  5. Go to web browser and check if the application is up and running

Troubleshoot:

For ASP.Net project, is always good idea to turn off custom error on development server. Do not  turn off custom error on production server to avoid security risk. To turn custom error off, change mode to “Off” on web.config:

<customErrors mode="Off" />