Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path to DotNet relative to project #31008

Closed
wants to merge 2 commits into from

Conversation

hammeron-art
Copy link

For a fresh build, more specifically, if GodotTools.ProjectEditor wasn't build and there is no binaries already generated I always get this error:

ProjectExtensions.cs(3,7): error CS0246: The type or namespace name 'DotNet' could not be found (are you missing a us
ing directive or an assembly reference?) [F:\Godot\godot\modules\mono\editor\GodotTools\GodotTools.ProjectEditor\GodotT
ools.ProjectEditor.csproj]
ProjectUtils.cs(6,7): error CS0246: The type or namespace name 'DotNet' could not be found (are you missing a using d
irective or an assembly reference?) [F:\Godot\godot\modules\mono\editor\GodotTools\GodotTools.ProjectEditor\GodotTools.
ProjectEditor.csproj]

It builds fine with or without mono_glue with the correct relative HintPath.

@hammeron-art
Copy link
Author

The actual problem was the many HintPaths. It works on Windows and the CI with a unique path to the project directory.

entire solution. $(SolutionDir) is not defined in that case, so we need to workaround that.
We make SCons restore the NuGet packages in the project directory instead in this case.
-->
<HintPath Condition=" '$(SolutionDir)' != '' ">$(SolutionDir)\packages\DotNet.Glob.2.1.1\lib\net45\DotNet.Glob.dll</HintPath>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed when building the entire solution instead of a specific project. What we should do here is add conditions:

<HintPath Condition=" '$(SolutionDir)' != '' And Exists('$(SolutionDir)\packages\...') ">$(SolutionDir)\packages\...</HintPath>
<HintPath Condition=" '$(SolutionDir)' == '' Or !Exists('$(SolutionDir)\packages\...') ">$(ProjectDir)\packages\...</HintPath>

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only GodotTools.ProjectEditor uses DotNet and has a packages.config for it. It isn't a package used for the whole solution.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But when restoring the entire solution, the packages folder is created in the solution directory instead of the project directory. At least when running nuget restore, which is what SCons uses; I didn't check with msbuild /t:restore.

Copy link
Author

@hammeron-art hammeron-art Aug 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It happens to me too. The solution restores a DotNet package which is not used for any project and GodotTools.ProjectEditor another DotNet specific for it. You can the details in the manage panel in VS.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still pending. I just checked again to be sure. When running nuget restore on a solution, the packages folder is created in the solution dir. The alternative hintpaths I commented above should always work.

@akien-mga
Copy link
Member

What's the status of this PR?

@akien-mga
Copy link
Member

akien-mga commented Aug 29, 2019

Superseded by #31770.

Thanks for the contribution nevertheless which helped find the right fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants