MSBuild.SDK.SystemWeb icon indicating copy to clipboard operation
MSBuild.SDK.SystemWeb copied to clipboard

Auto added aspnetcore handler and "module"

Open NikolaSivkov opened this issue 7 months ago • 2 comments

Let me start by saying that this project is a godsent!
Thank you for your work and effort on this!

While upgrading asp.net mvc 5 project the following lines got added to the project, possibly by VS 2022's code, possibly by this SDK, i'm not certain, unfortunately.

image

After my project failing to start at all, and just crashing, i found the culprit were those 2 lines.

After removing them, my project just works! And since i'm not sure if the 2 lines were added by this SDK or not, i'm posting here, and maybe it can be added to the docs, so others can save themselves some debugging time :)

NikolaSivkov avatar Nov 21 '23 15:11 NikolaSivkov

Not added by this sdk. Might have been VS. Or depending on how you converted the project and created your launchsettings that might have done it.

CZEMacLeod avatar Nov 22 '23 19:11 CZEMacLeod

I have seen these items get added to the web.config before as well.

I'm pretty sure that it is happening because of a combination of 3 factors:

  • The <ProjectCapability Include="DotNetCoreWeb" /> which allows this SDK to use the modern launchsettings.json
  • Visual Studio's attempt to be helpful by creating these for ASPNet core apps, since these items are basically needed for ASPNet core apps to run in IIS/IISExpress,
  • A few specific versions of VisualStudio (several versions of VS 2017, and at least one version of 2019) appear incapable of detecting which version of .net the IIS application pool should be running under... meaning it thinks it is supposed to be an ASPNET core app instead of seeing it should be .Net Framework, and so it adds those entries

@CZEMacLeod

I know that the DotNetCoreWeb ProjectCapability provides many nice-to-haves

  • project automatically creates launchsettings.json if not exists
  • VS knows that it needs to create an ApplicationHost.config (IIS Express config) file in a "system" folder in the solution directory
  • VS knows to configure appropriate "sitename" and physical path properties in the ApplicationHost.config
  • Plugs the different launch profiles into the scaffolding to make launching easy.

Do you have any desire to investigate what the SDK might need look like if it did not take advantage of the DotNetCoreWeb capability

  • Point the RunCommand at IISExpress.exe and pass some arguments to allow launching IISExpress when "Start Debug" is selected?
  • Use some XMLPeek/XmlPoke/TransformXML (or potentially C# built to dll) to mimic the ability to ensure the ApplicationHost.config in the solution directory
  • Others?

leusbj avatar Mar 19 '24 02:03 leusbj