@@ -40,7 +40,7 @@ public override bool Execute()
40
40
string projectTemplateContent = File . ReadAllText ( ProjectTemplate ) ;
41
41
string pkgProjectOutput = projectTemplateContent ;
42
42
string packageReferenceIncludes = "\n " ;
43
- string outputPathByTfm = "\n " ;
43
+ string tfmSpecificProperties = "\n " ;
44
44
45
45
// Make sure that we always use the same directory separator.
46
46
string relativePath = Path . GetRelativePath ( BaseTargetPath , Path . GetDirectoryName ( TargetPath ) ) . Replace ( '\\ ' , '/' ) ;
@@ -55,7 +55,7 @@ public override bool Execute()
55
55
string packageReferences = "" ;
56
56
string netStandardTag = "NETStandardImplicitPackageVersion" ;
57
57
58
- if ( targetFramework == "netstandard2.0" && ! includesNetStandard21 && ! includesNetCoreApp30 )
58
+ if ( targetFramework == "netstandard2.0" )
59
59
{
60
60
packageReferences += $ " <PackageReference Include=\" NETStandard.Library\" Version=\" $({ netStandardTag } )\" />\n ";
61
61
}
@@ -135,12 +135,18 @@ public override bool Execute()
135
135
}
136
136
}
137
137
138
+ tfmSpecificProperties += $ " <PropertyGroup Condition=\" '$(TargetFramework)' == '{ targetFramework } ' \" >\n ";
138
139
if ( subPath == "lib" )
139
140
{
140
- outputPathByTfm += $ " <PropertyGroup Condition=\" '$(TargetFramework)' == '{ targetFramework } ' \" >\n ";
141
- outputPathByTfm += $ " <OutputPath>$(ArtifactsBinDir){ relativePath } /{ subPath } /</OutputPath>\n ";
142
- outputPathByTfm += $ " </PropertyGroup>\n \n ";
141
+ tfmSpecificProperties += $ " <OutputPath>$(ArtifactsBinDir){ relativePath } /{ subPath } /</OutputPath>\n ";
143
142
}
143
+ if ( targetFramework == "netstandard2.1" ||
144
+ targetFramework == "netcoreapp3.0" ||
145
+ targetFramework == "net6.0" )
146
+ {
147
+ tfmSpecificProperties += " <DisableImplicitFrameworkReferences>false</DisableImplicitFrameworkReferences>\n " ;
148
+ }
149
+ tfmSpecificProperties += $ " </PropertyGroup>\n \n ";
144
150
}
145
151
146
152
// If necessary, write the strong name key into the project file.
@@ -151,19 +157,12 @@ public override bool Execute()
151
157
keyFileTag = $ "\n <StrongNameKeyId>{ strongNameData . Id } </StrongNameKeyId>";
152
158
}
153
159
154
- string enableImplicitReferencesTag = "" ;
155
- if ( includesNetStandard21 || includesNetCoreApp30 )
156
- {
157
- enableImplicitReferencesTag = "\n <DisableImplicitFrameworkReferences>false</DisableImplicitFrameworkReferences>" ;
158
- }
159
-
160
160
pkgProjectOutput = pkgProjectOutput . Replace ( "$$LowerCaseFileName$$" , PackageId . ToLowerInvariant ( ) ) ;
161
- pkgProjectOutput = pkgProjectOutput . Replace ( "$$OutputPathByTfm $$" , outputPathByTfm ) ;
161
+ pkgProjectOutput = pkgProjectOutput . Replace ( "$$TfmSpecificProperties $$" , tfmSpecificProperties ) ;
162
162
pkgProjectOutput = pkgProjectOutput . Replace ( "$$RelativePath$$" , relativePath ) ;
163
163
pkgProjectOutput = pkgProjectOutput . Replace ( "$$PackageReferences$$" , packageReferenceIncludes ) ;
164
164
pkgProjectOutput = pkgProjectOutput . Replace ( "$$TargetFrameworks$$" , string . Join ( ';' , orderedTargetFrameworks ) ) ;
165
165
pkgProjectOutput = pkgProjectOutput . Replace ( "$$KeyFileTag$$" , keyFileTag ) ;
166
- pkgProjectOutput = pkgProjectOutput . Replace ( "$$EnableImplicitReferencesTag$$" , enableImplicitReferencesTag ) ;
167
166
168
167
// Generate the project file
169
168
Directory . CreateDirectory ( Path . GetDirectoryName ( TargetPath ) ) ;
0 commit comments