dependabot-nuget 0.240.0 → 0.242.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/helpers/build +45 -0
- data/helpers/lib/NuGetUpdater/.editorconfig +364 -0
- data/helpers/lib/NuGetUpdater/.gitignore +5 -0
- data/helpers/lib/NuGetUpdater/Directory.Build.props +10 -0
- data/helpers/lib/NuGetUpdater/Directory.Common.props +16 -0
- data/helpers/lib/NuGetUpdater/NuGetProjects/Directory.Build.props +14 -0
- data/helpers/lib/NuGetUpdater/NuGetProjects/Directory.Build.targets +7 -0
- data/helpers/lib/NuGetUpdater/NuGetProjects/Directory.Packages.props +29 -0
- data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Build.Tasks/NuGet.Build.Tasks.csproj +27 -0
- data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.CommandLine/AssemblyMetadataExtractor.cs +203 -0
- data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.CommandLine/NuGet.CommandLine.csproj +33 -0
- data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Commands/NuGet.Commands.csproj +26 -0
- data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Common/NuGet.Common.csproj +21 -0
- data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Config +6 -0
- data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Configuration/NuGet.Configuration.csproj +24 -0
- data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Credentials/NuGet.Credentials.csproj +20 -0
- data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.DependencyResolver.Core/NuGet.DependencyResolver.Core.csproj +22 -0
- data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Frameworks/NuGet.Frameworks.csproj +17 -0
- data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.LibraryModel/NuGet.LibraryModel.csproj +17 -0
- data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.PackageManagement/NuGet.PackageManagement.csproj +27 -0
- data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Packaging/NuGet.Packaging.csproj +28 -0
- data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.ProjectModel/NuGet.ProjectModel.csproj +20 -0
- data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Protocol/NuGet.Protocol.csproj +21 -0
- data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Resolver/NuGet.Resolver.csproj +20 -0
- data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Versioning/NuGet.Versioning.csproj +17 -0
- data/helpers/lib/NuGetUpdater/NuGetProjects/README.md +1 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/FrameworkCheckCommand.cs +35 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/UpdateCommand.cs +43 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/NuGetUpdater.Cli.csproj +20 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Program.cs +31 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.FrameworkCheck.cs +42 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs +323 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/NuGetUpdater.Cli.Test.csproj +24 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Dependency.cs +3 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/DependencyType.cs +12 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/BuildFile.cs +97 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/DotNetToolsJsonBuildFile.cs +23 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/GlobalJsonBuildFile.cs +36 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/JsonBuildFile.cs +47 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/PackagesConfigBuildFile.cs +31 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/ProjectBuildFile.cs +94 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/XmlBuildFile.cs +14 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/CompatabilityChecker.cs +39 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/FrameworkCompatibilityService.cs +73 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/SupportedFrameworks.cs +146 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/NuGetUpdater.Core.csproj +27 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectManager.cs +316 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectResolver.cs +87 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/ConfigurationFile.cs +3 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/DotNetToolsJsonUpdater.cs +66 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/GlobalJsonUpdater.cs +48 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackagesConfigUpdater.cs +172 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/SdkPackageUpdater.cs +498 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdateResult.cs +7 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs +105 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/JsonHelper.cs +222 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/Logger.cs +24 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +460 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/NuGetHelper.cs +15 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathHelper.cs +69 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ProcessExtensions.cs +83 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/XmlExtensions.cs +124 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/DotNetToolsJsonBuildFileTests.cs +53 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/GlobalJsonBuildFileTests.cs +80 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/PackagesConfigBuildFileTests.cs +63 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/ProjectBuildFileTests.cs +154 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/FrameworkChecker/CompatibilityCheckerFacts.cs +64 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/FrameworkChecker/FrameworkCompatibilityServiceFacts.cs +122 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/FrameworkChecker/SupportedFrameworkFacts.cs +68 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/NuGetUpdater.Core.Test.csproj +23 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TemporaryDirectory.cs +36 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TestExtensions.cs +15 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/PackagesConfigUpdaterTests.cs +79 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorker.DirsProj.cs +201 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +147 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DotNetTools.cs +225 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.GlobalJson.cs +217 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Mixed.cs +94 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +938 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Sdk.cs +2177 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/JsonHelperTests.cs +239 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +598 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/SdkPackageUpdaterHelperTests.cs +179 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/SdkPackageUpdaterTests.cs +238 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.sln +152 -0
- data/helpers/lib/NuGetUpdater/xunit.runner.json +4 -0
- data/lib/dependabot/nuget/metadata_finder.rb +4 -4
- metadata +91 -5
data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs
ADDED
@@ -0,0 +1,938 @@
|
|
1
|
+
using System.Collections.Generic;
|
2
|
+
using System.Threading.Tasks;
|
3
|
+
|
4
|
+
using Xunit;
|
5
|
+
|
6
|
+
namespace NuGetUpdater.Core.Test.Update;
|
7
|
+
|
8
|
+
public partial class UpdateWorkerTests
|
9
|
+
{
|
10
|
+
public class PackagesConfig : UpdateWorkerTestBase
|
11
|
+
{
|
12
|
+
public PackagesConfig()
|
13
|
+
{
|
14
|
+
MSBuildHelper.RegisterMSBuild();
|
15
|
+
}
|
16
|
+
|
17
|
+
[Fact]
|
18
|
+
public async Task UpdateSingleDependencyInPackagesConfig()
|
19
|
+
{
|
20
|
+
// update Newtonsoft.Json from 7.0.1 to 13.0.1
|
21
|
+
await TestUpdateForProject("Newtonsoft.Json", "7.0.1", "13.0.1",
|
22
|
+
// existing
|
23
|
+
projectContents: """
|
24
|
+
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
25
|
+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
26
|
+
<PropertyGroup>
|
27
|
+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
28
|
+
</PropertyGroup>
|
29
|
+
<ItemGroup>
|
30
|
+
<None Include="packages.config" />
|
31
|
+
</ItemGroup>
|
32
|
+
<ItemGroup>
|
33
|
+
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
34
|
+
<HintPath>packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
35
|
+
<Private>True</Private>
|
36
|
+
</Reference>
|
37
|
+
</ItemGroup>
|
38
|
+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
39
|
+
</Project>
|
40
|
+
""",
|
41
|
+
packagesConfigContents: """
|
42
|
+
<packages>
|
43
|
+
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
|
44
|
+
</packages>
|
45
|
+
""",
|
46
|
+
// expected
|
47
|
+
expectedProjectContents: """
|
48
|
+
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
49
|
+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
50
|
+
<PropertyGroup>
|
51
|
+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
52
|
+
</PropertyGroup>
|
53
|
+
<ItemGroup>
|
54
|
+
<None Include="packages.config" />
|
55
|
+
</ItemGroup>
|
56
|
+
<ItemGroup>
|
57
|
+
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
58
|
+
<HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
59
|
+
<Private>True</Private>
|
60
|
+
</Reference>
|
61
|
+
</ItemGroup>
|
62
|
+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
63
|
+
</Project>
|
64
|
+
""",
|
65
|
+
expectedPackagesConfigContents: """
|
66
|
+
<?xml version="1.0" encoding="utf-8"?>
|
67
|
+
<packages>
|
68
|
+
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
|
69
|
+
</packages>
|
70
|
+
""");
|
71
|
+
}
|
72
|
+
|
73
|
+
[Fact]
|
74
|
+
public async Task UpdateSingleDependencyInPackagesConfigButNotToLatest()
|
75
|
+
{
|
76
|
+
// update Newtonsoft.Json from 7.0.1 to 9.0.1, purposefully not updating all the way to the newest
|
77
|
+
await TestUpdateForProject("Newtonsoft.Json", "7.0.1", "9.0.1",
|
78
|
+
// existing
|
79
|
+
projectContents: """
|
80
|
+
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
81
|
+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
82
|
+
<PropertyGroup>
|
83
|
+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
84
|
+
</PropertyGroup>
|
85
|
+
<ItemGroup>
|
86
|
+
<None Include="packages.config" />
|
87
|
+
</ItemGroup>
|
88
|
+
<ItemGroup>
|
89
|
+
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
90
|
+
<HintPath>packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
91
|
+
<Private>True</Private>
|
92
|
+
</Reference>
|
93
|
+
</ItemGroup>
|
94
|
+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
95
|
+
</Project>
|
96
|
+
""",
|
97
|
+
packagesConfigContents: """
|
98
|
+
<packages>
|
99
|
+
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
|
100
|
+
</packages>
|
101
|
+
""",
|
102
|
+
// expected
|
103
|
+
expectedProjectContents: """
|
104
|
+
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
105
|
+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
106
|
+
<PropertyGroup>
|
107
|
+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
108
|
+
</PropertyGroup>
|
109
|
+
<ItemGroup>
|
110
|
+
<None Include="packages.config" />
|
111
|
+
</ItemGroup>
|
112
|
+
<ItemGroup>
|
113
|
+
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
114
|
+
<HintPath>packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
115
|
+
<Private>True</Private>
|
116
|
+
</Reference>
|
117
|
+
</ItemGroup>
|
118
|
+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
119
|
+
</Project>
|
120
|
+
""",
|
121
|
+
expectedPackagesConfigContents: """
|
122
|
+
<?xml version="1.0" encoding="utf-8"?>
|
123
|
+
<packages>
|
124
|
+
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
|
125
|
+
</packages>
|
126
|
+
""");
|
127
|
+
}
|
128
|
+
|
129
|
+
[Fact]
|
130
|
+
public async Task UpdateSpecifiedVersionInPackagesConfigButNotOthers()
|
131
|
+
{
|
132
|
+
// update Newtonsoft.Json from 7.0.1 to 13.0.1, but leave HtmlAgilityPack alone
|
133
|
+
await TestUpdateForProject("Newtonsoft.Json", "7.0.1", "13.0.1",
|
134
|
+
// existing
|
135
|
+
projectContents: """
|
136
|
+
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
137
|
+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
138
|
+
<PropertyGroup>
|
139
|
+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
140
|
+
</PropertyGroup>
|
141
|
+
<ItemGroup>
|
142
|
+
<None Include="packages.config" />
|
143
|
+
</ItemGroup>
|
144
|
+
<ItemGroup>
|
145
|
+
<Reference Include="HtmlAgilityPack, Version=1.11.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
146
|
+
<HintPath>packages\HtmlAgilityPack.1.11.0\lib\net45\HtmlAgilityPack.dll</HintPath>
|
147
|
+
<Private>True</Private>
|
148
|
+
</Reference>
|
149
|
+
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
150
|
+
<HintPath>packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
151
|
+
<Private>True</Private>
|
152
|
+
</Reference>
|
153
|
+
</ItemGroup>
|
154
|
+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
155
|
+
</Project>
|
156
|
+
""",
|
157
|
+
packagesConfigContents: """
|
158
|
+
<packages>
|
159
|
+
<package id="HtmlAgilityPack" version="1.11.0" targetFramework="net45" />
|
160
|
+
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
|
161
|
+
</packages>
|
162
|
+
""",
|
163
|
+
// expected
|
164
|
+
expectedProjectContents: """
|
165
|
+
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
166
|
+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
167
|
+
<PropertyGroup>
|
168
|
+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
169
|
+
</PropertyGroup>
|
170
|
+
<ItemGroup>
|
171
|
+
<None Include="packages.config" />
|
172
|
+
</ItemGroup>
|
173
|
+
<ItemGroup>
|
174
|
+
<Reference Include="HtmlAgilityPack, Version=1.11.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
175
|
+
<HintPath>packages\HtmlAgilityPack.1.11.0\lib\net45\HtmlAgilityPack.dll</HintPath>
|
176
|
+
<Private>True</Private>
|
177
|
+
</Reference>
|
178
|
+
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
179
|
+
<HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
180
|
+
<Private>True</Private>
|
181
|
+
</Reference>
|
182
|
+
</ItemGroup>
|
183
|
+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
184
|
+
</Project>
|
185
|
+
""",
|
186
|
+
expectedPackagesConfigContents: """
|
187
|
+
<?xml version="1.0" encoding="utf-8"?>
|
188
|
+
<packages>
|
189
|
+
<package id="HtmlAgilityPack" version="1.11.0" targetFramework="net45" />
|
190
|
+
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
|
191
|
+
</packages>
|
192
|
+
""");
|
193
|
+
}
|
194
|
+
|
195
|
+
[Fact]
|
196
|
+
public async Task UpdatePackagesConfigWithNonStandardLocationOfPackagesDirectory()
|
197
|
+
{
|
198
|
+
// update Newtonsoft.Json from 7.0.1 to 13.0.1 with the actual assembly in a non-standard location
|
199
|
+
await TestUpdateForProject("Newtonsoft.Json", "7.0.1", "13.0.1",
|
200
|
+
// existing
|
201
|
+
projectContents: """
|
202
|
+
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
203
|
+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
204
|
+
<PropertyGroup>
|
205
|
+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
206
|
+
</PropertyGroup>
|
207
|
+
<ItemGroup>
|
208
|
+
<None Include="packages.config" />
|
209
|
+
</ItemGroup>
|
210
|
+
<ItemGroup>
|
211
|
+
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
212
|
+
<HintPath>some-non-standard-location\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
213
|
+
<Private>True</Private>
|
214
|
+
</Reference>
|
215
|
+
</ItemGroup>
|
216
|
+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
217
|
+
</Project>
|
218
|
+
""",
|
219
|
+
packagesConfigContents: """
|
220
|
+
<packages>
|
221
|
+
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
|
222
|
+
</packages>
|
223
|
+
""",
|
224
|
+
// expected
|
225
|
+
expectedProjectContents: """
|
226
|
+
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
227
|
+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
228
|
+
<PropertyGroup>
|
229
|
+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
230
|
+
</PropertyGroup>
|
231
|
+
<ItemGroup>
|
232
|
+
<None Include="packages.config" />
|
233
|
+
</ItemGroup>
|
234
|
+
<ItemGroup>
|
235
|
+
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
236
|
+
<HintPath>some-non-standard-location\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
237
|
+
<Private>True</Private>
|
238
|
+
</Reference>
|
239
|
+
</ItemGroup>
|
240
|
+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
241
|
+
</Project>
|
242
|
+
""",
|
243
|
+
expectedPackagesConfigContents: """
|
244
|
+
<?xml version="1.0" encoding="utf-8"?>
|
245
|
+
<packages>
|
246
|
+
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
|
247
|
+
</packages>
|
248
|
+
""");
|
249
|
+
}
|
250
|
+
|
251
|
+
[Fact]
|
252
|
+
public async Task UpdateBindingRedirectInAppConfig()
|
253
|
+
{
|
254
|
+
await TestUpdateForProject("Newtonsoft.Json", "7.0.1", "13.0.1",
|
255
|
+
projectContents: """
|
256
|
+
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
257
|
+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
258
|
+
<PropertyGroup>
|
259
|
+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
260
|
+
</PropertyGroup>
|
261
|
+
<ItemGroup>
|
262
|
+
<None Include="packages.config" />
|
263
|
+
</ItemGroup>
|
264
|
+
<ItemGroup>
|
265
|
+
<None Include="app.config" />
|
266
|
+
</ItemGroup>
|
267
|
+
<ItemGroup>
|
268
|
+
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
269
|
+
<HintPath>packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
270
|
+
<Private>True</Private>
|
271
|
+
</Reference>
|
272
|
+
</ItemGroup>
|
273
|
+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
274
|
+
</Project>
|
275
|
+
""",
|
276
|
+
packagesConfigContents: """
|
277
|
+
<packages>
|
278
|
+
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
|
279
|
+
</packages>
|
280
|
+
""",
|
281
|
+
additionalFiles: new[]
|
282
|
+
{
|
283
|
+
("app.config", """
|
284
|
+
<configuration>
|
285
|
+
<runtime>
|
286
|
+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
287
|
+
<dependentAssembly>
|
288
|
+
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
289
|
+
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
290
|
+
</dependentAssembly>
|
291
|
+
</assemblyBinding>
|
292
|
+
</runtime>
|
293
|
+
</configuration>
|
294
|
+
""")
|
295
|
+
},
|
296
|
+
expectedProjectContents: """
|
297
|
+
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
298
|
+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
299
|
+
<PropertyGroup>
|
300
|
+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
301
|
+
</PropertyGroup>
|
302
|
+
<ItemGroup>
|
303
|
+
<None Include="packages.config" />
|
304
|
+
</ItemGroup>
|
305
|
+
<ItemGroup>
|
306
|
+
<None Include="app.config" />
|
307
|
+
</ItemGroup>
|
308
|
+
<ItemGroup>
|
309
|
+
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
310
|
+
<HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
311
|
+
<Private>True</Private>
|
312
|
+
</Reference>
|
313
|
+
</ItemGroup>
|
314
|
+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
315
|
+
</Project>
|
316
|
+
""",
|
317
|
+
expectedPackagesConfigContents: """
|
318
|
+
<?xml version="1.0" encoding="utf-8"?>
|
319
|
+
<packages>
|
320
|
+
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
|
321
|
+
</packages>
|
322
|
+
""",
|
323
|
+
additionalFilesExpected: new[]
|
324
|
+
{
|
325
|
+
("app.config", """
|
326
|
+
<configuration>
|
327
|
+
<runtime>
|
328
|
+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
329
|
+
<dependentAssembly>
|
330
|
+
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
331
|
+
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
|
332
|
+
</dependentAssembly>
|
333
|
+
</assemblyBinding>
|
334
|
+
</runtime>
|
335
|
+
</configuration>
|
336
|
+
""")
|
337
|
+
});
|
338
|
+
}
|
339
|
+
|
340
|
+
[Fact]
|
341
|
+
public async Task UpdateBindingRedirectInWebConfig()
|
342
|
+
{
|
343
|
+
await TestUpdateForProject("Newtonsoft.Json", "7.0.1", "13.0.1",
|
344
|
+
projectContents: """
|
345
|
+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
346
|
+
<PropertyGroup>
|
347
|
+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
348
|
+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
349
|
+
<ProductVersion>
|
350
|
+
</ProductVersion>
|
351
|
+
<SchemaVersion>2.0</SchemaVersion>
|
352
|
+
<ProjectGuid>ac83fc79-b637-445b-acb0-9be238ad077f</ProjectGuid>
|
353
|
+
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
354
|
+
<OutputType>Library</OutputType>
|
355
|
+
<AppDesignerFolder>Properties</AppDesignerFolder>
|
356
|
+
<RootNamespace>TestProject</RootNamespace>
|
357
|
+
<AssemblyName>TestProject</AssemblyName>
|
358
|
+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
359
|
+
</PropertyGroup>
|
360
|
+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
361
|
+
<DebugSymbols>true</DebugSymbols>
|
362
|
+
<DebugType>full</DebugType>
|
363
|
+
<Optimize>false</Optimize>
|
364
|
+
<OutputPath>bin\</OutputPath>
|
365
|
+
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
366
|
+
<ErrorReport>prompt</ErrorReport>
|
367
|
+
<WarningLevel>4</WarningLevel>
|
368
|
+
</PropertyGroup>
|
369
|
+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
370
|
+
<DebugType>pdbonly</DebugType>
|
371
|
+
<Optimize>true</Optimize>
|
372
|
+
<OutputPath>bin\</OutputPath>
|
373
|
+
<DefineConstants>TRACE</DefineConstants>
|
374
|
+
<ErrorReport>prompt</ErrorReport>
|
375
|
+
<WarningLevel>4</WarningLevel>
|
376
|
+
</PropertyGroup>
|
377
|
+
<ItemGroup>
|
378
|
+
<Reference Include="Microsoft.CSharp" />
|
379
|
+
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
380
|
+
<HintPath>packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
381
|
+
<Private>True</Private>
|
382
|
+
</Reference>
|
383
|
+
<Reference Include="System.Web.DynamicData" />
|
384
|
+
<Reference Include="System.Web.Entity" />
|
385
|
+
<Reference Include="System.Web.ApplicationServices" />
|
386
|
+
<Reference Include="System" />
|
387
|
+
<Reference Include="System.Data" />
|
388
|
+
<Reference Include="System.Core" />
|
389
|
+
<Reference Include="System.Data.DataSetExtensions" />
|
390
|
+
<Reference Include="System.Web.Extensions" />
|
391
|
+
<Reference Include="System.Xml.Linq" />
|
392
|
+
<Reference Include="System.Drawing" />
|
393
|
+
<Reference Include="System.Web" />
|
394
|
+
<Reference Include="System.Xml" />
|
395
|
+
<Reference Include="System.Configuration" />
|
396
|
+
<Reference Include="System.Web.Services" />
|
397
|
+
<Reference Include="System.EnterpriseServices" />
|
398
|
+
</ItemGroup>
|
399
|
+
<ItemGroup>
|
400
|
+
<None Include="packages.config" />
|
401
|
+
<Content Include="web.config" />
|
402
|
+
<Content Include="web.Debug.config">
|
403
|
+
<DependentUpon>web.config</DependentUpon>
|
404
|
+
</Content>
|
405
|
+
<Content Include="web.Release.config">
|
406
|
+
<DependentUpon>web.config</DependentUpon>
|
407
|
+
</Content>
|
408
|
+
</ItemGroup>
|
409
|
+
<ItemGroup>
|
410
|
+
<Compile Include="Properties\AssemblyInfo.cs" />
|
411
|
+
</ItemGroup>
|
412
|
+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
413
|
+
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
|
414
|
+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
415
|
+
Other similar extension points exist, see Microsoft.Common.targets.
|
416
|
+
<Target Name="BeforeBuild">
|
417
|
+
</Target>
|
418
|
+
<Target Name="AfterBuild">
|
419
|
+
</Target>
|
420
|
+
-->
|
421
|
+
</Project>
|
422
|
+
""",
|
423
|
+
packagesConfigContents: """
|
424
|
+
<packages>
|
425
|
+
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
|
426
|
+
</packages>
|
427
|
+
""",
|
428
|
+
additionalFiles: new[]
|
429
|
+
{
|
430
|
+
("web.config", """
|
431
|
+
<configuration>
|
432
|
+
<runtime>
|
433
|
+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
434
|
+
<dependentAssembly>
|
435
|
+
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
436
|
+
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
437
|
+
</dependentAssembly>
|
438
|
+
</assemblyBinding>
|
439
|
+
</runtime>
|
440
|
+
</configuration>
|
441
|
+
""")
|
442
|
+
},
|
443
|
+
expectedProjectContents: """
|
444
|
+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
445
|
+
<PropertyGroup>
|
446
|
+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
447
|
+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
448
|
+
<ProductVersion>
|
449
|
+
</ProductVersion>
|
450
|
+
<SchemaVersion>2.0</SchemaVersion>
|
451
|
+
<ProjectGuid>ac83fc79-b637-445b-acb0-9be238ad077f</ProjectGuid>
|
452
|
+
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
453
|
+
<OutputType>Library</OutputType>
|
454
|
+
<AppDesignerFolder>Properties</AppDesignerFolder>
|
455
|
+
<RootNamespace>TestProject</RootNamespace>
|
456
|
+
<AssemblyName>TestProject</AssemblyName>
|
457
|
+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
458
|
+
</PropertyGroup>
|
459
|
+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
460
|
+
<DebugSymbols>true</DebugSymbols>
|
461
|
+
<DebugType>full</DebugType>
|
462
|
+
<Optimize>false</Optimize>
|
463
|
+
<OutputPath>bin\</OutputPath>
|
464
|
+
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
465
|
+
<ErrorReport>prompt</ErrorReport>
|
466
|
+
<WarningLevel>4</WarningLevel>
|
467
|
+
</PropertyGroup>
|
468
|
+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
469
|
+
<DebugType>pdbonly</DebugType>
|
470
|
+
<Optimize>true</Optimize>
|
471
|
+
<OutputPath>bin\</OutputPath>
|
472
|
+
<DefineConstants>TRACE</DefineConstants>
|
473
|
+
<ErrorReport>prompt</ErrorReport>
|
474
|
+
<WarningLevel>4</WarningLevel>
|
475
|
+
</PropertyGroup>
|
476
|
+
<ItemGroup>
|
477
|
+
<Reference Include="Microsoft.CSharp" />
|
478
|
+
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
479
|
+
<HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
480
|
+
<Private>True</Private>
|
481
|
+
</Reference>
|
482
|
+
<Reference Include="System.Web.DynamicData" />
|
483
|
+
<Reference Include="System.Web.Entity" />
|
484
|
+
<Reference Include="System.Web.ApplicationServices" />
|
485
|
+
<Reference Include="System" />
|
486
|
+
<Reference Include="System.Data" />
|
487
|
+
<Reference Include="System.Core" />
|
488
|
+
<Reference Include="System.Data.DataSetExtensions" />
|
489
|
+
<Reference Include="System.Web.Extensions" />
|
490
|
+
<Reference Include="System.Xml.Linq" />
|
491
|
+
<Reference Include="System.Drawing" />
|
492
|
+
<Reference Include="System.Web" />
|
493
|
+
<Reference Include="System.Xml" />
|
494
|
+
<Reference Include="System.Configuration" />
|
495
|
+
<Reference Include="System.Web.Services" />
|
496
|
+
<Reference Include="System.EnterpriseServices" />
|
497
|
+
</ItemGroup>
|
498
|
+
<ItemGroup>
|
499
|
+
<None Include="packages.config" />
|
500
|
+
<Content Include="web.config" />
|
501
|
+
<Content Include="web.Debug.config">
|
502
|
+
<DependentUpon>web.config</DependentUpon>
|
503
|
+
</Content>
|
504
|
+
<Content Include="web.Release.config">
|
505
|
+
<DependentUpon>web.config</DependentUpon>
|
506
|
+
</Content>
|
507
|
+
</ItemGroup>
|
508
|
+
<ItemGroup>
|
509
|
+
<Compile Include="Properties\AssemblyInfo.cs" />
|
510
|
+
</ItemGroup>
|
511
|
+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
512
|
+
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
|
513
|
+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
514
|
+
Other similar extension points exist, see Microsoft.Common.targets.
|
515
|
+
<Target Name="BeforeBuild">
|
516
|
+
</Target>
|
517
|
+
<Target Name="AfterBuild">
|
518
|
+
</Target>
|
519
|
+
-->
|
520
|
+
</Project>
|
521
|
+
""",
|
522
|
+
expectedPackagesConfigContents: """
|
523
|
+
<?xml version="1.0" encoding="utf-8"?>
|
524
|
+
<packages>
|
525
|
+
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
|
526
|
+
</packages>
|
527
|
+
""",
|
528
|
+
additionalFilesExpected: new[]
|
529
|
+
{
|
530
|
+
("web.config", """
|
531
|
+
<configuration>
|
532
|
+
<runtime>
|
533
|
+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
534
|
+
<dependentAssembly>
|
535
|
+
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
536
|
+
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
|
537
|
+
</dependentAssembly>
|
538
|
+
</assemblyBinding>
|
539
|
+
</runtime>
|
540
|
+
</configuration>
|
541
|
+
""")
|
542
|
+
});
|
543
|
+
}
|
544
|
+
|
545
|
+
[Fact]
|
546
|
+
public async Task AddsBindingRedirectInWebConfig()
|
547
|
+
{
|
548
|
+
await TestUpdateForProject("Newtonsoft.Json", "7.0.1", "13.0.1",
|
549
|
+
projectContents: """
|
550
|
+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
551
|
+
<PropertyGroup>
|
552
|
+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
553
|
+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
554
|
+
<ProductVersion>
|
555
|
+
</ProductVersion>
|
556
|
+
<SchemaVersion>2.0</SchemaVersion>
|
557
|
+
<ProjectGuid>ac83fc79-b637-445b-acb0-9be238ad077f</ProjectGuid>
|
558
|
+
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
559
|
+
<OutputType>Library</OutputType>
|
560
|
+
<AppDesignerFolder>Properties</AppDesignerFolder>
|
561
|
+
<RootNamespace>TestProject</RootNamespace>
|
562
|
+
<AssemblyName>TestProject</AssemblyName>
|
563
|
+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
564
|
+
</PropertyGroup>
|
565
|
+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
566
|
+
<DebugSymbols>true</DebugSymbols>
|
567
|
+
<DebugType>full</DebugType>
|
568
|
+
<Optimize>false</Optimize>
|
569
|
+
<OutputPath>bin\</OutputPath>
|
570
|
+
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
571
|
+
<ErrorReport>prompt</ErrorReport>
|
572
|
+
<WarningLevel>4</WarningLevel>
|
573
|
+
</PropertyGroup>
|
574
|
+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
575
|
+
<DebugType>pdbonly</DebugType>
|
576
|
+
<Optimize>true</Optimize>
|
577
|
+
<OutputPath>bin\</OutputPath>
|
578
|
+
<DefineConstants>TRACE</DefineConstants>
|
579
|
+
<ErrorReport>prompt</ErrorReport>
|
580
|
+
<WarningLevel>4</WarningLevel>
|
581
|
+
</PropertyGroup>
|
582
|
+
<ItemGroup>
|
583
|
+
<Reference Include="Microsoft.CSharp" />
|
584
|
+
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
585
|
+
<HintPath>packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
586
|
+
<Private>True</Private>
|
587
|
+
</Reference>
|
588
|
+
<Reference Include="System.Web.DynamicData" />
|
589
|
+
<Reference Include="System.Web.Entity" />
|
590
|
+
<Reference Include="System.Web.ApplicationServices" />
|
591
|
+
<Reference Include="System" />
|
592
|
+
<Reference Include="System.Data" />
|
593
|
+
<Reference Include="System.Core" />
|
594
|
+
<Reference Include="System.Data.DataSetExtensions" />
|
595
|
+
<Reference Include="System.Web.Extensions" />
|
596
|
+
<Reference Include="System.Xml.Linq" />
|
597
|
+
<Reference Include="System.Drawing" />
|
598
|
+
<Reference Include="System.Web" />
|
599
|
+
<Reference Include="System.Xml" />
|
600
|
+
<Reference Include="System.Configuration" />
|
601
|
+
<Reference Include="System.Web.Services" />
|
602
|
+
<Reference Include="System.EnterpriseServices" />
|
603
|
+
</ItemGroup>
|
604
|
+
<ItemGroup>
|
605
|
+
<None Include="packages.config" />
|
606
|
+
<Content Include="web.config" />
|
607
|
+
<Content Include="web.Debug.config">
|
608
|
+
<DependentUpon>web.config</DependentUpon>
|
609
|
+
</Content>
|
610
|
+
<Content Include="web.Release.config">
|
611
|
+
<DependentUpon>web.config</DependentUpon>
|
612
|
+
</Content>
|
613
|
+
</ItemGroup>
|
614
|
+
<ItemGroup>
|
615
|
+
<Compile Include="Properties\AssemblyInfo.cs" />
|
616
|
+
</ItemGroup>
|
617
|
+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
618
|
+
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
|
619
|
+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
620
|
+
Other similar extension points exist, see Microsoft.Common.targets.
|
621
|
+
<Target Name="BeforeBuild">
|
622
|
+
</Target>
|
623
|
+
<Target Name="AfterBuild">
|
624
|
+
</Target>
|
625
|
+
-->
|
626
|
+
</Project>
|
627
|
+
""",
|
628
|
+
packagesConfigContents: """
|
629
|
+
<packages>
|
630
|
+
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
|
631
|
+
</packages>
|
632
|
+
""",
|
633
|
+
additionalFiles: new[]
|
634
|
+
{
|
635
|
+
("web.config", """
|
636
|
+
<configuration>
|
637
|
+
<runtime>
|
638
|
+
</runtime>
|
639
|
+
</configuration>
|
640
|
+
""")
|
641
|
+
},
|
642
|
+
expectedProjectContents: """
|
643
|
+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
644
|
+
<PropertyGroup>
|
645
|
+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
646
|
+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
647
|
+
<ProductVersion>
|
648
|
+
</ProductVersion>
|
649
|
+
<SchemaVersion>2.0</SchemaVersion>
|
650
|
+
<ProjectGuid>ac83fc79-b637-445b-acb0-9be238ad077f</ProjectGuid>
|
651
|
+
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
652
|
+
<OutputType>Library</OutputType>
|
653
|
+
<AppDesignerFolder>Properties</AppDesignerFolder>
|
654
|
+
<RootNamespace>TestProject</RootNamespace>
|
655
|
+
<AssemblyName>TestProject</AssemblyName>
|
656
|
+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
657
|
+
</PropertyGroup>
|
658
|
+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
659
|
+
<DebugSymbols>true</DebugSymbols>
|
660
|
+
<DebugType>full</DebugType>
|
661
|
+
<Optimize>false</Optimize>
|
662
|
+
<OutputPath>bin\</OutputPath>
|
663
|
+
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
664
|
+
<ErrorReport>prompt</ErrorReport>
|
665
|
+
<WarningLevel>4</WarningLevel>
|
666
|
+
</PropertyGroup>
|
667
|
+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
668
|
+
<DebugType>pdbonly</DebugType>
|
669
|
+
<Optimize>true</Optimize>
|
670
|
+
<OutputPath>bin\</OutputPath>
|
671
|
+
<DefineConstants>TRACE</DefineConstants>
|
672
|
+
<ErrorReport>prompt</ErrorReport>
|
673
|
+
<WarningLevel>4</WarningLevel>
|
674
|
+
</PropertyGroup>
|
675
|
+
<ItemGroup>
|
676
|
+
<Reference Include="Microsoft.CSharp" />
|
677
|
+
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
678
|
+
<HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
679
|
+
<Private>True</Private>
|
680
|
+
</Reference>
|
681
|
+
<Reference Include="System.Web.DynamicData" />
|
682
|
+
<Reference Include="System.Web.Entity" />
|
683
|
+
<Reference Include="System.Web.ApplicationServices" />
|
684
|
+
<Reference Include="System" />
|
685
|
+
<Reference Include="System.Data" />
|
686
|
+
<Reference Include="System.Core" />
|
687
|
+
<Reference Include="System.Data.DataSetExtensions" />
|
688
|
+
<Reference Include="System.Web.Extensions" />
|
689
|
+
<Reference Include="System.Xml.Linq" />
|
690
|
+
<Reference Include="System.Drawing" />
|
691
|
+
<Reference Include="System.Web" />
|
692
|
+
<Reference Include="System.Xml" />
|
693
|
+
<Reference Include="System.Configuration" />
|
694
|
+
<Reference Include="System.Web.Services" />
|
695
|
+
<Reference Include="System.EnterpriseServices" />
|
696
|
+
</ItemGroup>
|
697
|
+
<ItemGroup>
|
698
|
+
<None Include="packages.config" />
|
699
|
+
<Content Include="web.config" />
|
700
|
+
<Content Include="web.Debug.config">
|
701
|
+
<DependentUpon>web.config</DependentUpon>
|
702
|
+
</Content>
|
703
|
+
<Content Include="web.Release.config">
|
704
|
+
<DependentUpon>web.config</DependentUpon>
|
705
|
+
</Content>
|
706
|
+
</ItemGroup>
|
707
|
+
<ItemGroup>
|
708
|
+
<Compile Include="Properties\AssemblyInfo.cs" />
|
709
|
+
</ItemGroup>
|
710
|
+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
711
|
+
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
|
712
|
+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
713
|
+
Other similar extension points exist, see Microsoft.Common.targets.
|
714
|
+
<Target Name="BeforeBuild">
|
715
|
+
</Target>
|
716
|
+
<Target Name="AfterBuild">
|
717
|
+
</Target>
|
718
|
+
-->
|
719
|
+
</Project>
|
720
|
+
""",
|
721
|
+
expectedPackagesConfigContents: """
|
722
|
+
<?xml version="1.0" encoding="utf-8"?>
|
723
|
+
<packages>
|
724
|
+
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
|
725
|
+
</packages>
|
726
|
+
""",
|
727
|
+
additionalFilesExpected: new[]
|
728
|
+
{
|
729
|
+
("web.config", """
|
730
|
+
<configuration>
|
731
|
+
<runtime>
|
732
|
+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
733
|
+
<dependentAssembly>
|
734
|
+
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
735
|
+
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
|
736
|
+
</dependentAssembly>
|
737
|
+
</assemblyBinding>
|
738
|
+
</runtime>
|
739
|
+
</configuration>
|
740
|
+
""")
|
741
|
+
});
|
742
|
+
}
|
743
|
+
|
744
|
+
[Fact]
|
745
|
+
public async Task PackagesConfigUpdateCanHappenEvenWithMismatchedVersionNumbers()
|
746
|
+
{
|
747
|
+
// `packages.config` reports `7.0.1` and that's what we want to update, but the project file has a mismatch that's corrected
|
748
|
+
await TestUpdateForProject("Newtonsoft.Json", "7.0.1", "13.0.1",
|
749
|
+
projectContents: """
|
750
|
+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
751
|
+
<PropertyGroup>
|
752
|
+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
753
|
+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
754
|
+
<ProductVersion>
|
755
|
+
</ProductVersion>
|
756
|
+
<SchemaVersion>2.0</SchemaVersion>
|
757
|
+
<ProjectGuid>ac83fc79-b637-445b-acb0-9be238ad077f</ProjectGuid>
|
758
|
+
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
759
|
+
<OutputType>Library</OutputType>
|
760
|
+
<AppDesignerFolder>Properties</AppDesignerFolder>
|
761
|
+
<RootNamespace>TestProject</RootNamespace>
|
762
|
+
<AssemblyName>TestProject</AssemblyName>
|
763
|
+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
764
|
+
</PropertyGroup>
|
765
|
+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
766
|
+
<DebugSymbols>true</DebugSymbols>
|
767
|
+
<DebugType>full</DebugType>
|
768
|
+
<Optimize>false</Optimize>
|
769
|
+
<OutputPath>bin\</OutputPath>
|
770
|
+
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
771
|
+
<ErrorReport>prompt</ErrorReport>
|
772
|
+
<WarningLevel>4</WarningLevel>
|
773
|
+
</PropertyGroup>
|
774
|
+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
775
|
+
<DebugType>pdbonly</DebugType>
|
776
|
+
<Optimize>true</Optimize>
|
777
|
+
<OutputPath>bin\</OutputPath>
|
778
|
+
<DefineConstants>TRACE</DefineConstants>
|
779
|
+
<ErrorReport>prompt</ErrorReport>
|
780
|
+
<WarningLevel>4</WarningLevel>
|
781
|
+
</PropertyGroup>
|
782
|
+
<ItemGroup>
|
783
|
+
<Reference Include="Microsoft.CSharp" />
|
784
|
+
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
785
|
+
<HintPath>packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
|
786
|
+
<Private>True</Private>
|
787
|
+
</Reference>
|
788
|
+
<Reference Include="System.Web.DynamicData" />
|
789
|
+
<Reference Include="System.Web.Entity" />
|
790
|
+
<Reference Include="System.Web.ApplicationServices" />
|
791
|
+
<Reference Include="System" />
|
792
|
+
<Reference Include="System.Data" />
|
793
|
+
<Reference Include="System.Core" />
|
794
|
+
<Reference Include="System.Data.DataSetExtensions" />
|
795
|
+
<Reference Include="System.Web.Extensions" />
|
796
|
+
<Reference Include="System.Xml.Linq" />
|
797
|
+
<Reference Include="System.Drawing" />
|
798
|
+
<Reference Include="System.Web" />
|
799
|
+
<Reference Include="System.Xml" />
|
800
|
+
<Reference Include="System.Configuration" />
|
801
|
+
<Reference Include="System.Web.Services" />
|
802
|
+
<Reference Include="System.EnterpriseServices" />
|
803
|
+
</ItemGroup>
|
804
|
+
<ItemGroup>
|
805
|
+
<None Include="packages.config" />
|
806
|
+
</ItemGroup>
|
807
|
+
<ItemGroup>
|
808
|
+
<Compile Include="Properties\AssemblyInfo.cs" />
|
809
|
+
</ItemGroup>
|
810
|
+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
811
|
+
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
|
812
|
+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
813
|
+
Other similar extension points exist, see Microsoft.Common.targets.
|
814
|
+
<Target Name="BeforeBuild">
|
815
|
+
</Target>
|
816
|
+
<Target Name="AfterBuild">
|
817
|
+
</Target>
|
818
|
+
-->
|
819
|
+
</Project>
|
820
|
+
""",
|
821
|
+
packagesConfigContents: """
|
822
|
+
<packages>
|
823
|
+
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
|
824
|
+
</packages>
|
825
|
+
""",
|
826
|
+
expectedProjectContents: """
|
827
|
+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
828
|
+
<PropertyGroup>
|
829
|
+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
830
|
+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
831
|
+
<ProductVersion>
|
832
|
+
</ProductVersion>
|
833
|
+
<SchemaVersion>2.0</SchemaVersion>
|
834
|
+
<ProjectGuid>ac83fc79-b637-445b-acb0-9be238ad077f</ProjectGuid>
|
835
|
+
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
836
|
+
<OutputType>Library</OutputType>
|
837
|
+
<AppDesignerFolder>Properties</AppDesignerFolder>
|
838
|
+
<RootNamespace>TestProject</RootNamespace>
|
839
|
+
<AssemblyName>TestProject</AssemblyName>
|
840
|
+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
841
|
+
</PropertyGroup>
|
842
|
+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
843
|
+
<DebugSymbols>true</DebugSymbols>
|
844
|
+
<DebugType>full</DebugType>
|
845
|
+
<Optimize>false</Optimize>
|
846
|
+
<OutputPath>bin\</OutputPath>
|
847
|
+
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
848
|
+
<ErrorReport>prompt</ErrorReport>
|
849
|
+
<WarningLevel>4</WarningLevel>
|
850
|
+
</PropertyGroup>
|
851
|
+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
852
|
+
<DebugType>pdbonly</DebugType>
|
853
|
+
<Optimize>true</Optimize>
|
854
|
+
<OutputPath>bin\</OutputPath>
|
855
|
+
<DefineConstants>TRACE</DefineConstants>
|
856
|
+
<ErrorReport>prompt</ErrorReport>
|
857
|
+
<WarningLevel>4</WarningLevel>
|
858
|
+
</PropertyGroup>
|
859
|
+
<ItemGroup>
|
860
|
+
<Reference Include="Microsoft.CSharp" />
|
861
|
+
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
862
|
+
<HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
863
|
+
<Private>True</Private>
|
864
|
+
</Reference>
|
865
|
+
<Reference Include="System.Web.DynamicData" />
|
866
|
+
<Reference Include="System.Web.Entity" />
|
867
|
+
<Reference Include="System.Web.ApplicationServices" />
|
868
|
+
<Reference Include="System" />
|
869
|
+
<Reference Include="System.Data" />
|
870
|
+
<Reference Include="System.Core" />
|
871
|
+
<Reference Include="System.Data.DataSetExtensions" />
|
872
|
+
<Reference Include="System.Web.Extensions" />
|
873
|
+
<Reference Include="System.Xml.Linq" />
|
874
|
+
<Reference Include="System.Drawing" />
|
875
|
+
<Reference Include="System.Web" />
|
876
|
+
<Reference Include="System.Xml" />
|
877
|
+
<Reference Include="System.Configuration" />
|
878
|
+
<Reference Include="System.Web.Services" />
|
879
|
+
<Reference Include="System.EnterpriseServices" />
|
880
|
+
</ItemGroup>
|
881
|
+
<ItemGroup>
|
882
|
+
<None Include="packages.config" />
|
883
|
+
</ItemGroup>
|
884
|
+
<ItemGroup>
|
885
|
+
<Compile Include="Properties\AssemblyInfo.cs" />
|
886
|
+
</ItemGroup>
|
887
|
+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
888
|
+
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
|
889
|
+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
890
|
+
Other similar extension points exist, see Microsoft.Common.targets.
|
891
|
+
<Target Name="BeforeBuild">
|
892
|
+
</Target>
|
893
|
+
<Target Name="AfterBuild">
|
894
|
+
</Target>
|
895
|
+
-->
|
896
|
+
</Project>
|
897
|
+
""",
|
898
|
+
expectedPackagesConfigContents: """
|
899
|
+
<?xml version="1.0" encoding="utf-8"?>
|
900
|
+
<packages>
|
901
|
+
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
|
902
|
+
</packages>
|
903
|
+
""");
|
904
|
+
}
|
905
|
+
|
906
|
+
protected static async Task TestUpdateForProject(
|
907
|
+
string dependencyName,
|
908
|
+
string oldVersion,
|
909
|
+
string newVersion,
|
910
|
+
string projectContents,
|
911
|
+
string packagesConfigContents,
|
912
|
+
string expectedProjectContents,
|
913
|
+
string expectedPackagesConfigContents,
|
914
|
+
(string Path, string Content)[]? additionalFiles = null,
|
915
|
+
(string Path, string Content)[]? additionalFilesExpected = null)
|
916
|
+
{
|
917
|
+
var realizedAdditionalFiles = new List<(string Path, string Content)>()
|
918
|
+
{
|
919
|
+
("packages.config", packagesConfigContents),
|
920
|
+
};
|
921
|
+
if (additionalFiles is not null)
|
922
|
+
{
|
923
|
+
realizedAdditionalFiles.AddRange(additionalFiles);
|
924
|
+
}
|
925
|
+
|
926
|
+
var realizedAdditionalFilesExpected = new List<(string Path, string Content)>()
|
927
|
+
{
|
928
|
+
("packages.config", expectedPackagesConfigContents),
|
929
|
+
};
|
930
|
+
if (additionalFilesExpected is not null)
|
931
|
+
{
|
932
|
+
realizedAdditionalFilesExpected.AddRange(additionalFilesExpected);
|
933
|
+
}
|
934
|
+
|
935
|
+
await TestUpdateForProject(dependencyName, oldVersion, newVersion, projectContents, expectedProjectContents, additionalFiles: realizedAdditionalFiles.ToArray(), additionalFilesExpected: realizedAdditionalFilesExpected.ToArray());
|
936
|
+
}
|
937
|
+
}
|
938
|
+
}
|