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

PackageOutputPath gets overriden by MSBuild for SDK Projects and packages are still produced in the project source tree #310

Closed
abdes opened this issue Nov 18, 2024 · 4 comments

Comments

@abdes
Copy link

abdes commented Nov 18, 2024

PackageOutputPath needs to be set in Directory.build.targets or it gets overriden by MSBuild for SDK Projects and will not have the desired effect.

<RepoRootPath>$(MSBuildThisFileDirectory)</RepoRootPath>
<BaseIntermediateOutputPath>$(RepoRootPath)obj\$([MSBuild]::MakeRelative($(RepoRootPath), $(MSBuildProjectDirectory)))\</BaseIntermediateOutputPath>
<BaseOutputPath Condition=" '$(BaseOutputPath)' == '' ">$(RepoRootPath)bin\$(MSBuildProjectName)\</BaseOutputPath>
<PackageOutputPath>$(RepoRootPath)bin\Packages\$(Configuration)\</PackageOutputPath>

@AArnott
Copy link
Owner

AArnott commented Nov 18, 2024

Thanks for reporting.
The title says SDP projects and the description says SDK projects.
In my experience SDK projects take the PackageOutputPath as set here just fine, so I'm guessing you're talking about SDP projects. But I've never heard of SDP projects. What are they?

@abdes abdes changed the title PackageOutputPath gets overriden by MSBuild for SDP Projects and packages are still produced in the project source tree PackageOutputPath gets overriden by MSBuild for SDK Projects and packages are still produced in the project source tree Nov 19, 2024
@abdes
Copy link
Author

abdes commented Nov 19, 2024

Typo in title corrected

@abdes
Copy link
Author

abdes commented Nov 19, 2024

You think it works fine because the project is at the root and bin is also at the root. Put src and the .sln in a sub-directory and you will see the problem.

Anyway, thanks for writing the props files, really helpful.

EDIT: basically act like you're in a mono-repo and the library is a project there, and the master props are one level below.
EDIT 2: I know you did not design this project for that, I just saw it, liked that someone else other than me was bothered by crap being poured over the source folder. I do my stuff in mono-repos, and I wasted a bunch of my time figuring out why VS was still packing inside the src, until I found that MSBuild is overriding the property if it's in build.props and would let it go if it's in targets.props.

@AArnott
Copy link
Owner

AArnott commented Nov 19, 2024

I see. Well, I'm glad you found the solution to the problem. I have one mono-repo that I (have to) work in too, so I sympathize.
Library.Template is decidedly not designed to support mono-repos though, and we have repos based on Library.Template that build on or modify PackageOutputPath within project evaluation so moving the definition to .targets would probably break folks, in favor of making 'mono repos' work with fewer changes, which IMO is putting priorities backwards.

Best of luck on your mono-repo though.

@AArnott AArnott closed this as not planned Won't fix, can't repro, duplicate, stale Nov 19, 2024
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

2 participants