Skip to content

Build Events setting does not create correct MSBuild property for the .NET SDK project #9022

Open
@vsfeedback

Description

@vsfeedback

This issue has a corresponding ticket on Developer Community. Please vote and comment there to make sure your voice is heard.


[severity:It's more difficult to complete my work]

To reproduce:

  1. Create 2 projects from template.
    • Class Library (C# for .NET Standard or .NET Core)
    • Class Library (VB for .NET Standard or .NET Core)
  2. Configure Build Events in project properties for both projects. (project-properties.png)
    • C#: Properties > Build > Output > Pre-build event
    • VB: Properties > Compile > Build Events... > Pre-build event command line
  3. Inspect created Build Events in project file (.csproj / .vbproj) (project-files.png)
    • C#: Target-Attribute was created
    • VB: PreBuildEvent-Attribute was created

As statet in the documentation for .NET SDK project files:

The properties PreBuildEvent and PostBuildEvent are not recommended in SDK-style projects, because macros such as $(ProjectDir) aren't resolved. [...]

So, to use Build Event macros in VB, i have to configure Build Events in the project file manually.
This can get really tiresome, as the command in the project file is XML encoded.
I was expecting, to configure Build Events for VB directly in the IDE like it is for C#.

I´m on:
Microsoft Visual Studio Enterprise 2022 (64-bit)
Version 17.0.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-VisualBasicSpecific to the VB.NET language.Feature-Project-Properties-DesignerThe new project property pages which replace the legacy AppDesignerTriage-InvestigateReviewed and investigation needed by dev team

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions