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

ProjectSection(ProjectDependencies) is missing in .sln #25

Closed
3F opened this issue Apr 19, 2020 · 5 comments
Closed

ProjectSection(ProjectDependencies) is missing in .sln #25

3F opened this issue Apr 19, 2020 · 5 comments

Comments

@3F
Copy link
Owner

3F commented Apr 19, 2020

When at least VS 16.5.4. Reported here https://developercommunity.visualstudio.com/content/problem/996183/projectsectionprojectdependencies-is-missing-in-sl.html

For MvsSln the problem affects ISlnPDManager ProjectDependencies feature (part of LProjectDependencies handler)

More like we need to add a compatible alternative to ProjectReference because actually it may be a new official behavior. Not sure, I'm waiting a reply, and moreover...

But anyway:

Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlnTest1", "SlnTest1\SlnTest1.csproj", "{142CCFC4-AB0B-4680-9254-D22A669C337E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassLibrary1", "ClassLibrary1\ClassLibrary1.csproj", "{34EB954A-7FC0-4463-865D-8B353395B595}"
EndProject

While project file:

<ProjectReference Include="..\SlnTest1\SlnTest1.csproj">
  <Project>{142ccfc4-ab0b-4680-9254-d22a669c337e}</Project>
  <Name>SlnTest1</Name>
</ProjectReference>

Does anyone know anything about it?

@3F
Copy link
Owner Author

3F commented Apr 19, 2020

ProjectDependencies is most important feature since it helps easily calculate the build order, or provide solution dependencies entirely. Some of my other projects requires exactly this.

ProjectReference is part of msbuild world and it will be problematic since #23 is not started yet (but I hope soon).

Anyway, more like we need to support both ways :( Any info/suggestions are welcomed.

@3F
Copy link
Owner Author

3F commented Apr 22, 2020

Finally I received the official information regarding VS logic, this is it,

Project Dependencies Project Reference .sln

copy-paste

I thought MSBuild operates this section for ALL cases when initializes its environment. That is, only this sections defines the order when evaluating nodes.

Seems like MvsSln will try to eliminate these miscellaneous units between VS and msbuild world.

@3F
Copy link
Owner Author

3F commented Apr 27, 2020

Since MvsSln already implements ProjectReferences that provides features for project references in ISlnPDManager manner,
I just added activation for existing ProjectDependencies (shallow copy) through new flag:

MvsSln/MvsSln/SlnItems.cs

Lines 119 to 125 in 9c39498

/// Covers ProjectDependencies (SLN) logic using data from project files (XML).
/// Helps eliminate miscellaneous units between VS and msbuild world:
/// https://github.com/3F/MvsSln/issues/25#issuecomment-617956253
///
/// Requires Env with loaded projects (LoadMinimalDefaultData or LoadDefaultData).
/// </summary>
ProjectDependenciesXml = 0x0800 | ProjectDependencies | Env,

That is, we can use like:

SlnItems.ProjectDependenciesXml | SlnItems.LoadMinimalDefaultData

or

SlnItems.ProjectDependenciesXml | SlnItems.LoadDefaultData

For this flag, the actual logic:

Project Dependencies Project Reference .sln

See new tests for details.

FYI: Of course if we'll use related handler with writer for updating .sln. For other cases we can just safely use a unified logic between msbuild and VS.

@3F 3F removed the core label Apr 27, 2020
@3F 3F added this to the 2.5.2 milestone Apr 27, 2020
3F added a commit to 3F/DllExport that referenced this issue Apr 28, 2020
3F added a commit to 3F/DllExport that referenced this issue Apr 30, 2020
3F added a commit that referenced this issue May 5, 2020
* NEW: Activating ProjectReferences for existing ProjectDependencies (shallow copy) through new flag.
       Issue #25.
        ```
        ProjectDependenciesXml = 0x0800 | ProjectDependencies | Env,
        ```
            Covers ProjectDependencies (SLN) logic using data from project files (XML).
            Helps eliminate miscellaneous units between VS and msbuild world:
            #25 (comment)
            Requires Env with loaded projects (LoadMinimalDefaultData or LoadDefaultData).

            A core feature in .NET DllExport Post-processing:
            3F/DllExport#148

* NEW: `ProjectReference` support without obsolete projectguid. Issue #26.

* NEW: IXProject methods:
       ```
       +IXProject.GetFullPath(string relative)
       ```

* FIXED: Fixed possible empty records in SlnParser.SetProjectItemsConfigs.

* FIXED: Fixed `The given key was not present...` when different case for keys in Item.Metadata.

* FIXED: Fixed protected XProject GetProjectGuid() + GetProjectName() when empty property.

* CHANGED: Compatible signature update for `ForEach<T>` extension method:
           ```
           IEnumerable<T> ForEach<T>(this IEnumerable<T> items, Action<T> act)
           ```

* CHANGED: Updated Microsoft.CSharp 4.7.0 (Only for: netstandard2.0 + netcoreapp2.1)

* CHANGED: Updated Microsoft.Build 16.5.0 (Only for: netcoreapp2.1)
3F added a commit to 3F/DllExport that referenced this issue May 7, 2020
* MvsSln up to rev `9c39498` due to 3F/MvsSln#25

Part of #144

* Post-Processing #148: Implemented backend logic with configurable environment:

Format: $(SolutionPath);$(MSBuildThisFileFullPath);...populated property names...;....

```
<Target Name="DllExportPostProc">

    <!-- Now we can access the following properties and items:

    $(DllExport)     - version
    $(DllExportSln)  - full path to .sln which controls current project
    $(DllExportPrj)  - full path to current project where processed .NET DllExport

    @(DllExportDirX64)    - $(TargetDir)x64\*.*
    @(DllExportDirX86)    - $(TargetDir)x86\*.*
    @(DllExportDirBefore) - $(TargetDir)Before\*.*
    @(DllExportDirAfter)  - $(TargetDir)After\*.*

    @(DllExportDependents + populated property name)
       - each populated properties from DllExportInvokedPoint, e.g. DllExportDependentsTargetDir

    @(DllExportDependencies + populated property name)
      - each populated properties from DllExportInvokedPoint, e.g. DllExportDependenciesTargetDir

    -->

</Target>
```

* Post-Proc. Added support of external .net.dllexport.targets

* PostProc usage has been moved into ExportTaskImplementation

* Fixed MSB4094 when using the same properties

+Checking the existence of our entry point

* `DllExportInvokedPoint` renamed as `DllExportProcEnv`

* Basic GUI support for predefined options in Post-Proc feature

That is,

*! Some Post-Proc features are not yet available in GUI. But you can already configure it with msbuild.

* cleanup

* Updated data in SimpleConfFormater.Parse()

+PostProc +PreProc

* MvsSln up to rev `838fab00dd` /? #148 (comment)

* MvsSln up to rev `e07c5806dd`: +`ProjectReference` support without obsolete projectguid

* Updated MvsSln 2.5.2

* Added multiple destination support via derivative targets:
#148 (comment)

* +`DllExportSeqDependents...` Includes sequential referencing through other projects
@3F 3F mentioned this issue May 22, 2020
@Str1ker17
Copy link

Seems that this type of data breaks creation of an empty solution programmatically

i.e. to create an empty solution, I have to exclude

net.r_eg.MvsSln.Sln sln = new Sln(SlnItems.All & ~SlnItems.ProjectDependenciesXml, String.Empty);

@3F
Copy link
Owner Author

3F commented Dec 13, 2020

@Str1ker17
Looks like a bug. Could you please open a new issue regarding this behavior? Thanks

3F added a commit that referenced this issue Aug 23, 2021
* FIXED: Fixed CalculateHashCode() Extension.
         Internally affects many objects due to broken GetHashCode().

* FIXED: Fixed SlnItems.ProjectDependenciesXml when empty input:
         Report #25 (comment)

* NEW: packages.config support PR #30. Related issues #27, #28.
       To activate it, use the following flags:
        * PackagesConfig, PackagesConfigSolution, PackagesConfigLegacy.

        For example,
        ```
        using Sln l = new("Input.sln", SlnItems.AllNoLoad | SlnItems.PackagesConfig);

        IPackageInfo found = l.Result.PackagesConfigs
                                        .SelectMany(s => s.Packages)
                                        .FirstOrDefault(p => p.Id.StartsWith("Microsoft."));
        // found.MetaTFM ...

        Version v = l.Result.PackagesConfigs.First().GetPackage("LX4Cnh")?.VersionParsed;
        ```
          Including GetNuTool compatible packages, format:
          https://github.com/3F/GetNuTool#format-of-packages-list

* NEW: Added HasValue and HasNothing properties in PropertyItem.

* NEW: Added SlnItems.AllMinimal and SlnItems.AllNoLoad in addition to SlnItems.All.

* NEW: Added IXProject.GetPackageReferences().

* CHANGED: ConfigItem.Format() marked as obsolete.
           Use `ToString()` and `IConfPlatform.Formatted` instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants