project-system icon indicating copy to clipboard operation
project-system copied to clipboard

VB.NET build event editing removes $(ProjectDir) and possibly other variables

Open drewnoakes opened this issue 5 years ago • 2 comments

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:

  1. Create a new VB.NET (.NET Core) project
  2. Project properties -> Compile -> Build Events...
  3. Add pre-build event command line text of "$(ProjectDir)"
  4. Click OK
  5. Open project file, see <PreBuildEvent>"$(ProjectDir)"</PreBuildEvent>
  6. Project properties -> Compile -> Build Events...
  7. 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.

drewnoakes avatar Nov 13 '19 02:11 drewnoakes

Triage: Please check C# too.

davkean avatar Jan 10 '20 00:01 davkean

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="&quot;$(ProjectDir)&quot;" />
  </Target>

  <Target Name="PostBuild" AfterTargets="PostBuildEvent">
    <Exec Command="&quot;$(ProjectDir)&quot;" />
  </Target>

...and the property round trips correctly.

drewnoakes avatar Jan 12 '20 23:01 drewnoakes