Errors when trying to publish .Net Maui project after previous success - c#

I have been working on a .Net Maui app to replace a Python app I built for my company's payroll team. Several previous iterations of this app have allowed me to publish via sideloading. However, I have been unable to publish a new version for a couple of days now.
If I try to publish via sideloading, I get the following error:
MSB4057 The target "_GenerateAppxPackage" does not exist in the
project.
--this error claims to be stemming from line 1 of my .csproj file.
I attempted another route to publish it as an executable file following the answer provided in this stack overflow answer, and received the following error:
C:\User\MyFirstName : general error c1010070: Failed to load and parse the manifest. The system cannot find the file specified.
As well as another error that says looking for the manifest existed with a code 31.
Further up, before that error hits, there is a line that says:
Skipping target "MauiGeneratePackageAppxManifest" because all output
files are up-to-date with respect to input files.
I am running VS 17.4.0 Preview 3.0 on Windows 11. I have tried to roll back my code through git (up to 3 versions back), as well as copying local files into a new project, and I get these same errors every time.
It may also be worth mentioning that my Windows Defender and Windows Malicious Software Removal Tool both updated between when I was last able to publish successfully and when the problem arose. I had also updated Visual Studio, but tried to roll that back and publish, and it received the same errors.
Is there anyone who can help me figure out what is going on here, or point me in the right direction? I can provide code samples if need be, though on a limited basis because this is a private project.

For this, you can refer to document : Publish a .NET MAUI app for Android/IOS/Windows.
Above documents explain the steps to publish android, ios and windows app, respectively.
You can follow the steps step by step. Under normal circumstances, there will be no problem.

Related

ASP.NET Core or ASP.NET Core MVC solution fails to run, IIS Express throws HTTP Error 500.30 - ASP.NET Core app failed to start

I've been having this error happen on even the simplest "Hello world" ASP.NET Core web app in Visual Studio. (Win 10 Pro, IIS Express, VS 2019 CE.) Steps to reproduce:
Create a new ASP.NET Core or ASP.NET Core MVC solution in Visual Studio 2019. Select the options to generate the scaffolding code for the basic "hello world" app. It doesn't matter whether you target .NET Core 2.1, .NET Core 3.1, or .NET 5.0, the result is the same in the scenarios I attempted.
The project and solution loads and the source code is visible and looks correct. Press F5 to run it. App compiles but does not run.
Expected behavior: the "hello world" app loads.
Actual behavior: shows this error message in the web browser:
"HTTP Error 500.30 - ASP.NET Core app failed to start" (and some
troubleshooting steps, then) "For more information visit:
https://go.microsoft.com/fwlink/?LinkID=2028265".
Go ahead and follow that link, then use those resources to double-check that you have all the needed packages and your IIS is configured properly. Mine was all looking good on my machine, but still I was getting this error. I even tried reinstalling VS, the hosting bundle, IIS, etc. but to no avail.
NOTE: This issue is a little different than the "500.32 ANCM Failed To
Load DLL" or the "500.36 ANCM Out-Of-Process Handler Load Failure"
errors, but I also encountered those during my troubleshooting, so I'm
mentioning them here in case it helps someone else.
NOTE ALSO: you do not necessarily have a corrupted ASP.NET Core
Module as this documentation would have you believe.
Check the event logs, you'll find some errors in there, but those are not particularly helpful in diagnosing the issue in this case. In my case, it just says
"Application '/LM/W3SVC/2/ROOT' with physical root 'H:\Repo
(R;)\sandbox\AspNetCoreWebApp001\AspNetCoreWebApp001' failed to load
coreclr. Exception message: CLR worker thread exited prematurely"
and
"Application has exited from Program.Main with exit code =
'-2147450743'. Please check the stderr logs for more information."
They show IIS Express AspNetCore Module as the source. Vendor docs were not terribly helpful on this scenario.
Double check to be sure you've got your IIS configration correct, and that you have the right packages installed, including the .NET Core Hosting Bundle. If you don't, or if you're trying different configurations like I was during troubleshooting, then you might see the ANCM errors mentioned above. If you get those errors, here are two links that can help. I read those links and checked my machine carefully, multiple times. In my case, this was all correct and complete, and I still had the error.
Fight with the computer some more, call it some bad names, reinstall Visual Studio for the 3rd time, verify IIS settings for the 8th time, ask your friends for help, check SO and Google yet again. The simple hello world app still won't run, same error. It runs on another machine, so there's nothing wrong with the code itself.
This was the solution that eventually fixed it on my machine: I moved the solution to a different folder. HUH??? How could that possibly fix this issue, I asked. After more head-banging, I eventually arrived at the root cause: a semicolon in the path. Yup. In my case, I had been storing the solution in a directory called "H:\Repo (R;)". It turns out, even though the ; character is allowed by the Windows OS, the .NET CLR does not like it at all and doesn't know what to do with it. So it generates the unhelpful error message.
Try it out. Rename the folder of your "this should be working" solution to remove the semicolons, close and reopen the solution in VS, press F5 and watch it run. Or go to a working solution and rename the folder to contain a semicolon and watch it break the CLR.
I was curious whether any other special characters in a folder name would cause an issue, so I checked them all (on folders, not on filenames, but I'd expect a similar result for filenames too). Here's my exhaustive test:
Windows disallows these in folder names:
\/:*?"<>|
The solution will load and run when the path contains any of these special characters:
`~-_+=',.()[]{}!##$%&
However, having any of these characters in the path, while being allowed by Windows, will cause issues in the CLR or in Visual Studio:
; Causes "HTTP Error 500.30 - ASP.NET Core app failed to start"
^ VS fails to load the solution & shows error message as follows:
"The following files were specified on the command line: <the .sln file>
These files could not be found and will not be loaded."
A totally empty instance of VS loads instead.
I also tried creating a new "hello world" console app in VS under a folder containing a semicolon in the name, and guess what? That also fails to run. Though in that case, obviously there is no HTTP error from IIS. Instead, it says
"Failed to create CoreCLR, HRESULT: 0x80070057"
and throws a process exit code. Once again, it's the result of having a semicolon in the path, because removing that semicolon from the path and reloading the solution in VS allows it to run correctly. So the semicolon issue seems to be originating from the CLR and therefore is unrelated to IIS.
Here are some related posts regarding the root cause, which is not readily apparent for web apps running on IIS Express:
Failed to create CoreCLR, HRESULT: 0x80070057
https://github.com/dotnet/sdk/issues/13954
So, kudos to those authors for those posts which were very helpful in the RCA.
One would think that the special characters allowed by the OS would also be fair game to use in the path to your Visual Studio code. Oh well. Lesson learned.

Http Error When Running .NET Core App After Upgrade

I have a program that was written in .NET Core 1.0 in an old TFVC repo and I decided it was time to update it to Core 3.1.
So, I first converted the TFVC repo to a GIT repo. All was good. I then followed along with the Microsoft docs to upgrade from 1 to 2, 2 to 3, and so on. Everything seemed pretty straight forward, and I now have a my project updated without any errors in Visual Studio.
My issue is that when I run my app, I get the following error:
http error 500.37 - ancm failed to start within startup time limit
I have attempted to change the timeout time, but no matter how long I set it to, I always get that error once the timeout is reached. I have also made sure to look into my computer resources when this app is started, and there are no spikes in CPU or memory.
I assume this error was caused somewhere along the lines of upgrading. Does anyone know where I should be looking to solve this? I can add code snippets where required. Thanks!
For the start, if you use IIS, open Computer Management -> Event Viewer -> Window Logs -> Application and try to get more detail message about the error.

Visual Studio Web Apps Publish fails - no errors

I have several ASP.Net web form apps in a Visual Studio project. In one of the apps, I was working to add a test page for some additional features we wanted to test before adding to our main pages. Afterwards however, I was trying to publish to our server, but keep getting a message box saying: "The publish has failed due to one or more errors.".
Build succeeded Image
Publish Failed Image
I checked the errors, but none are given. The build was successful and other then a few un-used references, there are no other indicators on what the issue exactly is. We have a few other projects that normally allow for publishing without issues. So I don't believe the issue is from Visual Studio, but I am not completely sure. I'm using Visual Studio 2015 version 14.0.24720.00
Figured it out!
There is a Thumbs.db file that was auto-generated in the images folder. I decided to go through the output window line by line to see if I could identify where the publish was failing at. I noticed a line that said the /Images/Thumbs.db file could not be published and that access was denied.
Doing some more online investigating, I found some other questions along the same line as the premise for this one. Specifically the question here was most helpful. Tammy Spencer's (#user:973679) answer to try and delete the file was what made the publish succeed. So thank you Tammy.
In addition, the Thumbs.db file wouldn't let me delete it at first. But after doing some more searching, I found this YouTube video that made the file deletable.

UWP app WACK test fails & outputs debug irrespective of chosen settings

I am trying to create a package of my UWP app and put it through a WACK test.
Windows App Certification Kit - Test Results is FAIL. I think it's because VS2015 is outputting a debug build irrespective of the settings i've chosen.
Has anyone come across this problem before?
Is visual studio ignoring my settings, or does my project include a library that's not going to pass WACK?
'Release' is selected both in the build menu and in Output Package dialogue.
JSON.net and EF7 only, both are UWP compatiable. Tasks and DataAccess are a background task and a class library.
File C:\Program Files\WindowsApps\f0679d56-bdc0-4305-837e-16b5560c7c41_1.0.14.0_x86__ade4xr40r36he\coreclr.dll has failed the AppContainerCheck check.
File C:\Program Files\WindowsApps\f0679d56-bdc0-4305-837e-16b5560c7c41_1.0.14.0_x86__ade4xr40r36he\dbgshim.dll has failed the AppContainerCheck check.
File C:\Program Files\WindowsApps\f0679d56-bdc0-4305-837e-16b5560c7c41_1.0.14.0_x86__ade4xr40r36he\mscordaccore.dll has failed the AppContainerCheck check.
File C:\Program Files\WindowsApps\f0679d56-bdc0-4305-837e-16b5560c7c41_1.0.14.0_x86__ade4xr40r36he\mscordbi.dll has failed the AppContainerCheck check.
i also have the same issue and it is caused due to EntityFreamework.Commands reference. When you building the code for store package or release mode just remove all references of EntityFramework.commands by uninstalling from nuget.
that should help to get rid of those errors. for more information please go here. let me know how it went.. all the best.
I am now using VS2015 preview 2 and everything is building with it just fine. I get no errors in the WACK.
Microsoft just decided to release .net native a year before it could actually compile things properly.

Visual C# "Unable to Open Project"

I've been using Microsoft Visual C# 2008 Express Edition for the past two years. I made some very slight changes to a single project last night and now want to open the project and make a couple of changes. Out of the blue I'm getting the following message when I try to load the project:
Unable to read the project file 'myfile.csproj' Could not load file or assembly 'sorttbls.nlp' or one of its dependencies. Incorrect function. (Exception from HRESULT: 0x80070001)
The above message stops me from accessing any part of the project. (I am able to load the source code in Notepad so at least I don't have to worry about losing the code altogether). This error does not seem to be associated to any recent changes to my code as I run into this error when open up a simple console project or try to create a new project. What happened? (Did my computer get infected with a virus?) How do I get past this?
Thanks!
May be you can use following source
sorttbls.nlp Problem
According to which you can uninstall and install .Net 2 or 3.5 and perform Reboot
If you have ATI card above link might solve your problem

Categories