CZEMacLeod / MSBuild.SDK.SystemWeb

This MSBuild SDK is designed to allow for the easy creation and use of SDK (shortform) projects targeting ASP.NET 4.x using System.Web.
MIT License
151 stars 8 forks source link

error : Could not open Source file: Could not find file 'Web.config;Web.config' #60

Closed aelij closed 1 year ago

aelij commented 1 year ago

This issue is just to log this error in case anyone else encounters it:

C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VisualStudio\v17.0\Web\Microsoft.Web.Publishing.targets(1552,5):
error : Could not open Source file: Could not find file 'C:\Project\Web.config;Web.config'. [Project.csproj]

This happened when a project was migrated to SDK-style, while keeping the explicit Content items.

Fix: Add <EnableWebFormsDefaultItems>false</EnableWebFormsDefaultItems> or remove the explicit items.

Thanks for building this package!

CZEMacLeod commented 1 year ago

@aelij Thanks for logging this - there is 'special' handling for web.config files, including publishing, transforming and deploying, as well as handling updating binding redirects. In many cases, you don't need to have the Content or Compile items at all in your project file. As you say, you can also disable the default includes if you wish to keep the explicit items in the project file (although that loses one of the advantages of the sdk style projects). Otherwise, I hope you are finding this project useful. Please let us know if there are any other issues you find using the project.