-
-
Notifications
You must be signed in to change notification settings - Fork 95
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
Automatically load ProjectReferences #159
Comments
I think I get the request, but let me be sure. The problem here is that you've got a project ( The title of this issue mentions |
Thanks @daveaglick, yes the title was wrong 🤦 To give some context, I have no |
As discussed in the PR, I've still got a little confusion over whether it's now doing what you need after the PR merge. I think the request is to make sure transitive project references get added, and it appears that's happening from my testing. I added a new test project with the following project file: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\SdkNetCoreProjectWithReference\SdkNetCoreProjectWithReference.csproj" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\SdkNetStandardProjectWithPackageReference\SdkNetStandardProjectWithPackageReference.csproj" />
<ProjectReference Include="..\SdkNetStandardProject\SdkNetStandardProject.csproj" />
</ItemGroup>
</Project> If I run a test like: // Given
StringWriter log = new StringWriter();
IProjectAnalyzer analyzer = GetProjectAnalyzer(@"projects\TransitiveProjectReference\TransitiveProjectReference.csproj", log);
// When
Workspace workspace = analyzer.GetWorkspace(addProjectReferences: true);
// Then
workspace.CurrentSolution.Projects.Count().ShouldBe(totalProjects, log.ToString()); I get the expected 4 projects in the workspace (the original, it's reference, and the two transitive references). That's because inside the code where we build and add a referenced project to the solution: return analyzer.Build().FirstOrDefault().AddToWorkspace(workspace, addProjectReferences); ...we call the same So given the comment
I feel like I'm still missing something (it's me, not you I'm sure!) |
Sorry the very slow reply. Yes you are right, it's building the projects in the right order and getting the right result. I now have a better understanding of what was going wrong, I'm going to create a new issue, because it's a bit interesting. |
Closing this issue, as we are agreed it working. Raised a new issue here: #181 |
Hi, I love Buildalyzer.
It would be great if I could point it at a project file and have it analyze all of the project references too.
At the moment I am running this:
However solution only has 1 project in it. To work around this, I can scan for all
csproj
files in the repo and call:I would love for this not to be required and for
GetWorkspace(true)
to automatically add the project to the analyzer.The text was updated successfully, but these errors were encountered: