6

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).

enter image description here

The command line is correctly as you can see if I execute it from a console:

enter image description here

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:&quot;$(IntDir)$(ProjectName).Recursos.es-ES.resources&quot;,Recursos.es-ES.resources /version:15.0.0.0 /culture:es-ES /out:&quot;$(OutDir)es-ES\$(TargetName).resources.dll&quot; /keyname:dwo"/>
</Target>

And the result is the same: Visual Studio tries to run the command AL.EXE but it crashes returning -1073741819.

joseangelmt
  • 2,018
  • 18
  • 32
  • Confirmed. The 4.6.1 version bombs too. Quacks like a DLL problem but I don't see it doing anything wrong. I had a great deal of trouble installing the update, it hang while installing the SDK and I had to terminate it, I could only recover by reinstalling from scratch which didn't go well either. Did you have a mishap like that? – Hans Passant Dec 02 '15 at 19:48
  • I've got the same problem in my c# projects. I need to create policy dll with al.exe in the post build event but the linker crashes. It worked fine before Update1 and on VS2012. It works fine if I execute the same command directly from command line. I've got a crash even if I save the command in batch file and run it from the post build event. I tried to run it with different FW and different versions of the al.exe but the result is the same. – Daniel Kabzon Dec 07 '15 at 12:15
  • I've also tried to run the command as a powershell script in a post build event. The result is the same. The only difference is that in this case the build does not fail. If I run the same script directly from the powershell it works fine – Daniel Kabzon Dec 07 '15 at 13:58

2 Answers2

5

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.

Daniel Kabzon
  • 326
  • 2
  • 17
0

I just run into the same issue when trying to build my ASP.NET project.

al.exe error message

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: Defaults Default code page

Just revert it to 437 and the problem is gone.

zwcloud
  • 4,546
  • 3
  • 40
  • 69