dotnet / dotnet/msbuild

[Broken Build]: Cannot use dotnet build --no-dependencies --no-restore when a vcxproj is referenced

Open
#13,655 2 comments 0 reactions 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 6h
Merged PRs (30d)
139

Description

### Issue Description

We have a handful of vcxproj/C++ projects. I'm aware that there is no SDK-style equivalent for these and they do not work in dotnet build. We're looking to be able to use dotnet build for our C# projects, some of which depend on C++ projects. Currently we have a custom build tool that invokes MSBuild and uses BuildProjectReferences=false to prevent recompiling dependencies. I _think_ `dotnet build --no-restore --no-dependencies` should be equivalent, but when I run it against a project with a C++ reference, it fails.

### Steps to Reproduce

Create a .NET 10 SDK-style csproj with a project reference to a .NET 10 C++ vcxproj. Run msbuild against the C# project, which should compile both. Run dotnet build --no-dependencies --no-restore on the csproj.

### Expected Behavior

Successfully builds the C# project, using the pre-existing C++ dll.

### Actual Behavior

`MSB4278: The imported file ... does not exist...`
or (if I make the import conditional on existence)
`MSB4057: The target "GetTargetPath" does not exist in the project.`

### Ask us questions

Is there a way to make this work? For instance, could I define the GetTargetPath target myself?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.