问题
Using Visual Studio 2015 Update 1, I'm experimenting a problem (that didn't happened with Visual Studio 2015) in a Visual C++ CLR class library project (C++/CLI) when running the command AL.EXE in Post-Build Event: The AL.EXE application crashed and the system returns the error code -1073741819 (0xC0000005).
Here the contents of the post-build event:
sn -Rca "$(SolutionDir)bin\$(Configuration)\$(Platform)\$(TargetName)$(TargetExt)" dwo
Resgen "$(ProjectDir)Recursos.es-ES.resx" "$(IntDir)$(ProjectName).Recursos.es-ES.resources"
Al.exe /t:lib /embed:"$(IntDir)$(ProjectName).Recursos.es-ES.resources",Recursos.es-ES.resources /version:15.0.0.0 /culture:es-ES /out:"$(OutDir)es-ES\$(TargetName).resources.dll" /keyname:dwo
And here a snipping of the event viewer showing the error of the AL.exe application each time I run it from the post-build event (compiling my project).
The command line is correctly as you can see if I execute it from a console:
So I'm sure the problem is not because the command line.
Also I tried to specify the path to another AL.EXE command, because Visual Studio 2015 Update 1 uses the path:
C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools
So I tried with
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools
but still not working.
You can reproduce the problem creating a new Visual C++'s CLR class library and adding a simple call to AL.exe in Post-build event.
Do you know how to solve this problem?
EDIT: I tried also to do it with an AfterBuild Target like this:
<Target Name="AfterBuild">
<Exec Command="Al.exe /t:lib /embed:"$(IntDir)$(ProjectName).Recursos.es-ES.resources",Recursos.es-ES.resources /version:15.0.0.0 /culture:es-ES /out:"$(OutDir)es-ES\$(TargetName).resources.dll" /keyname:dwo"/>
</Target>
And the result is the same: Visual Studio tries to run the command AL.EXE but it crashes returning -1073741819.
回答1:
Thanks to JaredPar for the work around
http://blogs.msdn.com/b/bharry/archive/2015/11/30/vs-2015-update-1-and-tfs-2015-update-1-are-available.aspx?CommentPosted=true#10659560
Add the following line before the call to al.exe in your nmake file or post build events
chcp 437
This will reset the console code page to a known value before running al.exe.
回答2:
I just run into the same issue when trying to build my ASP.NET project.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(3441,5): error MSB6006: "al.exe" exited with code -1073741819.
This will happen after you changed the Default code page in Default console window properties:
Just revert it to 437
and the problem is gone.
来源:https://stackoverflow.com/questions/34051040/error-1073741819-0xc0000005-when-executing-al-exe-from-post-build-event-in-vi