dotnet / dotnet/project-system

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

Open
#5,641 2 comments 0 reactions 1 assignee Claimed by @melytc View on GitHub
Feature-Project-File-Editing Parity-Legacy-Feature Triage-Approved
Dominant language
C#
Stars
1k
Forks
415
PR merge metrics
No merged PRs in 30d

Description

**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 `"$(ProjectDir)"`
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](https://developercommunity.visualstudio.com/content/problem/800548/bug-vs2017-net-core-pre-build-script-gets-malforme.html) against 15.9. Still repros in 16.5.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.