project-system
project-system copied to clipboard
VB.NET build event editing removes $(ProjectDir) and possibly other variables
Visual Studio Version: Version 16.5.0 Preview 1.0 [29511.109.master]
Summary:
The editor for VB.NET build events is removing $(Property) variables.
Steps to Reproduce:
- Create a new VB.NET (.NET Core) project
- Project properties -> Compile -> Build Events...
- Add pre-build event command line text of
"$(ProjectDir)" - Click OK
- Open project file, see
<PreBuildEvent>"$(ProjectDir)"</PreBuildEvent> - Project properties -> Compile -> Build Events...
- Pre-build command is shown as
""
Expected Behavior:
Command text is retained.
Actual Behavior:
Command text is broken and editing it will remove variables from the project file.
User Impact:
Potentially broken build after using editor.
Originally reported in this ticket against 15.9. Still repros in 16.5.
Triage: Please check C# too.
I verified C# when filing this issue and it doesn't have the same problem. The VB pages have different UI and logic for build events.
For C# you get...
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command=""$(ProjectDir)"" />
</Target>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command=""$(ProjectDir)"" />
</Target>
...and the property round trips correctly.