dependabot-nuget 0.258.0 → 0.259.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/helpers/lib/NuGetUpdater/Directory.Packages.props +2 -0
  3. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/DiscoverCommand.cs +2 -2
  4. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Discover.cs +255 -191
  5. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs +63 -35
  6. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs +107 -14
  7. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +9 -5
  8. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathHelper.cs +18 -0
  9. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTestBase.cs +6 -1
  10. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.DotNetToolsJson.cs +6 -2
  11. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.GlobalJson.cs +6 -2
  12. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.PackagesConfig.cs +11 -21
  13. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Proj.cs +95 -0
  14. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Project.cs +204 -62
  15. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs +64 -45
  16. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/MockNuGetPackage.cs +419 -0
  17. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/NuGetUpdater.Core.Test.csproj +1 -0
  18. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TemporaryDirectory.cs +7 -2
  19. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +77 -19
  20. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DirsProj.cs +120 -91
  21. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DotNetTools.cs +132 -97
  22. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.GlobalJson.cs +93 -75
  23. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Mixed.cs +45 -42
  24. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +1089 -956
  25. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Sdk.cs +1624 -1291
  26. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +296 -293
  27. data/helpers/lib/NuGetUpdater/global.json +6 -0
  28. data/lib/dependabot/nuget/file_parser.rb +4 -5
  29. data/lib/dependabot/nuget/file_updater.rb +1 -1
  30. data/lib/dependabot/nuget/update_checker/dependency_finder.rb +7 -2
  31. data/lib/dependabot/nuget/update_checker/property_updater.rb +1 -0
  32. data/lib/dependabot/nuget/update_checker/version_finder.rb +2 -3
  33. data/lib/dependabot/nuget/update_checker.rb +1 -0
  34. metadata +8 -5
@@ -9,120 +9,140 @@ public partial class UpdateWorkerTests
9
9
  [Fact]
10
10
  public async Task UpdateSingleDependencyInPackagesConfig()
11
11
  {
12
- // update Newtonsoft.Json from 7.0.1 to 13.0.1
13
- await TestUpdateForProject("Newtonsoft.Json", "7.0.1", "13.0.1",
12
+ // update Some.Package from 7.0.1 to 13.0.1
13
+ await TestUpdateForProject("Some.Package", "7.0.1", "13.0.1",
14
+ packages:
15
+ [
16
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "7.0.1", "net45"),
17
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net45"),
18
+ ],
14
19
  // existing
15
20
  projectContents: """
16
- <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
17
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
18
- <PropertyGroup>
19
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
20
- </PropertyGroup>
21
- <ItemGroup>
22
- <None Include="packages.config" />
23
- </ItemGroup>
24
- <ItemGroup>
25
- <Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
26
- <HintPath>packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
27
- <Private>True</Private>
28
- </Reference>
29
- </ItemGroup>
30
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
31
- </Project>
32
- """,
21
+ <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
22
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
23
+ <PropertyGroup>
24
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
25
+ </PropertyGroup>
26
+ <ItemGroup>
27
+ <None Include="packages.config" />
28
+ </ItemGroup>
29
+ <ItemGroup>
30
+ <Reference Include="Some.Package, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
31
+ <HintPath>packages\Some.Package.7.0.1\lib\net45\Some.Package.dll</HintPath>
32
+ <Private>True</Private>
33
+ </Reference>
34
+ </ItemGroup>
35
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
36
+ </Project>
37
+ """,
33
38
  packagesConfigContents: """
34
- <packages>
35
- <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
36
- </packages>
37
- """,
39
+ <packages>
40
+ <package id="Some.Package" version="7.0.1" targetFramework="net45" />
41
+ </packages>
42
+ """,
38
43
  // expected
39
44
  expectedProjectContents: """
40
- <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
41
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
42
- <PropertyGroup>
43
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
44
- </PropertyGroup>
45
- <ItemGroup>
46
- <None Include="packages.config" />
47
- </ItemGroup>
48
- <ItemGroup>
49
- <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
50
- <HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
51
- <Private>True</Private>
52
- </Reference>
53
- </ItemGroup>
54
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
55
- </Project>
56
- """,
45
+ <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
46
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
47
+ <PropertyGroup>
48
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
49
+ </PropertyGroup>
50
+ <ItemGroup>
51
+ <None Include="packages.config" />
52
+ </ItemGroup>
53
+ <ItemGroup>
54
+ <Reference Include="Some.Package">
55
+ <HintPath>packages\Some.Package.13.0.1\lib\net45\Some.Package.dll</HintPath>
56
+ <Private>True</Private>
57
+ </Reference>
58
+ </ItemGroup>
59
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
60
+ </Project>
61
+ """,
57
62
  expectedPackagesConfigContents: """
58
- <?xml version="1.0" encoding="utf-8"?>
59
- <packages>
60
- <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
61
- </packages>
62
- """);
63
+ <?xml version="1.0" encoding="utf-8"?>
64
+ <packages>
65
+ <package id="Some.Package" version="13.0.1" targetFramework="net45" />
66
+ </packages>
67
+ """
68
+ );
63
69
  }
64
70
 
65
71
  [Fact]
66
72
  public async Task UpdateSingleDependencyInPackagesConfig_ReferenceHasNoAssemblyVersion()
67
73
  {
68
- // update Newtonsoft.Json from 7.0.1 to 13.0.1
69
- await TestUpdateForProject("Newtonsoft.Json", "7.0.1", "13.0.1",
74
+ // update Some.Package from 7.0.1 to 13.0.1
75
+ await TestUpdateForProject("Some.Package", "7.0.1", "13.0.1",
76
+ packages:
77
+ [
78
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "7.0.1", "net45"),
79
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net45"),
80
+ ],
70
81
  // existing
71
82
  projectContents: """
72
- <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
73
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
74
- <PropertyGroup>
75
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
76
- </PropertyGroup>
77
- <ItemGroup>
78
- <None Include="packages.config" />
79
- </ItemGroup>
80
- <ItemGroup>
81
- <Reference Include="Newtonsoft.Json">
82
- <HintPath>packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
83
- <Private>True</Private>
84
- </Reference>
85
- </ItemGroup>
86
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
87
- </Project>
88
- """,
83
+ <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
84
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
85
+ <PropertyGroup>
86
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
87
+ </PropertyGroup>
88
+ <ItemGroup>
89
+ <None Include="packages.config" />
90
+ </ItemGroup>
91
+ <ItemGroup>
92
+ <Reference Include="Some.Package">
93
+ <HintPath>packages\Some.Package.7.0.1\lib\net45\Some.Package.dll</HintPath>
94
+ <Private>True</Private>
95
+ </Reference>
96
+ </ItemGroup>
97
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
98
+ </Project>
99
+ """,
89
100
  packagesConfigContents: """
90
- <packages>
91
- <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
92
- </packages>
93
- """,
101
+ <packages>
102
+ <package id="Some.Package" version="7.0.1" targetFramework="net45" />
103
+ </packages>
104
+ """,
94
105
  // expected
95
106
  expectedProjectContents: """
96
- <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
97
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
98
- <PropertyGroup>
99
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
100
- </PropertyGroup>
101
- <ItemGroup>
102
- <None Include="packages.config" />
103
- </ItemGroup>
104
- <ItemGroup>
105
- <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
106
- <HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
107
- <Private>True</Private>
108
- </Reference>
109
- </ItemGroup>
110
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
111
- </Project>
112
- """,
107
+ <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
108
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
109
+ <PropertyGroup>
110
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
111
+ </PropertyGroup>
112
+ <ItemGroup>
113
+ <None Include="packages.config" />
114
+ </ItemGroup>
115
+ <ItemGroup>
116
+ <Reference Include="Some.Package">
117
+ <HintPath>packages\Some.Package.13.0.1\lib\net45\Some.Package.dll</HintPath>
118
+ <Private>True</Private>
119
+ </Reference>
120
+ </ItemGroup>
121
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
122
+ </Project>
123
+ """,
113
124
  expectedPackagesConfigContents: """
114
- <?xml version="1.0" encoding="utf-8"?>
115
- <packages>
116
- <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
117
- </packages>
118
- """);
125
+ <?xml version="1.0" encoding="utf-8"?>
126
+ <packages>
127
+ <package id="Some.Package" version="13.0.1" targetFramework="net45" />
128
+ </packages>
129
+ """
130
+ );
119
131
  }
120
132
 
121
133
  [Fact]
122
134
  public async Task UpdateSingleDependencyInPackagesConfig_SpecifiedDependencyHasNoPackagesPath()
123
135
  {
124
- // update jQuery from 1.6.4 to 3.7.1
125
- await TestUpdateForProject("jQuery", "1.6.4", "3.7.1",
136
+ // update Package.With.No.Assembly from 1.0.0
137
+ await TestUpdateForProject("Package.With.No.Assembly", "1.0.0", "1.1.0",
138
+ packages:
139
+ [
140
+ // this package has no `lib` directory, but it's still valid because it has a `content` directory
141
+ new MockNuGetPackage("Package.With.No.Assembly", "1.0.0", Files: [("content/some-content.txt", [])]),
142
+ new MockNuGetPackage("Package.With.No.Assembly", "1.1.0", Files: [("content/some-content.txt", [])]),
143
+ // this is a regular package that's not being updated
144
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "1.0.0", "net46"),
145
+ ],
126
146
  // existing
127
147
  projectContents: """
128
148
  <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
@@ -134,8 +154,8 @@ public partial class UpdateWorkerTests
134
154
  <None Include="packages.config" />
135
155
  </ItemGroup>
136
156
  <ItemGroup>
137
- <Reference Include="Newtonsoft.Json">
138
- <HintPath>packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
157
+ <Reference Include="Some.Package">
158
+ <HintPath>packages\Some.Package.1.0.0\lib\net46\Some.Package.dll</HintPath>
139
159
  <Private>True</Private>
140
160
  </Reference>
141
161
  </ItemGroup>
@@ -144,8 +164,8 @@ public partial class UpdateWorkerTests
144
164
  """,
145
165
  packagesConfigContents: """
146
166
  <packages>
147
- <package id="jQuery" version="1.6.4" targetFramework="net45" />
148
- <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
167
+ <package id="Package.With.No.Assembly" version="1.0.0" targetFramework="net46" />
168
+ <package id="Some.Package" version="1.0.0" targetFramework="net46" />
149
169
  </packages>
150
170
  """,
151
171
  // expected
@@ -159,8 +179,8 @@ public partial class UpdateWorkerTests
159
179
  <None Include="packages.config" />
160
180
  </ItemGroup>
161
181
  <ItemGroup>
162
- <Reference Include="Newtonsoft.Json">
163
- <HintPath>packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
182
+ <Reference Include="Some.Package">
183
+ <HintPath>packages\Some.Package.1.0.0\lib\net46\Some.Package.dll</HintPath>
164
184
  <Private>True</Private>
165
185
  </Reference>
166
186
  </ItemGroup>
@@ -170,8 +190,8 @@ public partial class UpdateWorkerTests
170
190
  expectedPackagesConfigContents: """
171
191
  <?xml version="1.0" encoding="utf-8"?>
172
192
  <packages>
173
- <package id="jQuery" version="3.7.1" targetFramework="net46" />
174
- <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
193
+ <package id="Package.With.No.Assembly" version="1.1.0" targetFramework="net46" />
194
+ <package id="Some.Package" version="1.0.0" targetFramework="net46" />
175
195
  </packages>
176
196
  """
177
197
  );
@@ -180,8 +200,14 @@ public partial class UpdateWorkerTests
180
200
  [Fact]
181
201
  public async Task UpdateSingleDependencyInPackagesConfig_NoPackagesPathCanBeFound()
182
202
  {
183
- // update jQuery from 3.7.0 to 3.7.1
184
- await TestUpdateForProject("jQuery", "3.7.0", "3.7.1",
203
+ // update Package.With.No.Assembly from 1.0.0 to 1.0.0
204
+ await TestUpdateForProject("Package.With.No.Assembly", "1.0.0", "1.1.0",
205
+ packages:
206
+ [
207
+ // this package has no `lib` directory, but it's still valid because it has a `content` directory
208
+ new MockNuGetPackage("Package.With.No.Assembly", "1.0.0", Files: [("content/some-content.txt", [])]),
209
+ new MockNuGetPackage("Package.With.No.Assembly", "1.1.0", Files: [("content/some-content.txt", [])]),
210
+ ],
185
211
  // existing
186
212
  projectContents: """
187
213
  <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
@@ -197,7 +223,7 @@ public partial class UpdateWorkerTests
197
223
  """,
198
224
  packagesConfigContents: """
199
225
  <packages>
200
- <package id="jQuery" version="3.7.0" targetFramework="net45" />
226
+ <package id="Package.With.No.Assembly" version="1.0.0" targetFramework="net45" />
201
227
  </packages>
202
228
  """,
203
229
  // expected
@@ -216,219 +242,299 @@ public partial class UpdateWorkerTests
216
242
  expectedPackagesConfigContents: """
217
243
  <?xml version="1.0" encoding="utf-8"?>
218
244
  <packages>
219
- <package id="jQuery" version="3.7.1" targetFramework="net45" />
245
+ <package id="Package.With.No.Assembly" version="1.1.0" targetFramework="net45" />
220
246
  </packages>
221
- """);
247
+ """
248
+ );
222
249
  }
223
250
 
224
251
  [Fact]
225
- public async Task UpdateSingleDependencyInPackagesConfigButNotToLatest()
252
+ public async Task UpdateDependency_NoAssembliesAndContentDirectoryDiffersByCase()
226
253
  {
227
- // update Newtonsoft.Json from 7.0.1 to 9.0.1, purposefully not updating all the way to the newest
228
- await TestUpdateForProject("Newtonsoft.Json", "7.0.1", "9.0.1",
254
+ // update Package.With.No.Assembly from 1.0.0 to 1.0.0
255
+ await TestUpdateForProject("Package.With.No.Assembly", "1.0.0", "1.1.0",
256
+ packages:
257
+ [
258
+ // this package is expected to have a directory named `content`, but here it differs by case as `Content`
259
+ new MockNuGetPackage("Package.With.No.Assembly", "1.0.0", Files: [("Content/some-content.txt", [])]),
260
+ new MockNuGetPackage("Package.With.No.Assembly", "1.1.0", Files: [("Content/some-content.txt", [])]),
261
+ ],
229
262
  // existing
230
263
  projectContents: """
231
- <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
232
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
233
- <PropertyGroup>
234
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
235
- </PropertyGroup>
236
- <ItemGroup>
237
- <None Include="packages.config" />
238
- </ItemGroup>
239
- <ItemGroup>
240
- <Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
241
- <HintPath>packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
242
- <Private>True</Private>
243
- </Reference>
244
- </ItemGroup>
245
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
246
- </Project>
247
- """,
264
+ <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
265
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
266
+ <PropertyGroup>
267
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
268
+ </PropertyGroup>
269
+ <ItemGroup>
270
+ <None Include="packages.config" />
271
+ </ItemGroup>
272
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
273
+ </Project>
274
+ """,
248
275
  packagesConfigContents: """
249
- <packages>
250
- <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
251
- </packages>
252
- """,
276
+ <packages>
277
+ <package id="Package.With.No.Assembly" version="1.0.0" targetFramework="net45" />
278
+ </packages>
279
+ """,
253
280
  // expected
254
281
  expectedProjectContents: """
255
- <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
256
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
257
- <PropertyGroup>
258
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
259
- </PropertyGroup>
260
- <ItemGroup>
261
- <None Include="packages.config" />
262
- </ItemGroup>
263
- <ItemGroup>
264
- <Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
265
- <HintPath>packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
266
- <Private>True</Private>
267
- </Reference>
268
- </ItemGroup>
269
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
270
- </Project>
271
- """,
282
+ <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
283
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
284
+ <PropertyGroup>
285
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
286
+ </PropertyGroup>
287
+ <ItemGroup>
288
+ <None Include="packages.config" />
289
+ </ItemGroup>
290
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
291
+ </Project>
292
+ """,
272
293
  expectedPackagesConfigContents: """
273
- <?xml version="1.0" encoding="utf-8"?>
274
- <packages>
275
- <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
276
- </packages>
277
- """);
294
+ <?xml version="1.0" encoding="utf-8"?>
295
+ <packages>
296
+ <package id="Package.With.No.Assembly" version="1.1.0" targetFramework="net45" />
297
+ </packages>
298
+ """
299
+ );
278
300
  }
279
301
 
280
302
  [Fact]
281
- public async Task UpdateSpecifiedVersionInPackagesConfigButNotOthers()
303
+ public async Task UpdateSingleDependencyInPackagesConfigButNotToLatest()
282
304
  {
283
- // update Newtonsoft.Json from 7.0.1 to 13.0.1, but leave HtmlAgilityPack alone
284
- await TestUpdateForProject("Newtonsoft.Json", "7.0.1", "13.0.1",
305
+ // update Some.Package from 7.0.1 to 9.0.1, purposefully not updating all the way to the newest
306
+ await TestUpdateForProject("Some.Package", "7.0.1", "9.0.1",
307
+ packages:
308
+ [
309
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "7.0.1", "net45"),
310
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "9.0.1", "net45"),
311
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net45"),
312
+ ],
285
313
  // existing
286
314
  projectContents: """
287
- <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
288
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
289
- <PropertyGroup>
290
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
291
- </PropertyGroup>
292
- <ItemGroup>
293
- <None Include="packages.config" />
294
- </ItemGroup>
295
- <ItemGroup>
296
- <Reference Include="HtmlAgilityPack, Version=1.11.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
297
- <HintPath>packages\HtmlAgilityPack.1.11.0\lib\net45\HtmlAgilityPack.dll</HintPath>
298
- <Private>True</Private>
299
- </Reference>
300
- <Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
301
- <HintPath>packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
302
- <Private>True</Private>
303
- </Reference>
304
- </ItemGroup>
305
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
306
- </Project>
307
- """,
315
+ <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
316
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
317
+ <PropertyGroup>
318
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
319
+ </PropertyGroup>
320
+ <ItemGroup>
321
+ <None Include="packages.config" />
322
+ </ItemGroup>
323
+ <ItemGroup>
324
+ <Reference Include="Some.Package">
325
+ <HintPath>packages\Some.Package.7.0.1\lib\net45\Some.Package.dll</HintPath>
326
+ <Private>True</Private>
327
+ </Reference>
328
+ </ItemGroup>
329
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
330
+ </Project>
331
+ """,
308
332
  packagesConfigContents: """
309
- <packages>
310
- <package id="HtmlAgilityPack" version="1.11.0" targetFramework="net45" />
311
- <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
312
- </packages>
313
- """,
333
+ <packages>
334
+ <package id="Some.Package" version="7.0.1" targetFramework="net45" />
335
+ </packages>
336
+ """,
314
337
  // expected
315
338
  expectedProjectContents: """
316
- <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
317
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
318
- <PropertyGroup>
319
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
320
- </PropertyGroup>
321
- <ItemGroup>
322
- <None Include="packages.config" />
323
- </ItemGroup>
324
- <ItemGroup>
325
- <Reference Include="HtmlAgilityPack, Version=1.11.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
326
- <HintPath>packages\HtmlAgilityPack.1.11.0\lib\net45\HtmlAgilityPack.dll</HintPath>
327
- <Private>True</Private>
328
- </Reference>
329
- <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
330
- <HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
331
- <Private>True</Private>
332
- </Reference>
333
- </ItemGroup>
334
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
335
- </Project>
336
- """,
339
+ <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
340
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
341
+ <PropertyGroup>
342
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
343
+ </PropertyGroup>
344
+ <ItemGroup>
345
+ <None Include="packages.config" />
346
+ </ItemGroup>
347
+ <ItemGroup>
348
+ <Reference Include="Some.Package">
349
+ <HintPath>packages\Some.Package.9.0.1\lib\net45\Some.Package.dll</HintPath>
350
+ <Private>True</Private>
351
+ </Reference>
352
+ </ItemGroup>
353
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
354
+ </Project>
355
+ """,
337
356
  expectedPackagesConfigContents: """
338
- <?xml version="1.0" encoding="utf-8"?>
339
- <packages>
340
- <package id="HtmlAgilityPack" version="1.11.0" targetFramework="net45" />
341
- <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
342
- </packages>
343
- """);
357
+ <?xml version="1.0" encoding="utf-8"?>
358
+ <packages>
359
+ <package id="Some.Package" version="9.0.1" targetFramework="net45" />
360
+ </packages>
361
+ """
362
+ );
363
+ }
364
+
365
+ [Fact]
366
+ public async Task UpdateSpecifiedVersionInPackagesConfigButNotOthers()
367
+ {
368
+ // update Some.Package from 7.0.1 to 13.0.1, but leave Some.Unrelated.Package alone
369
+ await TestUpdateForProject("Some.Package", "7.0.1", "13.0.1",
370
+ packages:
371
+ [
372
+ // this package is upgraded
373
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "7.0.1", "net45"),
374
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net45"),
375
+ // this package is not upgraded
376
+ MockNuGetPackage.CreateSimplePackage("Some.Unrelated.Package", "1.0.0", "net45"),
377
+ MockNuGetPackage.CreateSimplePackage("Some.Unrelated.Package", "1.1.0", "net45"),
378
+ ],
379
+ // existing
380
+ projectContents: """
381
+ <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
382
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
383
+ <PropertyGroup>
384
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
385
+ </PropertyGroup>
386
+ <ItemGroup>
387
+ <None Include="packages.config" />
388
+ </ItemGroup>
389
+ <ItemGroup>
390
+ <Reference Include="Some.Package">
391
+ <HintPath>packages\Some.Package.7.0.1\lib\net45\Some.Package.dll</HintPath>
392
+ <Private>True</Private>
393
+ </Reference>
394
+ <Reference Include="Some.Unrelated.Package">
395
+ <HintPath>packages\Some.Unrelated.Package.1.0.0\lib\net45\Some.Unrelated.Package.dll</HintPath>
396
+ <Private>True</Private>
397
+ </Reference>
398
+ </ItemGroup>
399
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
400
+ </Project>
401
+ """,
402
+ packagesConfigContents: """
403
+ <packages>
404
+ <package id="Some.Unrelated.Package" version="1.0.0" targetFramework="net45" />
405
+ <package id="Some.Package" version="7.0.1" targetFramework="net45" />
406
+ </packages>
407
+ """,
408
+ // expected
409
+ expectedProjectContents: """
410
+ <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
411
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
412
+ <PropertyGroup>
413
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
414
+ </PropertyGroup>
415
+ <ItemGroup>
416
+ <None Include="packages.config" />
417
+ </ItemGroup>
418
+ <ItemGroup>
419
+ <Reference Include="Some.Package">
420
+ <HintPath>packages\Some.Package.13.0.1\lib\net45\Some.Package.dll</HintPath>
421
+ <Private>True</Private>
422
+ </Reference>
423
+ <Reference Include="Some.Unrelated.Package">
424
+ <HintPath>packages\Some.Unrelated.Package.1.0.0\lib\net45\Some.Unrelated.Package.dll</HintPath>
425
+ <Private>True</Private>
426
+ </Reference>
427
+ </ItemGroup>
428
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
429
+ </Project>
430
+ """,
431
+ expectedPackagesConfigContents: """
432
+ <?xml version="1.0" encoding="utf-8"?>
433
+ <packages>
434
+ <package id="Some.Unrelated.Package" version="1.0.0" targetFramework="net45" />
435
+ <package id="Some.Package" version="13.0.1" targetFramework="net45" />
436
+ </packages>
437
+ """
438
+ );
344
439
  }
345
440
 
346
441
  [Fact]
347
442
  public async Task UpdatePackagesConfigWithNonStandardLocationOfPackagesDirectory()
348
443
  {
349
- // update Newtonsoft.Json from 7.0.1 to 13.0.1 with the actual assembly in a non-standard location
350
- await TestUpdateForProject("Newtonsoft.Json", "7.0.1", "13.0.1",
444
+ // update Some.Package from 7.0.1 to 13.0.1 with the actual assembly in a non-standard location
445
+ await TestUpdateForProject("Some.Package", "7.0.1", "13.0.1",
446
+ packages:
447
+ [
448
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "7.0.1", "net45"),
449
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net45"),
450
+ ],
351
451
  // existing
352
452
  projectContents: """
353
- <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
354
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
355
- <PropertyGroup>
356
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
357
- </PropertyGroup>
358
- <ItemGroup>
359
- <None Include="packages.config" />
360
- </ItemGroup>
361
- <ItemGroup>
362
- <Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
363
- <HintPath>some-non-standard-location\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
364
- <Private>True</Private>
365
- </Reference>
366
- </ItemGroup>
367
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
368
- </Project>
369
- """,
453
+ <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
454
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
455
+ <PropertyGroup>
456
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
457
+ </PropertyGroup>
458
+ <ItemGroup>
459
+ <None Include="packages.config" />
460
+ </ItemGroup>
461
+ <ItemGroup>
462
+ <Reference Include="Some.Package">
463
+ <HintPath>some-non-standard-location\Some.Package.7.0.1\lib\net45\Some.Package.dll</HintPath>
464
+ <Private>True</Private>
465
+ </Reference>
466
+ </ItemGroup>
467
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
468
+ </Project>
469
+ """,
370
470
  packagesConfigContents: """
371
- <packages>
372
- <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
373
- </packages>
374
- """,
471
+ <packages>
472
+ <package id="Some.Package" version="7.0.1" targetFramework="net45" />
473
+ </packages>
474
+ """,
375
475
  // expected
376
476
  expectedProjectContents: """
377
- <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
378
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
379
- <PropertyGroup>
380
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
381
- </PropertyGroup>
382
- <ItemGroup>
383
- <None Include="packages.config" />
384
- </ItemGroup>
385
- <ItemGroup>
386
- <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
387
- <HintPath>some-non-standard-location\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
388
- <Private>True</Private>
389
- </Reference>
390
- </ItemGroup>
391
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
392
- </Project>
393
- """,
477
+ <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
478
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
479
+ <PropertyGroup>
480
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
481
+ </PropertyGroup>
482
+ <ItemGroup>
483
+ <None Include="packages.config" />
484
+ </ItemGroup>
485
+ <ItemGroup>
486
+ <Reference Include="Some.Package">
487
+ <HintPath>some-non-standard-location\Some.Package.13.0.1\lib\net45\Some.Package.dll</HintPath>
488
+ <Private>True</Private>
489
+ </Reference>
490
+ </ItemGroup>
491
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
492
+ </Project>
493
+ """,
394
494
  expectedPackagesConfigContents: """
395
- <?xml version="1.0" encoding="utf-8"?>
396
- <packages>
397
- <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
398
- </packages>
399
- """);
495
+ <?xml version="1.0" encoding="utf-8"?>
496
+ <packages>
497
+ <package id="Some.Package" version="13.0.1" targetFramework="net45" />
498
+ </packages>
499
+ """
500
+ );
400
501
  }
401
502
 
402
503
  [Fact]
403
504
  public async Task UpdateBindingRedirectInAppConfig()
404
505
  {
405
- await TestUpdateForProject("Newtonsoft.Json", "7.0.1", "13.0.1",
506
+ await TestUpdateForProject("Some.Package", "7.0.1", "13.0.1",
507
+ packages:
508
+ [
509
+ MockNuGetPackage.CreatePackageWithAssembly("Some.Package", "7.0.1", "net45", "7.0.0.0"),
510
+ MockNuGetPackage.CreatePackageWithAssembly("Some.Package", "13.0.1", "net45", "13.0.0.0"),
511
+ ],
406
512
  projectContents: """
407
- <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
408
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
409
- <PropertyGroup>
410
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
411
- </PropertyGroup>
412
- <ItemGroup>
413
- <None Include="packages.config" />
414
- </ItemGroup>
415
- <ItemGroup>
416
- <None Include="app.config" />
417
- </ItemGroup>
418
- <ItemGroup>
419
- <Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
420
- <HintPath>packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
421
- <Private>True</Private>
422
- </Reference>
423
- </ItemGroup>
424
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
425
- </Project>
426
- """,
513
+ <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
514
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
515
+ <PropertyGroup>
516
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
517
+ </PropertyGroup>
518
+ <ItemGroup>
519
+ <None Include="packages.config" />
520
+ </ItemGroup>
521
+ <ItemGroup>
522
+ <None Include="app.config" />
523
+ </ItemGroup>
524
+ <ItemGroup>
525
+ <Reference Include="Some.Package, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null">
526
+ <HintPath>packages\Some.Package.7.0.1\lib\net45\Some.Package.dll</HintPath>
527
+ <Private>True</Private>
528
+ </Reference>
529
+ </ItemGroup>
530
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
531
+ </Project>
532
+ """,
427
533
  packagesConfigContents: """
428
- <packages>
429
- <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
430
- </packages>
431
- """,
534
+ <packages>
535
+ <package id="Some.Package" version="7.0.1" targetFramework="net45" />
536
+ </packages>
537
+ """,
432
538
  additionalFiles:
433
539
  [
434
540
  ("app.config", """
@@ -436,7 +542,7 @@ public partial class UpdateWorkerTests
436
542
  <runtime>
437
543
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
438
544
  <dependentAssembly>
439
- <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
545
+ <assemblyIdentity name="Some.Package" publicKeyToken="null" culture="neutral" />
440
546
  <bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
441
547
  </dependentAssembly>
442
548
  </assemblyBinding>
@@ -445,32 +551,32 @@ public partial class UpdateWorkerTests
445
551
  """)
446
552
  ],
447
553
  expectedProjectContents: """
448
- <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
449
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
450
- <PropertyGroup>
451
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
452
- </PropertyGroup>
453
- <ItemGroup>
454
- <None Include="packages.config" />
455
- </ItemGroup>
456
- <ItemGroup>
457
- <None Include="app.config" />
458
- </ItemGroup>
459
- <ItemGroup>
460
- <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
461
- <HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
462
- <Private>True</Private>
463
- </Reference>
464
- </ItemGroup>
465
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
466
- </Project>
467
- """,
554
+ <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
555
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
556
+ <PropertyGroup>
557
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
558
+ </PropertyGroup>
559
+ <ItemGroup>
560
+ <None Include="packages.config" />
561
+ </ItemGroup>
562
+ <ItemGroup>
563
+ <None Include="app.config" />
564
+ </ItemGroup>
565
+ <ItemGroup>
566
+ <Reference Include="Some.Package, Version=13.0.0.0, Culture=neutral, PublicKeyToken=null">
567
+ <HintPath>packages\Some.Package.13.0.1\lib\net45\Some.Package.dll</HintPath>
568
+ <Private>True</Private>
569
+ </Reference>
570
+ </ItemGroup>
571
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
572
+ </Project>
573
+ """,
468
574
  expectedPackagesConfigContents: """
469
- <?xml version="1.0" encoding="utf-8"?>
470
- <packages>
471
- <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
472
- </packages>
473
- """,
575
+ <?xml version="1.0" encoding="utf-8"?>
576
+ <packages>
577
+ <package id="Some.Package" version="13.0.1" targetFramework="net45" />
578
+ </packages>
579
+ """,
474
580
  additionalFilesExpected:
475
581
  [
476
582
  ("app.config", """
@@ -478,104 +584,110 @@ public partial class UpdateWorkerTests
478
584
  <runtime>
479
585
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
480
586
  <dependentAssembly>
481
- <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
587
+ <assemblyIdentity name="Some.Package" publicKeyToken="null" culture="neutral" />
482
588
  <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
483
589
  </dependentAssembly>
484
590
  </assemblyBinding>
485
591
  </runtime>
486
592
  </configuration>
487
593
  """)
488
- ]);
594
+ ]
595
+ );
489
596
  }
490
597
 
491
598
  [Fact]
492
599
  public async Task UpdateBindingRedirectInWebConfig()
493
600
  {
494
- await TestUpdateForProject("Newtonsoft.Json", "7.0.1", "13.0.1",
601
+ await TestUpdateForProject("Some.Package", "7.0.1", "13.0.1",
602
+ packages:
603
+ [
604
+ MockNuGetPackage.CreatePackageWithAssembly("Some.Package", "7.0.1", "net45", "7.0.0.0"),
605
+ MockNuGetPackage.CreatePackageWithAssembly("Some.Package", "13.0.1", "net45", "13.0.0.0"),
606
+ ],
495
607
  projectContents: """
496
- <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
497
- <PropertyGroup>
498
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
499
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
500
- <ProductVersion>
501
- </ProductVersion>
502
- <SchemaVersion>2.0</SchemaVersion>
503
- <ProjectGuid>ac83fc79-b637-445b-acb0-9be238ad077f</ProjectGuid>
504
- <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
505
- <OutputType>Library</OutputType>
506
- <AppDesignerFolder>Properties</AppDesignerFolder>
507
- <RootNamespace>TestProject</RootNamespace>
508
- <AssemblyName>TestProject</AssemblyName>
509
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
510
- </PropertyGroup>
511
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
512
- <DebugSymbols>true</DebugSymbols>
513
- <DebugType>full</DebugType>
514
- <Optimize>false</Optimize>
515
- <OutputPath>bin\</OutputPath>
516
- <DefineConstants>DEBUG;TRACE</DefineConstants>
517
- <ErrorReport>prompt</ErrorReport>
518
- <WarningLevel>4</WarningLevel>
519
- </PropertyGroup>
520
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
521
- <DebugType>pdbonly</DebugType>
522
- <Optimize>true</Optimize>
523
- <OutputPath>bin\</OutputPath>
524
- <DefineConstants>TRACE</DefineConstants>
525
- <ErrorReport>prompt</ErrorReport>
526
- <WarningLevel>4</WarningLevel>
527
- </PropertyGroup>
528
- <ItemGroup>
529
- <Reference Include="Microsoft.CSharp" />
530
- <Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
531
- <HintPath>packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
532
- <Private>True</Private>
533
- </Reference>
534
- <Reference Include="System.Web.DynamicData" />
535
- <Reference Include="System.Web.Entity" />
536
- <Reference Include="System.Web.ApplicationServices" />
537
- <Reference Include="System" />
538
- <Reference Include="System.Data" />
539
- <Reference Include="System.Core" />
540
- <Reference Include="System.Data.DataSetExtensions" />
541
- <Reference Include="System.Web.Extensions" />
542
- <Reference Include="System.Xml.Linq" />
543
- <Reference Include="System.Drawing" />
544
- <Reference Include="System.Web" />
545
- <Reference Include="System.Xml" />
546
- <Reference Include="System.Configuration" />
547
- <Reference Include="System.Web.Services" />
548
- <Reference Include="System.EnterpriseServices" />
549
- </ItemGroup>
550
- <ItemGroup>
551
- <None Include="packages.config" />
552
- <Content Include="web.config" />
553
- <Content Include="web.Debug.config">
554
- <DependentUpon>web.config</DependentUpon>
555
- </Content>
556
- <Content Include="web.Release.config">
557
- <DependentUpon>web.config</DependentUpon>
558
- </Content>
559
- </ItemGroup>
560
- <ItemGroup>
561
- <Compile Include="Properties\AssemblyInfo.cs" />
562
- </ItemGroup>
563
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
564
- <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
565
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
566
- Other similar extension points exist, see Microsoft.Common.targets.
567
- <Target Name="BeforeBuild">
568
- </Target>
569
- <Target Name="AfterBuild">
570
- </Target>
571
- -->
572
- </Project>
573
- """,
608
+ <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
609
+ <PropertyGroup>
610
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
611
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
612
+ <ProductVersion>
613
+ </ProductVersion>
614
+ <SchemaVersion>2.0</SchemaVersion>
615
+ <ProjectGuid>ac83fc79-b637-445b-acb0-9be238ad077f</ProjectGuid>
616
+ <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
617
+ <OutputType>Library</OutputType>
618
+ <AppDesignerFolder>Properties</AppDesignerFolder>
619
+ <RootNamespace>TestProject</RootNamespace>
620
+ <AssemblyName>TestProject</AssemblyName>
621
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
622
+ </PropertyGroup>
623
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
624
+ <DebugSymbols>true</DebugSymbols>
625
+ <DebugType>full</DebugType>
626
+ <Optimize>false</Optimize>
627
+ <OutputPath>bin\</OutputPath>
628
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
629
+ <ErrorReport>prompt</ErrorReport>
630
+ <WarningLevel>4</WarningLevel>
631
+ </PropertyGroup>
632
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
633
+ <DebugType>pdbonly</DebugType>
634
+ <Optimize>true</Optimize>
635
+ <OutputPath>bin\</OutputPath>
636
+ <DefineConstants>TRACE</DefineConstants>
637
+ <ErrorReport>prompt</ErrorReport>
638
+ <WarningLevel>4</WarningLevel>
639
+ </PropertyGroup>
640
+ <ItemGroup>
641
+ <Reference Include="Microsoft.CSharp" />
642
+ <Reference Include="Some.Package, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null">
643
+ <HintPath>packages\Some.Package.7.0.1\lib\net45\Some.Package.dll</HintPath>
644
+ <Private>True</Private>
645
+ </Reference>
646
+ <Reference Include="System.Web.DynamicData" />
647
+ <Reference Include="System.Web.Entity" />
648
+ <Reference Include="System.Web.ApplicationServices" />
649
+ <Reference Include="System" />
650
+ <Reference Include="System.Data" />
651
+ <Reference Include="System.Core" />
652
+ <Reference Include="System.Data.DataSetExtensions" />
653
+ <Reference Include="System.Web.Extensions" />
654
+ <Reference Include="System.Xml.Linq" />
655
+ <Reference Include="System.Drawing" />
656
+ <Reference Include="System.Web" />
657
+ <Reference Include="System.Xml" />
658
+ <Reference Include="System.Configuration" />
659
+ <Reference Include="System.Web.Services" />
660
+ <Reference Include="System.EnterpriseServices" />
661
+ </ItemGroup>
662
+ <ItemGroup>
663
+ <None Include="packages.config" />
664
+ <Content Include="web.config" />
665
+ <Content Include="web.Debug.config">
666
+ <DependentUpon>web.config</DependentUpon>
667
+ </Content>
668
+ <Content Include="web.Release.config">
669
+ <DependentUpon>web.config</DependentUpon>
670
+ </Content>
671
+ </ItemGroup>
672
+ <ItemGroup>
673
+ <Compile Include="Properties\AssemblyInfo.cs" />
674
+ </ItemGroup>
675
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
676
+ <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
677
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
678
+ Other similar extension points exist, see Microsoft.Common.targets.
679
+ <Target Name="BeforeBuild">
680
+ </Target>
681
+ <Target Name="AfterBuild">
682
+ </Target>
683
+ -->
684
+ </Project>
685
+ """,
574
686
  packagesConfigContents: """
575
- <packages>
576
- <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
577
- </packages>
578
- """,
687
+ <packages>
688
+ <package id="Some.Package" version="7.0.1" targetFramework="net45" />
689
+ </packages>
690
+ """,
579
691
  additionalFiles:
580
692
  [
581
693
  ("web.config", """
@@ -583,7 +695,7 @@ public partial class UpdateWorkerTests
583
695
  <runtime>
584
696
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
585
697
  <dependentAssembly>
586
- <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
698
+ <assemblyIdentity name="Some.Package" publicKeyToken="null" culture="neutral" />
587
699
  <bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
588
700
  </dependentAssembly>
589
701
  </assemblyBinding>
@@ -592,90 +704,90 @@ public partial class UpdateWorkerTests
592
704
  """)
593
705
  ],
594
706
  expectedProjectContents: """
595
- <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
596
- <PropertyGroup>
597
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
598
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
599
- <ProductVersion>
600
- </ProductVersion>
601
- <SchemaVersion>2.0</SchemaVersion>
602
- <ProjectGuid>ac83fc79-b637-445b-acb0-9be238ad077f</ProjectGuid>
603
- <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
604
- <OutputType>Library</OutputType>
605
- <AppDesignerFolder>Properties</AppDesignerFolder>
606
- <RootNamespace>TestProject</RootNamespace>
607
- <AssemblyName>TestProject</AssemblyName>
608
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
609
- </PropertyGroup>
610
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
611
- <DebugSymbols>true</DebugSymbols>
612
- <DebugType>full</DebugType>
613
- <Optimize>false</Optimize>
614
- <OutputPath>bin\</OutputPath>
615
- <DefineConstants>DEBUG;TRACE</DefineConstants>
616
- <ErrorReport>prompt</ErrorReport>
617
- <WarningLevel>4</WarningLevel>
618
- </PropertyGroup>
619
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
620
- <DebugType>pdbonly</DebugType>
621
- <Optimize>true</Optimize>
622
- <OutputPath>bin\</OutputPath>
623
- <DefineConstants>TRACE</DefineConstants>
624
- <ErrorReport>prompt</ErrorReport>
625
- <WarningLevel>4</WarningLevel>
626
- </PropertyGroup>
627
- <ItemGroup>
628
- <Reference Include="Microsoft.CSharp" />
629
- <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
630
- <HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
631
- <Private>True</Private>
632
- </Reference>
633
- <Reference Include="System.Web.DynamicData" />
634
- <Reference Include="System.Web.Entity" />
635
- <Reference Include="System.Web.ApplicationServices" />
636
- <Reference Include="System" />
637
- <Reference Include="System.Data" />
638
- <Reference Include="System.Core" />
639
- <Reference Include="System.Data.DataSetExtensions" />
640
- <Reference Include="System.Web.Extensions" />
641
- <Reference Include="System.Xml.Linq" />
642
- <Reference Include="System.Drawing" />
643
- <Reference Include="System.Web" />
644
- <Reference Include="System.Xml" />
645
- <Reference Include="System.Configuration" />
646
- <Reference Include="System.Web.Services" />
647
- <Reference Include="System.EnterpriseServices" />
648
- </ItemGroup>
649
- <ItemGroup>
650
- <None Include="packages.config" />
651
- <Content Include="web.config" />
652
- <Content Include="web.Debug.config">
653
- <DependentUpon>web.config</DependentUpon>
654
- </Content>
655
- <Content Include="web.Release.config">
656
- <DependentUpon>web.config</DependentUpon>
657
- </Content>
658
- </ItemGroup>
659
- <ItemGroup>
660
- <Compile Include="Properties\AssemblyInfo.cs" />
661
- </ItemGroup>
662
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
663
- <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
664
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
665
- Other similar extension points exist, see Microsoft.Common.targets.
666
- <Target Name="BeforeBuild">
667
- </Target>
668
- <Target Name="AfterBuild">
669
- </Target>
670
- -->
671
- </Project>
672
- """,
707
+ <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
708
+ <PropertyGroup>
709
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
710
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
711
+ <ProductVersion>
712
+ </ProductVersion>
713
+ <SchemaVersion>2.0</SchemaVersion>
714
+ <ProjectGuid>ac83fc79-b637-445b-acb0-9be238ad077f</ProjectGuid>
715
+ <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
716
+ <OutputType>Library</OutputType>
717
+ <AppDesignerFolder>Properties</AppDesignerFolder>
718
+ <RootNamespace>TestProject</RootNamespace>
719
+ <AssemblyName>TestProject</AssemblyName>
720
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
721
+ </PropertyGroup>
722
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
723
+ <DebugSymbols>true</DebugSymbols>
724
+ <DebugType>full</DebugType>
725
+ <Optimize>false</Optimize>
726
+ <OutputPath>bin\</OutputPath>
727
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
728
+ <ErrorReport>prompt</ErrorReport>
729
+ <WarningLevel>4</WarningLevel>
730
+ </PropertyGroup>
731
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
732
+ <DebugType>pdbonly</DebugType>
733
+ <Optimize>true</Optimize>
734
+ <OutputPath>bin\</OutputPath>
735
+ <DefineConstants>TRACE</DefineConstants>
736
+ <ErrorReport>prompt</ErrorReport>
737
+ <WarningLevel>4</WarningLevel>
738
+ </PropertyGroup>
739
+ <ItemGroup>
740
+ <Reference Include="Microsoft.CSharp" />
741
+ <Reference Include="Some.Package, Version=13.0.0.0, Culture=neutral, PublicKeyToken=null">
742
+ <HintPath>packages\Some.Package.13.0.1\lib\net45\Some.Package.dll</HintPath>
743
+ <Private>True</Private>
744
+ </Reference>
745
+ <Reference Include="System.Web.DynamicData" />
746
+ <Reference Include="System.Web.Entity" />
747
+ <Reference Include="System.Web.ApplicationServices" />
748
+ <Reference Include="System" />
749
+ <Reference Include="System.Data" />
750
+ <Reference Include="System.Core" />
751
+ <Reference Include="System.Data.DataSetExtensions" />
752
+ <Reference Include="System.Web.Extensions" />
753
+ <Reference Include="System.Xml.Linq" />
754
+ <Reference Include="System.Drawing" />
755
+ <Reference Include="System.Web" />
756
+ <Reference Include="System.Xml" />
757
+ <Reference Include="System.Configuration" />
758
+ <Reference Include="System.Web.Services" />
759
+ <Reference Include="System.EnterpriseServices" />
760
+ </ItemGroup>
761
+ <ItemGroup>
762
+ <None Include="packages.config" />
763
+ <Content Include="web.config" />
764
+ <Content Include="web.Debug.config">
765
+ <DependentUpon>web.config</DependentUpon>
766
+ </Content>
767
+ <Content Include="web.Release.config">
768
+ <DependentUpon>web.config</DependentUpon>
769
+ </Content>
770
+ </ItemGroup>
771
+ <ItemGroup>
772
+ <Compile Include="Properties\AssemblyInfo.cs" />
773
+ </ItemGroup>
774
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
775
+ <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
776
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
777
+ Other similar extension points exist, see Microsoft.Common.targets.
778
+ <Target Name="BeforeBuild">
779
+ </Target>
780
+ <Target Name="AfterBuild">
781
+ </Target>
782
+ -->
783
+ </Project>
784
+ """,
673
785
  expectedPackagesConfigContents: """
674
- <?xml version="1.0" encoding="utf-8"?>
675
- <packages>
676
- <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
677
- </packages>
678
- """,
786
+ <?xml version="1.0" encoding="utf-8"?>
787
+ <packages>
788
+ <package id="Some.Package" version="13.0.1" targetFramework="net45" />
789
+ </packages>
790
+ """,
679
791
  additionalFilesExpected:
680
792
  [
681
793
  ("web.config", """
@@ -683,104 +795,110 @@ public partial class UpdateWorkerTests
683
795
  <runtime>
684
796
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
685
797
  <dependentAssembly>
686
- <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
798
+ <assemblyIdentity name="Some.Package" publicKeyToken="null" culture="neutral" />
687
799
  <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
688
800
  </dependentAssembly>
689
801
  </assemblyBinding>
690
802
  </runtime>
691
803
  </configuration>
692
804
  """)
693
- ]);
805
+ ]
806
+ );
694
807
  }
695
808
 
696
809
  [Fact]
697
810
  public async Task AddsBindingRedirectInWebConfig()
698
811
  {
699
- await TestUpdateForProject("Newtonsoft.Json", "7.0.1", "13.0.1",
812
+ await TestUpdateForProject("Some.Package", "7.0.1", "13.0.1",
813
+ packages:
814
+ [
815
+ MockNuGetPackage.CreatePackageWithAssembly("Some.Package", "7.0.1", "net45", "7.0.0.0"),
816
+ MockNuGetPackage.CreatePackageWithAssembly("Some.Package", "13.0.1", "net45", "13.0.0.0"),
817
+ ],
700
818
  projectContents: """
701
- <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
702
- <PropertyGroup>
703
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
704
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
705
- <ProductVersion>
706
- </ProductVersion>
707
- <SchemaVersion>2.0</SchemaVersion>
708
- <ProjectGuid>ac83fc79-b637-445b-acb0-9be238ad077f</ProjectGuid>
709
- <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
710
- <OutputType>Library</OutputType>
711
- <AppDesignerFolder>Properties</AppDesignerFolder>
712
- <RootNamespace>TestProject</RootNamespace>
713
- <AssemblyName>TestProject</AssemblyName>
714
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
715
- </PropertyGroup>
716
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
717
- <DebugSymbols>true</DebugSymbols>
718
- <DebugType>full</DebugType>
719
- <Optimize>false</Optimize>
720
- <OutputPath>bin\</OutputPath>
721
- <DefineConstants>DEBUG;TRACE</DefineConstants>
722
- <ErrorReport>prompt</ErrorReport>
723
- <WarningLevel>4</WarningLevel>
724
- </PropertyGroup>
725
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
726
- <DebugType>pdbonly</DebugType>
727
- <Optimize>true</Optimize>
728
- <OutputPath>bin\</OutputPath>
729
- <DefineConstants>TRACE</DefineConstants>
730
- <ErrorReport>prompt</ErrorReport>
731
- <WarningLevel>4</WarningLevel>
732
- </PropertyGroup>
733
- <ItemGroup>
734
- <Reference Include="Microsoft.CSharp" />
735
- <Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
736
- <HintPath>packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
737
- <Private>True</Private>
738
- </Reference>
739
- <Reference Include="System.Web.DynamicData" />
740
- <Reference Include="System.Web.Entity" />
741
- <Reference Include="System.Web.ApplicationServices" />
742
- <Reference Include="System" />
743
- <Reference Include="System.Data" />
744
- <Reference Include="System.Core" />
745
- <Reference Include="System.Data.DataSetExtensions" />
746
- <Reference Include="System.Web.Extensions" />
747
- <Reference Include="System.Xml.Linq" />
748
- <Reference Include="System.Drawing" />
749
- <Reference Include="System.Web" />
750
- <Reference Include="System.Xml" />
751
- <Reference Include="System.Configuration" />
752
- <Reference Include="System.Web.Services" />
753
- <Reference Include="System.EnterpriseServices" />
754
- </ItemGroup>
755
- <ItemGroup>
756
- <None Include="packages.config" />
757
- <Content Include="web.config" />
758
- <Content Include="web.Debug.config">
759
- <DependentUpon>web.config</DependentUpon>
760
- </Content>
761
- <Content Include="web.Release.config">
762
- <DependentUpon>web.config</DependentUpon>
763
- </Content>
764
- </ItemGroup>
765
- <ItemGroup>
766
- <Compile Include="Properties\AssemblyInfo.cs" />
767
- </ItemGroup>
768
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
769
- <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
770
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
771
- Other similar extension points exist, see Microsoft.Common.targets.
772
- <Target Name="BeforeBuild">
773
- </Target>
774
- <Target Name="AfterBuild">
775
- </Target>
776
- -->
777
- </Project>
778
- """,
819
+ <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
820
+ <PropertyGroup>
821
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
822
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
823
+ <ProductVersion>
824
+ </ProductVersion>
825
+ <SchemaVersion>2.0</SchemaVersion>
826
+ <ProjectGuid>ac83fc79-b637-445b-acb0-9be238ad077f</ProjectGuid>
827
+ <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
828
+ <OutputType>Library</OutputType>
829
+ <AppDesignerFolder>Properties</AppDesignerFolder>
830
+ <RootNamespace>TestProject</RootNamespace>
831
+ <AssemblyName>TestProject</AssemblyName>
832
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
833
+ </PropertyGroup>
834
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
835
+ <DebugSymbols>true</DebugSymbols>
836
+ <DebugType>full</DebugType>
837
+ <Optimize>false</Optimize>
838
+ <OutputPath>bin\</OutputPath>
839
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
840
+ <ErrorReport>prompt</ErrorReport>
841
+ <WarningLevel>4</WarningLevel>
842
+ </PropertyGroup>
843
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
844
+ <DebugType>pdbonly</DebugType>
845
+ <Optimize>true</Optimize>
846
+ <OutputPath>bin\</OutputPath>
847
+ <DefineConstants>TRACE</DefineConstants>
848
+ <ErrorReport>prompt</ErrorReport>
849
+ <WarningLevel>4</WarningLevel>
850
+ </PropertyGroup>
851
+ <ItemGroup>
852
+ <Reference Include="Microsoft.CSharp" />
853
+ <Reference Include="Some.Package, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null">
854
+ <HintPath>packages\Some.Package.7.0.1\lib\net45\Some.Package.dll</HintPath>
855
+ <Private>True</Private>
856
+ </Reference>
857
+ <Reference Include="System.Web.DynamicData" />
858
+ <Reference Include="System.Web.Entity" />
859
+ <Reference Include="System.Web.ApplicationServices" />
860
+ <Reference Include="System" />
861
+ <Reference Include="System.Data" />
862
+ <Reference Include="System.Core" />
863
+ <Reference Include="System.Data.DataSetExtensions" />
864
+ <Reference Include="System.Web.Extensions" />
865
+ <Reference Include="System.Xml.Linq" />
866
+ <Reference Include="System.Drawing" />
867
+ <Reference Include="System.Web" />
868
+ <Reference Include="System.Xml" />
869
+ <Reference Include="System.Configuration" />
870
+ <Reference Include="System.Web.Services" />
871
+ <Reference Include="System.EnterpriseServices" />
872
+ </ItemGroup>
873
+ <ItemGroup>
874
+ <None Include="packages.config" />
875
+ <Content Include="web.config" />
876
+ <Content Include="web.Debug.config">
877
+ <DependentUpon>web.config</DependentUpon>
878
+ </Content>
879
+ <Content Include="web.Release.config">
880
+ <DependentUpon>web.config</DependentUpon>
881
+ </Content>
882
+ </ItemGroup>
883
+ <ItemGroup>
884
+ <Compile Include="Properties\AssemblyInfo.cs" />
885
+ </ItemGroup>
886
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
887
+ <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
888
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
889
+ Other similar extension points exist, see Microsoft.Common.targets.
890
+ <Target Name="BeforeBuild">
891
+ </Target>
892
+ <Target Name="AfterBuild">
893
+ </Target>
894
+ -->
895
+ </Project>
896
+ """,
779
897
  packagesConfigContents: """
780
- <packages>
781
- <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
782
- </packages>
783
- """,
898
+ <packages>
899
+ <package id="Some.Package" version="7.0.1" targetFramework="net45" />
900
+ </packages>
901
+ """,
784
902
  additionalFiles:
785
903
  [
786
904
  ("web.config", """
@@ -791,90 +909,90 @@ public partial class UpdateWorkerTests
791
909
  """)
792
910
  ],
793
911
  expectedProjectContents: """
794
- <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
795
- <PropertyGroup>
796
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
797
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
798
- <ProductVersion>
799
- </ProductVersion>
800
- <SchemaVersion>2.0</SchemaVersion>
801
- <ProjectGuid>ac83fc79-b637-445b-acb0-9be238ad077f</ProjectGuid>
802
- <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
803
- <OutputType>Library</OutputType>
804
- <AppDesignerFolder>Properties</AppDesignerFolder>
805
- <RootNamespace>TestProject</RootNamespace>
806
- <AssemblyName>TestProject</AssemblyName>
807
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
808
- </PropertyGroup>
809
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
810
- <DebugSymbols>true</DebugSymbols>
811
- <DebugType>full</DebugType>
812
- <Optimize>false</Optimize>
813
- <OutputPath>bin\</OutputPath>
814
- <DefineConstants>DEBUG;TRACE</DefineConstants>
815
- <ErrorReport>prompt</ErrorReport>
816
- <WarningLevel>4</WarningLevel>
817
- </PropertyGroup>
818
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
819
- <DebugType>pdbonly</DebugType>
820
- <Optimize>true</Optimize>
821
- <OutputPath>bin\</OutputPath>
822
- <DefineConstants>TRACE</DefineConstants>
823
- <ErrorReport>prompt</ErrorReport>
824
- <WarningLevel>4</WarningLevel>
825
- </PropertyGroup>
826
- <ItemGroup>
827
- <Reference Include="Microsoft.CSharp" />
828
- <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
829
- <HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
830
- <Private>True</Private>
831
- </Reference>
832
- <Reference Include="System.Web.DynamicData" />
833
- <Reference Include="System.Web.Entity" />
834
- <Reference Include="System.Web.ApplicationServices" />
835
- <Reference Include="System" />
836
- <Reference Include="System.Data" />
837
- <Reference Include="System.Core" />
838
- <Reference Include="System.Data.DataSetExtensions" />
839
- <Reference Include="System.Web.Extensions" />
840
- <Reference Include="System.Xml.Linq" />
841
- <Reference Include="System.Drawing" />
842
- <Reference Include="System.Web" />
843
- <Reference Include="System.Xml" />
844
- <Reference Include="System.Configuration" />
845
- <Reference Include="System.Web.Services" />
846
- <Reference Include="System.EnterpriseServices" />
847
- </ItemGroup>
848
- <ItemGroup>
849
- <None Include="packages.config" />
850
- <Content Include="web.config" />
851
- <Content Include="web.Debug.config">
852
- <DependentUpon>web.config</DependentUpon>
853
- </Content>
854
- <Content Include="web.Release.config">
855
- <DependentUpon>web.config</DependentUpon>
856
- </Content>
857
- </ItemGroup>
858
- <ItemGroup>
859
- <Compile Include="Properties\AssemblyInfo.cs" />
860
- </ItemGroup>
861
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
862
- <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
863
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
864
- Other similar extension points exist, see Microsoft.Common.targets.
865
- <Target Name="BeforeBuild">
866
- </Target>
867
- <Target Name="AfterBuild">
868
- </Target>
869
- -->
870
- </Project>
871
- """,
912
+ <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
913
+ <PropertyGroup>
914
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
915
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
916
+ <ProductVersion>
917
+ </ProductVersion>
918
+ <SchemaVersion>2.0</SchemaVersion>
919
+ <ProjectGuid>ac83fc79-b637-445b-acb0-9be238ad077f</ProjectGuid>
920
+ <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
921
+ <OutputType>Library</OutputType>
922
+ <AppDesignerFolder>Properties</AppDesignerFolder>
923
+ <RootNamespace>TestProject</RootNamespace>
924
+ <AssemblyName>TestProject</AssemblyName>
925
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
926
+ </PropertyGroup>
927
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
928
+ <DebugSymbols>true</DebugSymbols>
929
+ <DebugType>full</DebugType>
930
+ <Optimize>false</Optimize>
931
+ <OutputPath>bin\</OutputPath>
932
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
933
+ <ErrorReport>prompt</ErrorReport>
934
+ <WarningLevel>4</WarningLevel>
935
+ </PropertyGroup>
936
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
937
+ <DebugType>pdbonly</DebugType>
938
+ <Optimize>true</Optimize>
939
+ <OutputPath>bin\</OutputPath>
940
+ <DefineConstants>TRACE</DefineConstants>
941
+ <ErrorReport>prompt</ErrorReport>
942
+ <WarningLevel>4</WarningLevel>
943
+ </PropertyGroup>
944
+ <ItemGroup>
945
+ <Reference Include="Microsoft.CSharp" />
946
+ <Reference Include="Some.Package, Version=13.0.0.0, Culture=neutral, PublicKeyToken=null">
947
+ <HintPath>packages\Some.Package.13.0.1\lib\net45\Some.Package.dll</HintPath>
948
+ <Private>True</Private>
949
+ </Reference>
950
+ <Reference Include="System.Web.DynamicData" />
951
+ <Reference Include="System.Web.Entity" />
952
+ <Reference Include="System.Web.ApplicationServices" />
953
+ <Reference Include="System" />
954
+ <Reference Include="System.Data" />
955
+ <Reference Include="System.Core" />
956
+ <Reference Include="System.Data.DataSetExtensions" />
957
+ <Reference Include="System.Web.Extensions" />
958
+ <Reference Include="System.Xml.Linq" />
959
+ <Reference Include="System.Drawing" />
960
+ <Reference Include="System.Web" />
961
+ <Reference Include="System.Xml" />
962
+ <Reference Include="System.Configuration" />
963
+ <Reference Include="System.Web.Services" />
964
+ <Reference Include="System.EnterpriseServices" />
965
+ </ItemGroup>
966
+ <ItemGroup>
967
+ <None Include="packages.config" />
968
+ <Content Include="web.config" />
969
+ <Content Include="web.Debug.config">
970
+ <DependentUpon>web.config</DependentUpon>
971
+ </Content>
972
+ <Content Include="web.Release.config">
973
+ <DependentUpon>web.config</DependentUpon>
974
+ </Content>
975
+ </ItemGroup>
976
+ <ItemGroup>
977
+ <Compile Include="Properties\AssemblyInfo.cs" />
978
+ </ItemGroup>
979
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
980
+ <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
981
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
982
+ Other similar extension points exist, see Microsoft.Common.targets.
983
+ <Target Name="BeforeBuild">
984
+ </Target>
985
+ <Target Name="AfterBuild">
986
+ </Target>
987
+ -->
988
+ </Project>
989
+ """,
872
990
  expectedPackagesConfigContents: """
873
- <?xml version="1.0" encoding="utf-8"?>
874
- <packages>
875
- <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
876
- </packages>
877
- """,
991
+ <?xml version="1.0" encoding="utf-8"?>
992
+ <packages>
993
+ <package id="Some.Package" version="13.0.1" targetFramework="net45" />
994
+ </packages>
995
+ """,
878
996
  additionalFilesExpected:
879
997
  [
880
998
  ("web.config", """
@@ -882,345 +1000,358 @@ public partial class UpdateWorkerTests
882
1000
  <runtime>
883
1001
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
884
1002
  <dependentAssembly>
885
- <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
1003
+ <assemblyIdentity name="Some.Package" publicKeyToken="null" culture="neutral" />
886
1004
  <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
887
1005
  </dependentAssembly>
888
1006
  </assemblyBinding>
889
1007
  </runtime>
890
1008
  </configuration>
891
1009
  """)
892
- ]);
1010
+ ]
1011
+ );
893
1012
  }
894
1013
 
895
1014
  [Fact]
896
1015
  public async Task PackagesConfigUpdateCanHappenEvenWithMismatchedVersionNumbers()
897
1016
  {
898
1017
  // `packages.config` reports `7.0.1` and that's what we want to update, but the project file has a mismatch that's corrected
899
- await TestUpdateForProject("Newtonsoft.Json", "7.0.1", "13.0.1",
1018
+ await TestUpdateForProject("Some.Package", "7.0.1", "13.0.1",
1019
+ packages:
1020
+ [
1021
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "7.0.1", "net45"),
1022
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net45"),
1023
+ ],
900
1024
  projectContents: """
901
- <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
902
- <PropertyGroup>
903
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
904
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
905
- <ProductVersion>
906
- </ProductVersion>
907
- <SchemaVersion>2.0</SchemaVersion>
908
- <ProjectGuid>ac83fc79-b637-445b-acb0-9be238ad077f</ProjectGuid>
909
- <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
910
- <OutputType>Library</OutputType>
911
- <AppDesignerFolder>Properties</AppDesignerFolder>
912
- <RootNamespace>TestProject</RootNamespace>
913
- <AssemblyName>TestProject</AssemblyName>
914
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
915
- </PropertyGroup>
916
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
917
- <DebugSymbols>true</DebugSymbols>
918
- <DebugType>full</DebugType>
919
- <Optimize>false</Optimize>
920
- <OutputPath>bin\</OutputPath>
921
- <DefineConstants>DEBUG;TRACE</DefineConstants>
922
- <ErrorReport>prompt</ErrorReport>
923
- <WarningLevel>4</WarningLevel>
924
- </PropertyGroup>
925
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
926
- <DebugType>pdbonly</DebugType>
927
- <Optimize>true</Optimize>
928
- <OutputPath>bin\</OutputPath>
929
- <DefineConstants>TRACE</DefineConstants>
930
- <ErrorReport>prompt</ErrorReport>
931
- <WarningLevel>4</WarningLevel>
932
- </PropertyGroup>
933
- <ItemGroup>
934
- <Reference Include="Microsoft.CSharp" />
935
- <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
936
- <HintPath>packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
937
- <Private>True</Private>
938
- </Reference>
939
- <Reference Include="System.Web.DynamicData" />
940
- <Reference Include="System.Web.Entity" />
941
- <Reference Include="System.Web.ApplicationServices" />
942
- <Reference Include="System" />
943
- <Reference Include="System.Data" />
944
- <Reference Include="System.Core" />
945
- <Reference Include="System.Data.DataSetExtensions" />
946
- <Reference Include="System.Web.Extensions" />
947
- <Reference Include="System.Xml.Linq" />
948
- <Reference Include="System.Drawing" />
949
- <Reference Include="System.Web" />
950
- <Reference Include="System.Xml" />
951
- <Reference Include="System.Configuration" />
952
- <Reference Include="System.Web.Services" />
953
- <Reference Include="System.EnterpriseServices" />
954
- </ItemGroup>
955
- <ItemGroup>
956
- <None Include="packages.config" />
957
- </ItemGroup>
958
- <ItemGroup>
959
- <Compile Include="Properties\AssemblyInfo.cs" />
960
- </ItemGroup>
961
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
962
- <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
963
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
964
- Other similar extension points exist, see Microsoft.Common.targets.
965
- <Target Name="BeforeBuild">
966
- </Target>
967
- <Target Name="AfterBuild">
968
- </Target>
969
- -->
970
- </Project>
971
- """,
1025
+ <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
1026
+ <PropertyGroup>
1027
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
1028
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
1029
+ <ProductVersion>
1030
+ </ProductVersion>
1031
+ <SchemaVersion>2.0</SchemaVersion>
1032
+ <ProjectGuid>ac83fc79-b637-445b-acb0-9be238ad077f</ProjectGuid>
1033
+ <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
1034
+ <OutputType>Library</OutputType>
1035
+ <AppDesignerFolder>Properties</AppDesignerFolder>
1036
+ <RootNamespace>TestProject</RootNamespace>
1037
+ <AssemblyName>TestProject</AssemblyName>
1038
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1039
+ </PropertyGroup>
1040
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1041
+ <DebugSymbols>true</DebugSymbols>
1042
+ <DebugType>full</DebugType>
1043
+ <Optimize>false</Optimize>
1044
+ <OutputPath>bin\</OutputPath>
1045
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
1046
+ <ErrorReport>prompt</ErrorReport>
1047
+ <WarningLevel>4</WarningLevel>
1048
+ </PropertyGroup>
1049
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
1050
+ <DebugType>pdbonly</DebugType>
1051
+ <Optimize>true</Optimize>
1052
+ <OutputPath>bin\</OutputPath>
1053
+ <DefineConstants>TRACE</DefineConstants>
1054
+ <ErrorReport>prompt</ErrorReport>
1055
+ <WarningLevel>4</WarningLevel>
1056
+ </PropertyGroup>
1057
+ <ItemGroup>
1058
+ <Reference Include="Microsoft.CSharp" />
1059
+ <Reference Include="Some.Package, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
1060
+ <HintPath>packages\Some.Package.6.0.8\lib\net45\Some.Package.dll</HintPath>
1061
+ <Private>True</Private>
1062
+ </Reference>
1063
+ <Reference Include="System.Web.DynamicData" />
1064
+ <Reference Include="System.Web.Entity" />
1065
+ <Reference Include="System.Web.ApplicationServices" />
1066
+ <Reference Include="System" />
1067
+ <Reference Include="System.Data" />
1068
+ <Reference Include="System.Core" />
1069
+ <Reference Include="System.Data.DataSetExtensions" />
1070
+ <Reference Include="System.Web.Extensions" />
1071
+ <Reference Include="System.Xml.Linq" />
1072
+ <Reference Include="System.Drawing" />
1073
+ <Reference Include="System.Web" />
1074
+ <Reference Include="System.Xml" />
1075
+ <Reference Include="System.Configuration" />
1076
+ <Reference Include="System.Web.Services" />
1077
+ <Reference Include="System.EnterpriseServices" />
1078
+ </ItemGroup>
1079
+ <ItemGroup>
1080
+ <None Include="packages.config" />
1081
+ </ItemGroup>
1082
+ <ItemGroup>
1083
+ <Compile Include="Properties\AssemblyInfo.cs" />
1084
+ </ItemGroup>
1085
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
1086
+ <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
1087
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
1088
+ Other similar extension points exist, see Microsoft.Common.targets.
1089
+ <Target Name="BeforeBuild">
1090
+ </Target>
1091
+ <Target Name="AfterBuild">
1092
+ </Target>
1093
+ -->
1094
+ </Project>
1095
+ """,
972
1096
  packagesConfigContents: """
973
- <packages>
974
- <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
975
- </packages>
976
- """,
1097
+ <packages>
1098
+ <package id="Some.Package" version="7.0.1" targetFramework="net45" />
1099
+ </packages>
1100
+ """,
977
1101
  expectedProjectContents: """
978
- <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
979
- <PropertyGroup>
980
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
981
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
982
- <ProductVersion>
983
- </ProductVersion>
984
- <SchemaVersion>2.0</SchemaVersion>
985
- <ProjectGuid>ac83fc79-b637-445b-acb0-9be238ad077f</ProjectGuid>
986
- <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
987
- <OutputType>Library</OutputType>
988
- <AppDesignerFolder>Properties</AppDesignerFolder>
989
- <RootNamespace>TestProject</RootNamespace>
990
- <AssemblyName>TestProject</AssemblyName>
991
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
992
- </PropertyGroup>
993
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
994
- <DebugSymbols>true</DebugSymbols>
995
- <DebugType>full</DebugType>
996
- <Optimize>false</Optimize>
997
- <OutputPath>bin\</OutputPath>
998
- <DefineConstants>DEBUG;TRACE</DefineConstants>
999
- <ErrorReport>prompt</ErrorReport>
1000
- <WarningLevel>4</WarningLevel>
1001
- </PropertyGroup>
1002
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
1003
- <DebugType>pdbonly</DebugType>
1004
- <Optimize>true</Optimize>
1005
- <OutputPath>bin\</OutputPath>
1006
- <DefineConstants>TRACE</DefineConstants>
1007
- <ErrorReport>prompt</ErrorReport>
1008
- <WarningLevel>4</WarningLevel>
1009
- </PropertyGroup>
1010
- <ItemGroup>
1011
- <Reference Include="Microsoft.CSharp" />
1012
- <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
1013
- <HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
1014
- <Private>True</Private>
1015
- </Reference>
1016
- <Reference Include="System.Web.DynamicData" />
1017
- <Reference Include="System.Web.Entity" />
1018
- <Reference Include="System.Web.ApplicationServices" />
1019
- <Reference Include="System" />
1020
- <Reference Include="System.Data" />
1021
- <Reference Include="System.Core" />
1022
- <Reference Include="System.Data.DataSetExtensions" />
1023
- <Reference Include="System.Web.Extensions" />
1024
- <Reference Include="System.Xml.Linq" />
1025
- <Reference Include="System.Drawing" />
1026
- <Reference Include="System.Web" />
1027
- <Reference Include="System.Xml" />
1028
- <Reference Include="System.Configuration" />
1029
- <Reference Include="System.Web.Services" />
1030
- <Reference Include="System.EnterpriseServices" />
1031
- </ItemGroup>
1032
- <ItemGroup>
1033
- <None Include="packages.config" />
1034
- </ItemGroup>
1035
- <ItemGroup>
1036
- <Compile Include="Properties\AssemblyInfo.cs" />
1037
- </ItemGroup>
1038
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
1039
- <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
1040
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
1041
- Other similar extension points exist, see Microsoft.Common.targets.
1042
- <Target Name="BeforeBuild">
1043
- </Target>
1044
- <Target Name="AfterBuild">
1045
- </Target>
1046
- -->
1047
- </Project>
1048
- """,
1102
+ <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
1103
+ <PropertyGroup>
1104
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
1105
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
1106
+ <ProductVersion>
1107
+ </ProductVersion>
1108
+ <SchemaVersion>2.0</SchemaVersion>
1109
+ <ProjectGuid>ac83fc79-b637-445b-acb0-9be238ad077f</ProjectGuid>
1110
+ <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
1111
+ <OutputType>Library</OutputType>
1112
+ <AppDesignerFolder>Properties</AppDesignerFolder>
1113
+ <RootNamespace>TestProject</RootNamespace>
1114
+ <AssemblyName>TestProject</AssemblyName>
1115
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1116
+ </PropertyGroup>
1117
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1118
+ <DebugSymbols>true</DebugSymbols>
1119
+ <DebugType>full</DebugType>
1120
+ <Optimize>false</Optimize>
1121
+ <OutputPath>bin\</OutputPath>
1122
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
1123
+ <ErrorReport>prompt</ErrorReport>
1124
+ <WarningLevel>4</WarningLevel>
1125
+ </PropertyGroup>
1126
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
1127
+ <DebugType>pdbonly</DebugType>
1128
+ <Optimize>true</Optimize>
1129
+ <OutputPath>bin\</OutputPath>
1130
+ <DefineConstants>TRACE</DefineConstants>
1131
+ <ErrorReport>prompt</ErrorReport>
1132
+ <WarningLevel>4</WarningLevel>
1133
+ </PropertyGroup>
1134
+ <ItemGroup>
1135
+ <Reference Include="Microsoft.CSharp" />
1136
+ <Reference Include="Some.Package">
1137
+ <HintPath>packages\Some.Package.13.0.1\lib\net45\Some.Package.dll</HintPath>
1138
+ <Private>True</Private>
1139
+ </Reference>
1140
+ <Reference Include="System.Web.DynamicData" />
1141
+ <Reference Include="System.Web.Entity" />
1142
+ <Reference Include="System.Web.ApplicationServices" />
1143
+ <Reference Include="System" />
1144
+ <Reference Include="System.Data" />
1145
+ <Reference Include="System.Core" />
1146
+ <Reference Include="System.Data.DataSetExtensions" />
1147
+ <Reference Include="System.Web.Extensions" />
1148
+ <Reference Include="System.Xml.Linq" />
1149
+ <Reference Include="System.Drawing" />
1150
+ <Reference Include="System.Web" />
1151
+ <Reference Include="System.Xml" />
1152
+ <Reference Include="System.Configuration" />
1153
+ <Reference Include="System.Web.Services" />
1154
+ <Reference Include="System.EnterpriseServices" />
1155
+ </ItemGroup>
1156
+ <ItemGroup>
1157
+ <None Include="packages.config" />
1158
+ </ItemGroup>
1159
+ <ItemGroup>
1160
+ <Compile Include="Properties\AssemblyInfo.cs" />
1161
+ </ItemGroup>
1162
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
1163
+ <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
1164
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
1165
+ Other similar extension points exist, see Microsoft.Common.targets.
1166
+ <Target Name="BeforeBuild">
1167
+ </Target>
1168
+ <Target Name="AfterBuild">
1169
+ </Target>
1170
+ -->
1171
+ </Project>
1172
+ """,
1049
1173
  expectedPackagesConfigContents: """
1050
- <?xml version="1.0" encoding="utf-8"?>
1051
- <packages>
1052
- <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
1053
- </packages>
1054
- """);
1174
+ <?xml version="1.0" encoding="utf-8"?>
1175
+ <packages>
1176
+ <package id="Some.Package" version="13.0.1" targetFramework="net45" />
1177
+ </packages>
1178
+ """
1179
+ );
1055
1180
  }
1056
1181
 
1057
1182
  [Fact]
1058
1183
  public async Task PackagesConfigUpdateIsNotThwartedBy_VSToolsPath_PropertyBeingSetInUserCode()
1059
1184
  {
1060
- await TestUpdateForProject("Newtonsoft.Json", "7.0.1", "13.0.1",
1185
+ await TestUpdateForProject("Some.Package", "7.0.1", "13.0.1",
1186
+ packages:
1187
+ [
1188
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "7.0.1", "net45"),
1189
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net45"),
1190
+ ],
1061
1191
  projectContents: """
1062
- <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
1063
- <PropertyGroup>
1064
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
1065
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
1066
- <ProductVersion>
1067
- </ProductVersion>
1068
- <SchemaVersion>2.0</SchemaVersion>
1069
- <ProjectGuid>68ed3303-52a0-47b8-a687-3abbb07530da</ProjectGuid>
1070
- <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
1071
- <OutputType>Library</OutputType>
1072
- <AppDesignerFolder>Properties</AppDesignerFolder>
1073
- <RootNamespace>TestProject</RootNamespace>
1074
- <AssemblyName>TestProject</AssemblyName>
1075
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1076
- </PropertyGroup>
1077
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1078
- <DebugSymbols>true</DebugSymbols>
1079
- <DebugType>full</DebugType>
1080
- <Optimize>false</Optimize>
1081
- <OutputPath>bin\</OutputPath>
1082
- <DefineConstants>DEBUG;TRACE</DefineConstants>
1083
- <ErrorReport>prompt</ErrorReport>
1084
- <WarningLevel>4</WarningLevel>
1085
- </PropertyGroup>
1086
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
1087
- <DebugType>pdbonly</DebugType>
1088
- <Optimize>true</Optimize>
1089
- <OutputPath>bin\</OutputPath>
1090
- <DefineConstants>TRACE</DefineConstants>
1091
- <ErrorReport>prompt</ErrorReport>
1092
- <WarningLevel>4</WarningLevel>
1093
- </PropertyGroup>
1094
- <ItemGroup>
1095
- <Reference Include="Microsoft.CSharp" />
1096
- <Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
1097
- <HintPath>packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
1098
- <Private>True</Private>
1099
- </Reference>
1100
- <Reference Include="System.Web.DynamicData" />
1101
- <Reference Include="System.Web.Entity" />
1102
- <Reference Include="System.Web.ApplicationServices" />
1103
- <Reference Include="System" />
1104
- <Reference Include="System.Data" />
1105
- <Reference Include="System.Core" />
1106
- <Reference Include="System.Data.DataSetExtensions" />
1107
- <Reference Include="System.Web.Extensions" />
1108
- <Reference Include="System.Xml.Linq" />
1109
- <Reference Include="System.Drawing" />
1110
- <Reference Include="System.Web" />
1111
- <Reference Include="System.Xml" />
1112
- <Reference Include="System.Configuration" />
1113
- <Reference Include="System.Web.Services" />
1114
- <Reference Include="System.EnterpriseServices" />
1115
- </ItemGroup>
1116
- <ItemGroup>
1117
- <None Include="packages.config" />
1118
- </ItemGroup>
1119
- <ItemGroup>
1120
- <Compile Include="Properties\AssemblyInfo.cs" />
1121
- </ItemGroup>
1122
- <PropertyGroup>
1123
- <!-- some project files set this property which makes the Microsoft.WebApplication.targets import a few lines down always fail -->
1124
- <VSToolsPath Condition="'$(VSToolsPath)' == ''">C:\some\path\that\does\not\exist</VSToolsPath>
1125
- </PropertyGroup>
1126
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
1127
- <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
1128
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
1129
- Other similar extension points exist, see Microsoft.Common.targets.
1130
- <Target Name="BeforeBuild">
1131
- </Target>
1132
- <Target Name="AfterBuild">
1133
- </Target>
1134
- -->
1135
- </Project>
1136
- """,
1192
+ <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
1193
+ <PropertyGroup>
1194
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
1195
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
1196
+ <ProductVersion>
1197
+ </ProductVersion>
1198
+ <SchemaVersion>2.0</SchemaVersion>
1199
+ <ProjectGuid>68ed3303-52a0-47b8-a687-3abbb07530da</ProjectGuid>
1200
+ <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
1201
+ <OutputType>Library</OutputType>
1202
+ <AppDesignerFolder>Properties</AppDesignerFolder>
1203
+ <RootNamespace>TestProject</RootNamespace>
1204
+ <AssemblyName>TestProject</AssemblyName>
1205
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1206
+ </PropertyGroup>
1207
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1208
+ <DebugSymbols>true</DebugSymbols>
1209
+ <DebugType>full</DebugType>
1210
+ <Optimize>false</Optimize>
1211
+ <OutputPath>bin\</OutputPath>
1212
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
1213
+ <ErrorReport>prompt</ErrorReport>
1214
+ <WarningLevel>4</WarningLevel>
1215
+ </PropertyGroup>
1216
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
1217
+ <DebugType>pdbonly</DebugType>
1218
+ <Optimize>true</Optimize>
1219
+ <OutputPath>bin\</OutputPath>
1220
+ <DefineConstants>TRACE</DefineConstants>
1221
+ <ErrorReport>prompt</ErrorReport>
1222
+ <WarningLevel>4</WarningLevel>
1223
+ </PropertyGroup>
1224
+ <ItemGroup>
1225
+ <Reference Include="Microsoft.CSharp" />
1226
+ <Reference Include="Some.Package">
1227
+ <HintPath>packages\Some.Package.7.0.1\lib\net45\Some.Package.dll</HintPath>
1228
+ <Private>True</Private>
1229
+ </Reference>
1230
+ <Reference Include="System.Web.DynamicData" />
1231
+ <Reference Include="System.Web.Entity" />
1232
+ <Reference Include="System.Web.ApplicationServices" />
1233
+ <Reference Include="System" />
1234
+ <Reference Include="System.Data" />
1235
+ <Reference Include="System.Core" />
1236
+ <Reference Include="System.Data.DataSetExtensions" />
1237
+ <Reference Include="System.Web.Extensions" />
1238
+ <Reference Include="System.Xml.Linq" />
1239
+ <Reference Include="System.Drawing" />
1240
+ <Reference Include="System.Web" />
1241
+ <Reference Include="System.Xml" />
1242
+ <Reference Include="System.Configuration" />
1243
+ <Reference Include="System.Web.Services" />
1244
+ <Reference Include="System.EnterpriseServices" />
1245
+ </ItemGroup>
1246
+ <ItemGroup>
1247
+ <None Include="packages.config" />
1248
+ </ItemGroup>
1249
+ <ItemGroup>
1250
+ <Compile Include="Properties\AssemblyInfo.cs" />
1251
+ </ItemGroup>
1252
+ <PropertyGroup>
1253
+ <!-- some project files set this property which makes the Microsoft.WebApplication.targets import a few lines down always fail -->
1254
+ <VSToolsPath Condition="'$(VSToolsPath)' == ''">C:\some\path\that\does\not\exist</VSToolsPath>
1255
+ </PropertyGroup>
1256
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
1257
+ <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
1258
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
1259
+ Other similar extension points exist, see Microsoft.Common.targets.
1260
+ <Target Name="BeforeBuild">
1261
+ </Target>
1262
+ <Target Name="AfterBuild">
1263
+ </Target>
1264
+ -->
1265
+ </Project>
1266
+ """,
1137
1267
  packagesConfigContents: """
1138
- <packages>
1139
- <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
1140
- </packages>
1141
- """,
1268
+ <packages>
1269
+ <package id="Some.Package" version="7.0.1" targetFramework="net45" />
1270
+ </packages>
1271
+ """,
1142
1272
  expectedProjectContents: """
1143
- <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
1144
- <PropertyGroup>
1145
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
1146
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
1147
- <ProductVersion>
1148
- </ProductVersion>
1149
- <SchemaVersion>2.0</SchemaVersion>
1150
- <ProjectGuid>68ed3303-52a0-47b8-a687-3abbb07530da</ProjectGuid>
1151
- <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
1152
- <OutputType>Library</OutputType>
1153
- <AppDesignerFolder>Properties</AppDesignerFolder>
1154
- <RootNamespace>TestProject</RootNamespace>
1155
- <AssemblyName>TestProject</AssemblyName>
1156
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1157
- </PropertyGroup>
1158
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1159
- <DebugSymbols>true</DebugSymbols>
1160
- <DebugType>full</DebugType>
1161
- <Optimize>false</Optimize>
1162
- <OutputPath>bin\</OutputPath>
1163
- <DefineConstants>DEBUG;TRACE</DefineConstants>
1164
- <ErrorReport>prompt</ErrorReport>
1165
- <WarningLevel>4</WarningLevel>
1166
- </PropertyGroup>
1167
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
1168
- <DebugType>pdbonly</DebugType>
1169
- <Optimize>true</Optimize>
1170
- <OutputPath>bin\</OutputPath>
1171
- <DefineConstants>TRACE</DefineConstants>
1172
- <ErrorReport>prompt</ErrorReport>
1173
- <WarningLevel>4</WarningLevel>
1174
- </PropertyGroup>
1175
- <ItemGroup>
1176
- <Reference Include="Microsoft.CSharp" />
1177
- <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
1178
- <HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
1179
- <Private>True</Private>
1180
- </Reference>
1181
- <Reference Include="System.Web.DynamicData" />
1182
- <Reference Include="System.Web.Entity" />
1183
- <Reference Include="System.Web.ApplicationServices" />
1184
- <Reference Include="System" />
1185
- <Reference Include="System.Data" />
1186
- <Reference Include="System.Core" />
1187
- <Reference Include="System.Data.DataSetExtensions" />
1188
- <Reference Include="System.Web.Extensions" />
1189
- <Reference Include="System.Xml.Linq" />
1190
- <Reference Include="System.Drawing" />
1191
- <Reference Include="System.Web" />
1192
- <Reference Include="System.Xml" />
1193
- <Reference Include="System.Configuration" />
1194
- <Reference Include="System.Web.Services" />
1195
- <Reference Include="System.EnterpriseServices" />
1196
- </ItemGroup>
1197
- <ItemGroup>
1198
- <None Include="packages.config" />
1199
- </ItemGroup>
1200
- <ItemGroup>
1201
- <Compile Include="Properties\AssemblyInfo.cs" />
1202
- </ItemGroup>
1203
- <PropertyGroup>
1204
- <!-- some project files set this property which makes the Microsoft.WebApplication.targets import a few lines down always fail -->
1205
- <VSToolsPath Condition="'$(VSToolsPath)' == ''">C:\some\path\that\does\not\exist</VSToolsPath>
1206
- </PropertyGroup>
1207
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
1208
- <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
1209
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
1210
- Other similar extension points exist, see Microsoft.Common.targets.
1211
- <Target Name="BeforeBuild">
1212
- </Target>
1213
- <Target Name="AfterBuild">
1214
- </Target>
1215
- -->
1216
- </Project>
1217
- """,
1273
+ <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
1274
+ <PropertyGroup>
1275
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
1276
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
1277
+ <ProductVersion>
1278
+ </ProductVersion>
1279
+ <SchemaVersion>2.0</SchemaVersion>
1280
+ <ProjectGuid>68ed3303-52a0-47b8-a687-3abbb07530da</ProjectGuid>
1281
+ <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
1282
+ <OutputType>Library</OutputType>
1283
+ <AppDesignerFolder>Properties</AppDesignerFolder>
1284
+ <RootNamespace>TestProject</RootNamespace>
1285
+ <AssemblyName>TestProject</AssemblyName>
1286
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1287
+ </PropertyGroup>
1288
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1289
+ <DebugSymbols>true</DebugSymbols>
1290
+ <DebugType>full</DebugType>
1291
+ <Optimize>false</Optimize>
1292
+ <OutputPath>bin\</OutputPath>
1293
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
1294
+ <ErrorReport>prompt</ErrorReport>
1295
+ <WarningLevel>4</WarningLevel>
1296
+ </PropertyGroup>
1297
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
1298
+ <DebugType>pdbonly</DebugType>
1299
+ <Optimize>true</Optimize>
1300
+ <OutputPath>bin\</OutputPath>
1301
+ <DefineConstants>TRACE</DefineConstants>
1302
+ <ErrorReport>prompt</ErrorReport>
1303
+ <WarningLevel>4</WarningLevel>
1304
+ </PropertyGroup>
1305
+ <ItemGroup>
1306
+ <Reference Include="Microsoft.CSharp" />
1307
+ <Reference Include="Some.Package">
1308
+ <HintPath>packages\Some.Package.13.0.1\lib\net45\Some.Package.dll</HintPath>
1309
+ <Private>True</Private>
1310
+ </Reference>
1311
+ <Reference Include="System.Web.DynamicData" />
1312
+ <Reference Include="System.Web.Entity" />
1313
+ <Reference Include="System.Web.ApplicationServices" />
1314
+ <Reference Include="System" />
1315
+ <Reference Include="System.Data" />
1316
+ <Reference Include="System.Core" />
1317
+ <Reference Include="System.Data.DataSetExtensions" />
1318
+ <Reference Include="System.Web.Extensions" />
1319
+ <Reference Include="System.Xml.Linq" />
1320
+ <Reference Include="System.Drawing" />
1321
+ <Reference Include="System.Web" />
1322
+ <Reference Include="System.Xml" />
1323
+ <Reference Include="System.Configuration" />
1324
+ <Reference Include="System.Web.Services" />
1325
+ <Reference Include="System.EnterpriseServices" />
1326
+ </ItemGroup>
1327
+ <ItemGroup>
1328
+ <None Include="packages.config" />
1329
+ </ItemGroup>
1330
+ <ItemGroup>
1331
+ <Compile Include="Properties\AssemblyInfo.cs" />
1332
+ </ItemGroup>
1333
+ <PropertyGroup>
1334
+ <!-- some project files set this property which makes the Microsoft.WebApplication.targets import a few lines down always fail -->
1335
+ <VSToolsPath Condition="'$(VSToolsPath)' == ''">C:\some\path\that\does\not\exist</VSToolsPath>
1336
+ </PropertyGroup>
1337
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
1338
+ <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
1339
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
1340
+ Other similar extension points exist, see Microsoft.Common.targets.
1341
+ <Target Name="BeforeBuild">
1342
+ </Target>
1343
+ <Target Name="AfterBuild">
1344
+ </Target>
1345
+ -->
1346
+ </Project>
1347
+ """,
1218
1348
  expectedPackagesConfigContents: """
1219
- <?xml version="1.0" encoding="utf-8"?>
1220
- <packages>
1221
- <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
1222
- </packages>
1223
- """);
1349
+ <?xml version="1.0" encoding="utf-8"?>
1350
+ <packages>
1351
+ <package id="Some.Package" version="13.0.1" targetFramework="net45" />
1352
+ </packages>
1353
+ """
1354
+ );
1224
1355
  }
1225
1356
 
1226
1357
  [Fact]
@@ -1298,7 +1429,8 @@ public partial class UpdateWorkerTests
1298
1429
  string expectedProjectContents,
1299
1430
  string expectedPackagesConfigContents,
1300
1431
  (string Path, string Content)[]? additionalFiles = null,
1301
- (string Path, string Content)[]? additionalFilesExpected = null)
1432
+ (string Path, string Content)[]? additionalFilesExpected = null,
1433
+ MockNuGetPackage[]? packages = null)
1302
1434
  {
1303
1435
  var realizedAdditionalFiles = new List<(string Path, string Content)>
1304
1436
  {
@@ -1325,7 +1457,8 @@ public partial class UpdateWorkerTests
1325
1457
  projectContents,
1326
1458
  expectedProjectContents,
1327
1459
  additionalFiles: realizedAdditionalFiles.ToArray(),
1328
- additionalFilesExpected: realizedAdditionalFilesExpected.ToArray());
1460
+ additionalFilesExpected: realizedAdditionalFilesExpected.ToArray(),
1461
+ packages: packages);
1329
1462
  }
1330
1463
  }
1331
1464
  }