Skip to content

Can't add project to existing solution #1853

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

Closed
matthiasburger opened this issue Jul 5, 2022 · 6 comments
Closed

Can't add project to existing solution #1853

matthiasburger opened this issue Jul 5, 2022 · 6 comments

Comments

@matthiasburger
Copy link

Environment

  • Pythonnet version: latest (05.07.22)
  • Python version: 3.10
  • Operating System: Mac OS 12.4
  • .NET Runtime: .net 6

Details

I wanted to add the Python.Runtime.csproj into my existing solution but I get following exception:

Unable to load project and obtain project information from MsBuild. Try to change MsBuild version in 'Settings | Build, Execution, Deployment | Toolset and Build'. Probably this project is incompatible with the current MsBuild. MsBuild error details: The expression "[System.IO.File]::ReadAllText(version.txt)" cannot be evaluated. Could not find file '/private/var/folders/qt/cqy7_g9x3j14tcrwf5w_kfj80000gn/T/version.txt'.

@matthiasburger
Copy link
Author

matthiasburger commented Jul 5, 2022

in the Directory.Build.props there is this line:

<FullVersion>$([System.IO.File]::ReadAllText("version.txt"))</FullVersion>

which points to a non-existing file.

This doesn't work on Mac. You cannot even open the solution.

@filmor
Copy link
Member

filmor commented Jul 5, 2022

This is not a supported use case. Please use a nuget package.

@filmor filmor closed this as completed Jul 5, 2022
@filmor
Copy link
Member

filmor commented Jul 5, 2022

To elaborate, now that I have a bit more time: This file is part of the repo and the respective code expects that to be the root of the build process. It should be possible to adjust the build props to use its own directory as the source of the lookup, but this will still not be a supported scenario.

@lostmsu
Copy link
Member

lostmsu commented Jul 5, 2022

@matthiasburger TL;DR; you can completely remove that line and later add your own versioning if needed.

filmor added a commit that referenced this issue Jul 6, 2022
Allows the project to be referenced in other .NET projects without
adjusting its project file (#1853).
@filmor
Copy link
Member

filmor commented Jul 6, 2022

This should be fixed now.

@matthiasburger
Copy link
Author

@filmor thanks for fixing it :)

just to clarify, of course this scenario is not supported. But as long as I don't want to make custom changes on your code it's much easier to clone and pull changes instead of creating a fork and merge your changes every time :D

BadSingleton pushed a commit to Unity-Technologies/pythonnet that referenced this issue Jul 18, 2022
Allows the project to be referenced in other .NET projects without
adjusting its project file (pythonnet#1853).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants