C
C#3mo ago
AndrewBindon

When I set PublishAot to true, I get "Publish has encountered an error.

When I set PublishAot to true, I get "Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details." The log file says: 12/04/2024 18:28:35 System.AggregateException: One or more errors occurred. ---> Microsoft.WebTools.Shared.Exceptions.WebToolsException: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details. --- End of inner exception stack trace --- ---> (Inner Exception #0) Microsoft.WebTools.Shared.Exceptions.WebToolsException: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details. <--- Microsoft.WebTools.Shared.Exceptions.WebToolsException: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details. ===================
22 Replies
leowest
leowest3mo ago
what else do u have selected?
AndrewBindon
AndrewBindon3mo ago
<PropertyGroup> <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> <AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath> <EnableDefaultItems>false</EnableDefaultItems> <GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<PublishAot>true</PublishAot> <_SuppressWinFormsTrimError>true</_SuppressWinFormsTrimError> <StripSymbols>true</StripSymbols>
<OutputType>Exe</OutputType> <TargetFramework>net8.0-windows7.0</TargetFramework> <RuntimeIdentifier>win-x64</RuntimeIdentifier> <RollForward>Major</RollForward> <ProjectGuid>{47CB82F1-407E-4CC2-8AFD-487200EC0134}</ProjectGuid> <OutputType>WinExe</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>Main</RootNamespace> <AssemblyName>MyProg</AssemblyName> <KniPlatform>Windows</KniPlatform> </PropertyGroup>
leowest
leowest3mo ago
are u using the publish on visual studio? or via cli also your csproj have some inconsistencies not sure how ur not getting warned about it u have 2 OutputType also net8.0-windows7.0?!?! never seen that before is it even working? but I assume u might have a option conflict between your publish in vs and the csproj
AndrewBindon
AndrewBindon3mo ago
It builds and runs ok. I only get the error when I try to publish, and again only if I have PublishAot set to true. If I take PublishAot out, then it publishes fine as well. I am using VS community edition for both building and publishing. The net8.0-windows7.0 was created automatically by means of options I chose in the project properties. The only things I added in manually were: <PublishAot>true</PublishAot> <_SuppressWinFormsTrimError>true</_SuppressWinFormsTrimError> I read to do that on some Microsoft page or blog ... see if I can find the reference. But the point is that it doesn't work... just gives me the error.
leowest
leowest3mo ago
well u are using visual studio publish? can u show me the option u choose in the ui @AndrewBindon are u right clicking the project and going to publish?
leowest
leowest3mo ago
No description
leowest
leowest3mo ago
then there are additional options on it I need to see that are not added to the csproj
AndrewBindon
AndrewBindon3mo ago
Sorry for delay, do you mean this:
No description
leowest
leowest3mo ago
open cmd go to the folder the csproj file is and try running
dotnet publish -p:PublishProfile=FolderProfile
dotnet publish -p:PublishProfile=FolderProfile
it should give u a better error message
AndrewBindon
AndrewBindon3mo ago
Thanks, I'll try that Thank you very much that helped a lot... I am now able to publish to AOT Win_x64 etc. However the resulting compiled .exe appears to be crashing as soon as it is started, and this appears to be happening before it even executes the first line of my code. I'm thinking that it is crashing before the first line of my code, but I suppose it might be crashing ON the first line of my code. In any case, the first thing the app does is write to a debug log, and this is not happening. The App starts and then immediately stops again. Actually I think it may not be even starting... When I look at the task list I don't see it starting and then stopping ... I just don't see it at all. On the assumption that this failing to start is not a consequence of any of the code I've written, I'm wondering how to debug this or troubleshoot the problem. The app runs fine in Debug and Release. It is only when I come to try to publish to AOT Win-x64 and then try to run the resulting .exe that I get this problem. The windows event view says: Exception code: 0xc0000409
AndrewBindon
AndrewBindon3mo ago
Stack Overflow
How do you diagnose the exception code 0xc0000409 on Windows?
I have a C++ windows application that was done by another programmer, that I had to remove one line of code. After rebuilding the application with visual studio 2013 it crashes with this in the eve...
AndrewBindon
AndrewBindon3mo ago
That's from 2013 but probably still relevant? Apparently I can use DbgHelpBrowser with PDB file to map the relative address where the crash happens back something in the App !
leowest
leowest3mo ago
well I would need information about what your app does potentially some code to understand better the issue like what kind of app it is, i.e.: winforms? console? as I mentioned earlier u have some weird settings in your csproj
AndrewBindon
AndrewBindon3mo ago
Hmmm. I found this... I wonder if it might help me?
No description
leowest
leowest3mo ago
no idea, I dont know what your code does there could be many things but without more details its hard to guess, naot for example is very finik in regards reflection
AndrewBindon
AndrewBindon3mo ago
I am using KNI which is a derivative of MonoGame. https://github.com/kniEngine/kni
GitHub
GitHub - kniEngine/kni: KNI is a cross-platform C# game framework.
KNI is a cross-platform C# game framework. Contribute to kniEngine/kni development by creating an account on GitHub.
leowest
leowest3mo ago
fairly sure monogame does not support naot yet only one I know that does FNA
leowest
leowest3mo ago
FNA
FNA is a reimplementation of the Microsoft XNA Game Studio 4.0 Refresh libraries.
AndrewBindon
AndrewBindon3mo ago
I have built from the same code base to AOT for Android. Not quite the same codebase, most of it is the same.
leowest
leowest3mo ago
well it wont be trivial to figure the issue tell u that much could be something silly it trimmed out, could be some reflection left over u will have to read about naot it look for the things it doesnt like and figure it out sorry I can't be of much help
AndrewBindon
AndrewBindon3mo ago
You have helped a lot already ... given me plenty to think about.
leowest
leowest3mo ago
just making sure it all works without naot right if so thean yeah that is what i would look at things that could potentially be breaking naot
Want results from more Discord servers?
Add your server
More Posts
Blurring an Image in C#, working slowlySmall glitch but my algorithm for making this image blur is running super slow, going from the top oMy socket won't send data to 600 endpointsMy application sends a packet to 600 servers in order to gather data about active players and such. Help with Azure Cognitive Services?Currently I would like to add AI to my personal projects, I read about Azure cognitive services, I w✅ Need some help debugging EF Core db queryI am trying to get some information from the database. I am running this query: ```CS var ordersInLa✅ Seed cannot be added because of required property IDThe seed entity for entity type 'Series' cannot be added because no value was provided for the requiRazor Page Validation Error MessageFor "int" and "decimal" it gives a standard error message instead of my pre defined. "Is not valid fHelp Needed: Choosing Between VSCode on Mac or Visual Studio via Remote Desktop for Windows BackgrouI'm starting a new project and can't decide between two options: using VSCode on my Mac or using Vis✅ "Animate" an image along a axisHi, i'm using wpf and i want to code the "animation" of an Image. I want to move the image on an axi2D array doesn't initialize the correct size (Checked with breakpoints)In the ConsoleGraphic ctor I initialize a new 2D Glyph array. When the _console.Buffer.Width is 960 How to understand pining static field, const and instance fieldI am learning unsafe C#, and trying to understand when to use `fixed` statement. Here's the example: