Variables are not available in Visual Studio build events.

yonotsui 40 Reputation points
2023-12-29T15:29:10.7166667+00:00

I defined and used variables in the VIsualStudio post-build event.

The variable name "outputDir" is used in set, and the variable is used in %outputDir%.

However, %outputDir% is not recognized as a variable.

Why can't it be used as a variable?

I would appreciate it if you could give me some advice.

・Post-build event

call set outputDir=$(MSBuildProjectDirectory)\bin$(Configuration)$(TargetFramework)\

echo OutDir:%outputDir%

・Output content

call set outputDir=F:\Program\FW\FW_Migration\HostApplication\bin\Debug\net8.0-windows\

echo OutDir:%outputDir%

Developer technologies | Visual Studio | Other
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.