@@ -262,11 +262,6 @@ public DependencyContext Build(string[] userRuntimeAssemblies = null)
262
262
263
263
List < ModifiableRuntimeLibrary > runtimeLibraries = new ( ) ;
264
264
265
- if ( _includeMainProjectInDepsFile )
266
- {
267
- runtimeLibraries . Add ( GetProjectRuntimeLibrary ( ) ) ;
268
- }
269
-
270
265
runtimeLibraries . AddRange ( GetRuntimePackLibraries ( ) ) ;
271
266
272
267
foreach ( var library in _dependencyLibraries . Values
@@ -304,6 +299,11 @@ public DependencyContext Build(string[] userRuntimeAssemblies = null)
304
299
runtimeLibraries . Add ( runtimeLibrary ) ;
305
300
}
306
301
302
+ if ( _includeMainProjectInDepsFile )
303
+ {
304
+ runtimeLibraries . Add ( GetProjectRuntimeLibrary ( ) ) ;
305
+ }
306
+
307
307
/*
308
308
* We now need to modify runtimeLibraries to eliminate those that don't have any runtime assets. We follow the following steps:
309
309
* 0. Construct a reverse dependencies list: all runtimeLibraries that depend on this one
@@ -518,7 +518,7 @@ private ModifiableRuntimeLibrary GetProjectRuntimeLibrary()
518
518
519
519
return new ModifiableRuntimeLibrary ( new RuntimeLibrary (
520
520
type : "project" ,
521
- name : _mainProjectInfo . Name ,
521
+ name : GetUniqueLibraryName ( _mainProjectInfo . Name , "Project" ) ,
522
522
version : _mainProjectInfo . Version ,
523
523
hash : string . Empty ,
524
524
runtimeAssemblyGroups : runtimeAssemblyGroups ,
@@ -918,7 +918,7 @@ private string GetReferenceLibraryName(ReferenceInfo reference)
918
918
{
919
919
// Reference names can conflict with PackageReference names, so
920
920
// ensure that the Reference names are unique when creating libraries
921
- name = GetUniqueReferenceName ( reference . Name ) ;
921
+ name = GetUniqueLibraryName ( reference . Name ) ;
922
922
923
923
ReferenceLibraryNames . Add ( reference , name ) ;
924
924
_usedLibraryNames . Add ( name ) ;
@@ -927,11 +927,11 @@ private string GetReferenceLibraryName(ReferenceInfo reference)
927
927
return name ;
928
928
}
929
929
930
- private string GetUniqueReferenceName ( string name )
930
+ private string GetUniqueLibraryName ( string name , string qualifier = "Reference" )
931
931
{
932
932
if ( _usedLibraryNames . Contains ( name ) )
933
933
{
934
- string startingName = $ "{ name } .Reference ";
934
+ string startingName = $ "{ name } .{ qualifier } ";
935
935
name = startingName ;
936
936
937
937
int suffix = 1 ;
0 commit comments