@@ -31,7 +31,6 @@ public void It_builds_and_runs()
3131 var testAsset = _testAssetsManager
3232 . CopyTestAsset ( "NetCoreCsharpAppReferenceCppCliLib" )
3333 . WithSource ( )
34- . WithProjectChanges ( ( projectPath , project ) => AddPackageReference ( projectPath , project , "NewtonSoft.Json" , "13.0.1" ) )
3534 . WithProjectChanges ( ( projectPath , project ) => AddBuildProperty ( projectPath , project , "EnableManagedpackageReferenceSupport" , "true" ) ) ;
3635
3736 // build projects separately with BuildProjectReferences=false to simulate VS build behavior
@@ -69,7 +68,7 @@ public void It_builds_and_runs_with_package_reference()
6968 var testAsset = _testAssetsManager
7069 . CopyTestAsset ( "NetCoreCsharpAppReferenceCppCliLib" )
7170 . WithSource ( )
72- . WithProjectChanges ( ( projectPath , project ) => ConfigureProject ( projectPath , project , "NewtonSoft.Json" , "13.0.1" , targetFramework , new string [ ] { "_EnablePackageReferencesInVCProjects" , "IncludeWindowsSDKRefFrameworkReferences" } ) ) ;
71+ . WithProjectChanges ( ( projectPath , project ) => ConfigureProject ( projectPath , project , targetFramework , new string [ ] { "_EnablePackageReferencesInVCProjects" , "IncludeWindowsSDKRefFrameworkReferences" } ) ) ;
7372
7473 new BuildCommand ( testAsset , "NETCoreCppCliTest" )
7574 . Execute ( "-p:Platform=x64" )
@@ -87,7 +86,6 @@ public void Given_no_restore_It_builds_cpp_project()
8786 var testAsset = _testAssetsManager
8887 . CopyTestAsset ( "NetCoreCsharpAppReferenceCppCliLib" )
8988 . WithSource ( )
90- . WithProjectChanges ( ( projectPath , project ) => AddPackageReference ( projectPath , project , "NewtonSoft.Json" , "13.0.1" ) )
9189 . WithProjectChanges ( ( projectPath , project ) => AddBuildProperty ( projectPath , project , "EnableManagedpackageReferenceSupport" , "True" ) ) ; ;
9290
9391 new BuildCommand ( testAsset , "NETCoreCppCliTest" )
@@ -101,8 +99,7 @@ public void Given_Wpf_framework_reference_It_builds_cpp_project()
10199 {
102100 var testAsset = _testAssetsManager
103101 . CopyTestAsset ( "CppCliLibWithWpfFrameworkReference" )
104- . WithSource ( )
105- . WithProjectChanges ( ( projectPath , project ) => AddPackageReference ( projectPath , project , "NewtonSoft.Json" , "13.0.1" ) ) ;
102+ . WithSource ( ) ;
106103
107104 new BuildCommand ( testAsset )
108105 . Execute ( "-p:Platform=x64" )
@@ -199,25 +196,13 @@ private void ChangeTargetFramework(string projectPath, XDocument project, string
199196 }
200197 }
201198
202- private void ConfigureProject ( string projectPath , XDocument project , string package , string version , string targetFramework , string [ ] properties )
199+ private void ConfigureProject ( string projectPath , XDocument project , string targetFramework , string [ ] properties )
203200 {
204201 AddBuildProperty ( projectPath , project , "EnableManagedpackageReferenceSupport" , "true" ) ;
205202 ChangeTargetFramework ( projectPath , project , targetFramework ) ;
206- AddPackageReference ( projectPath , project , package , version ) ;
207203 RecordProperties ( projectPath , project , properties ) ;
208204 }
209205
210- private void AddPackageReference ( string projectPath , XDocument project , string package , string version )
211- {
212- if ( Path . GetExtension ( projectPath ) == ".vcxproj" )
213- {
214- XNamespace ns = project . Root . Name . Namespace ;
215- XElement itemGroup = project . Root . Descendants ( ns + "ItemGroup" ) . First ( ) ;
216- itemGroup . Add ( new XElement ( ns + "PackageReference" , new XAttribute ( "Include" , package ) ,
217- new XAttribute ( "Version" , version ) ) ) ;
218-
219- }
220- }
221206 private void AddBuildProperty ( string projectPath , XDocument project , string property , string value )
222207 {
223208 if ( Path . GetExtension ( projectPath ) == ".vcxproj" )
0 commit comments