@@ -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
@@ -67,7 +66,7 @@ public void It_builds_and_runs_with_package_reference()
6766 var testAsset = _testAssetsManager
6867 . CopyTestAsset ( "NetCoreCsharpAppReferenceCppCliLib" )
6968 . WithSource ( )
70- . WithProjectChanges ( ( projectPath , project ) => ConfigureProject ( projectPath , project , "NewtonSoft.Json" , "13.0.1" , targetFramework , new string [ ] { "_EnablePackageReferencesInVCProjects" , "IncludeWindowsSDKRefFrameworkReferences" } ) ) ;
69+ . WithProjectChanges ( ( projectPath , project ) => ConfigureProject ( projectPath , project , targetFramework , new string [ ] { "_EnablePackageReferencesInVCProjects" , "IncludeWindowsSDKRefFrameworkReferences" } ) ) ;
7170
7271 new BuildCommand ( testAsset , "NETCoreCppCliTest" )
7372 . Execute ( "-p:Platform=x64" )
@@ -85,7 +84,6 @@ public void Given_no_restore_It_builds_cpp_project()
8584 var testAsset = _testAssetsManager
8685 . CopyTestAsset ( "NetCoreCsharpAppReferenceCppCliLib" )
8786 . WithSource ( )
88- . WithProjectChanges ( ( projectPath , project ) => AddPackageReference ( projectPath , project , "NewtonSoft.Json" , "13.0.1" ) )
8987 . WithProjectChanges ( ( projectPath , project ) => AddBuildProperty ( projectPath , project , "EnableManagedpackageReferenceSupport" , "True" ) ) ; ;
9088
9189 new BuildCommand ( testAsset , "NETCoreCppCliTest" )
@@ -99,8 +97,7 @@ public void Given_Wpf_framework_reference_It_builds_cpp_project()
9997 {
10098 var testAsset = _testAssetsManager
10199 . CopyTestAsset ( "CppCliLibWithWpfFrameworkReference" )
102- . WithSource ( )
103- . WithProjectChanges ( ( projectPath , project ) => AddPackageReference ( projectPath , project , "NewtonSoft.Json" , "13.0.1" ) ) ;
100+ . WithSource ( ) ;
104101
105102 new BuildCommand ( testAsset )
106103 . Execute ( "-p:Platform=x64" )
@@ -197,25 +194,13 @@ private void ChangeTargetFramework(string projectPath, XDocument project, string
197194 }
198195 }
199196
200- private void ConfigureProject ( string projectPath , XDocument project , string package , string version , string targetFramework , string [ ] properties )
197+ private void ConfigureProject ( string projectPath , XDocument project , string targetFramework , string [ ] properties )
201198 {
202199 AddBuildProperty ( projectPath , project , "EnableManagedpackageReferenceSupport" , "true" ) ;
203200 ChangeTargetFramework ( projectPath , project , targetFramework ) ;
204- AddPackageReference ( projectPath , project , package , version ) ;
205201 RecordProperties ( projectPath , project , properties ) ;
206202 }
207203
208- private void AddPackageReference ( string projectPath , XDocument project , string package , string version )
209- {
210- if ( Path . GetExtension ( projectPath ) == ".vcxproj" )
211- {
212- XNamespace ns = project . Root . Name . Namespace ;
213- XElement itemGroup = project . Root . Descendants ( ns + "ItemGroup" ) . First ( ) ;
214- itemGroup . Add ( new XElement ( ns + "PackageReference" , new XAttribute ( "Include" , package ) ,
215- new XAttribute ( "Version" , version ) ) ) ;
216-
217- }
218- }
219204 private void AddBuildProperty ( string projectPath , XDocument project , string property , string value )
220205 {
221206 if ( Path . GetExtension ( projectPath ) == ".vcxproj" )
0 commit comments