Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
The error occurs because dotnet restore is forwarding the --framework switch to MSBuild, but MSBuild doesn’t recognize --framework as a valid switch. In the full command line shown, --framework net10.0-windows10.0.19041.0 appears after the project file, so MSBuild treats it as its own switch and fails with MSB1001: Unknown switch.
To restore and build successfully for Azure App Service, use only switches that MSBuild supports and keep dotnet-only options on the dotnet side of the command.
- Run restore using
dotnetwith the framework option (this is adotnet restoreoption, not an MSBuild one):
or, if using the long form:dotnet restore POSJOSEA.csproj -f net10.0-windows10.0.19041.0
Ensure that no response file (dotnet restore POSJOSEA.csproj --framework net10.0-windows10.0.19041.0*.rsp) is appending--frameworkdirectly to the MSBuild invocation. - If a response file is in use (for example
MSBuild.rsporDirectory.Build.rsp), remove the--frameworkentry from that file, because response files must contain only valid MSBuild switches. If needed, disable automatic response files for a test run:
Themsbuild POSJOSEA.csproj -noAutoResponse-noAutoResponseswitch tells MSBuild not to loadMSBuild.rsporDirectory.Build.rspautomatically. - After a successful restore, publish for Azure App Service using
dotnet publishor the Azure DevOps/ GitHub Actions task, again ensuring that only valid MSBuild switches are passed through.
Once the app is successfully built and published to the App Service, the default “Your web app is running and waiting for your content” page will be replaced by the application’s content.
References: