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

switcher - support for GeneratePathProperty #128

Open
crystalgreen opened this issue Feb 4, 2023 · 4 comments
Open

switcher - support for GeneratePathProperty #128

crystalgreen opened this issue Feb 4, 2023 · 4 comments

Comments

@crystalgreen
Copy link

Problem
A <PackageReference> element can have extra attributes such as GeneratePathProperty.
This attribute (and maybe others like Aliases?) get lost when switching to project references and back.

Example:

<PackageReference Include="MyLib" Version="1.3.7" GeneratePathProperty="true" />

After switching to projects and back to packages, I get:

<PackageReference Include="MyLib" Version="1.3.7" />
@doxxx
Copy link

doxxx commented Mar 16, 2023

Not only that but custom targets that depend on the $(PkgMyLib) property will now fail because the property is not defined.

@crystalgreen
Copy link
Author

crystalgreen commented Mar 17, 2023

Not only that but custom targets that depend on the $(PkgMyLib) property will now fail because the property is not defined.

I work around this by using a condition like

Condition="Exists('$(PkgMyLib)\content\MyLib.md')"

If I want to build with project references, I need to reference them with a path to the project. Since that path is also there for package build, I need to remove/comment it when I want to build with package refs. That's not very convenient.

It would be cool if the path properties like $(PkgMyLib) would also be defined in project reference mode but this time it should reference the file in the project folder. This may not be easy to do as the path within the project may not be known. Extra config may be needed.

@doxxx
Copy link

doxxx commented Mar 17, 2023

Yeah, I was thinking about this some more after I posted my reply and I realized that it would be nearly impossible to provide the $(PkgMyLib) property since the contents of the package will most likely not exist in the source or build output in exactly the correct folder structure.

@ssteiner
Copy link

Have you tried looking in the SwitchToProject method in SwitchPackageToProjectsCommand ? item in line 111 might have that info and if so, it could be stored in the restore information (dnt already keeps tabs of what it replaced)

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