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
what else do u have selected?
<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>
<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>
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 csprojIt 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.
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?
then there are additional options on it I need to see that are not added to the csproj
Sorry for delay, do you mean this:
open cmd
go to the folder the csproj file is
and try running
it should give u a better error message
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
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...
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 !
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
Hmmm. I found this... I wonder if it might help me?
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
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.
fairly sure monogame does not support naot yet
only one I know that does FNA
FNA
FNA is a reimplementation of the Microsoft XNA Game Studio 4.0 Refresh libraries.
I have built from the same code base to AOT for Android.
Not quite the same codebase, most of it is the same.
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
You have helped a lot already ... given me plenty to think about.
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