-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Labels
Description
Summary
Using MSBuild APIs to build in-memory projects should work when targets (e.g., from .NET SDK) include <MSBuild Projects="$(MSBuildProjectFullPath)" />
(which they very often do). Currently MSBuild fails because the project file does not exist on disk. But MSBuild knows its content.
Background and Motivation
File-based apps use MSBuild APIs to build the app in memory (without a physical .csproj
file). We need workarounds whenever targets use the MSBuild task against the current project, e.g., NuGet/Home#14148.
Proposed Feature
When using MSBuild APIs like
var xmlReader = XmlReader.Create(new StringReader(projectText));
var projectRoot = ProjectRootElement.Create(xmlReader);
projectRoot.FullPath = Path.Join(Environment.CurrentDirectory, "test.csproj"); // MSBuildProjectFullPath
any <MSBuild Projects="$(MSBuildProjectFullPath);..." />
should work. Notice the FullPath is set so MSBuild knows which full path corresponds to the current virtual project.
wiktor-golonka