MakePeaceGreatAgain
MakePeaceGreatAgain

Reputation: 37095

postbuild-event fails because MSB3073

I´m using Visual Studio 2010 to build an assembly from a C#-project with the following postbuild-event:

call "$(DevEnvDir)..\tools\vsvars32.bat"
editbin /largeaddressaware "$(TargetPath)"
sn -R "$(TargetPath)" "path/to/MySigningFile.snk"

However when I build the project I get that error:

Error MSB3073: The command "call "*Undefined*..\tools\vsvars32.bat" editbin /largeaddressaware "MyProgram.exe" sn -R "MyProgram" "path/to/MySingingFile.snk"" terminated with the following code 9009. (1, 1)

What makes me wonder is the "*undefined*" in the error. However when I open the environment-settings from within the post-build-events (Project properties --> Build Events --> Edit Post-build... --> Makros) I see that that variable should hold the value C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\enter image description here

EDIT: I replaced the call to "$(DevEnvDir)..\tools\vsvars32.bat" by the actual path where vsvars32 is located and it worked. So it seems although I can see the variable is set appropriately within VS it is not evaluated appropriately when building the project.

Upvotes: 0

Views: 1538

Answers (1)

ToolmakerSteve
ToolmakerSteve

Reputation: 21321

You don't specify whether you tested in both Debug and Release builds.

If this only happens for Release build, then perhaps instead set on the exe in obj folder:

editbin /LARGEADDRESSAWARE "$(ProjectDir)obj\$(ConfigurationName)\$(TargetFileName)"

(As mentioned in https://www.experts-exchange.com/questions/23694055/MSBuild-Publish-Mode-Post-Build-Event-not-executing-on-target-app-publish-files.html )

NOTE: The exact path depends on your build configuration.

If this helps, and including both editbin lines doesn't work well, then see other stackoverflow threads for correct syntax to specify one line for Debug, the other line for Release.

UPDATE Just tested this; it is only relevant to certain "publish" scenarios. Probably will have no effect in your case.


FYI, Another related issue (though it wouldn't result in the error message mentioned) is that largeaddressaware won't work if you are using visual studio hosting for debugging. see https://stackoverflow.com/a/3963184/199364

Upvotes: 1

Related Questions