Skip to content

.csproj files within a local UPM can't find MSBuildForUnity.Common.props #144

Description

I'm attempting to follow Scenario 4: Distribute a UPM Package w/ NuGet Dependency. Based on my understanding of the documentation, I have:

  1. Added a '.csproj' file to my UPM that announces the NuGet dependencies that my UPM needs.
  2. Made com.microsoft.msbuildforunity a dependency of the UPM

When adding the UPM to an existing Unity project the com.microsoft.msbuildforunity integration kicks in, and I see the command-line invoked:

[package location]\Runtime> C:\Program Files\dotnet\dotnet.exe msbuild [packagename].csproj -restore  -v:minimal -p:NuGetInteractive=true  -t:Build -p:Configuration=Release

But since the [package location] - for local packages - is outside the scope of the Unity project, then the line:

<Import Project="$([MSBuild]::GetPathOfFileAbove(MSBuildForUnity.Common.props))" Condition="Exists('$([MSBuild]::GetPathOfFileAbove(MSBuildForUnity.Common.props))')" />

is a no-op, since the condition evaluates to false. There doesn't appear to be a way - given the command-line invoked - to identify the Unity project folder.

Proposal

Have the com.microsoft.msbuildforunity Unity scripts pass the Application.dataPath into the dotnet msbuild invocation as an MSBuild property would make the import a lot more clear.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions