dependabot-nuget 0.321.2 → 0.322.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/helpers/lib/NuGetUpdater/Directory.Packages.props +22 -22
- data/helpers/lib/NuGetUpdater/DotNetPackageCorrelation/Model/PackageMapper.cs +9 -0
- data/helpers/lib/NuGetUpdater/DotNetPackageCorrelation.Cli/Program.cs +21 -7
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/AnalyzeCommand.cs +19 -11
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/CloneCommand.cs +19 -9
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/DiscoverCommand.cs +21 -14
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/FrameworkCheckCommand.cs +8 -5
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/RunCommand.cs +29 -16
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/UpdateCommand.cs +20 -19
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Program.cs +2 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/DependencyDiscoveryTargetingPacks.props +2 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/DependencySolver/IDependencySolver.cs +8 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/DependencySolver/MSBuildDependencySolver.cs +32 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/ProjectDiscoveryResult.cs +1 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/SdkProjectDiscovery.cs +10 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/WorkspaceDiscoveryResult.cs +6 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/ExperimentsManager.cs +3 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/GlobalJsonBuildFile.cs +5 -13
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/PrivateSourceTimedOutException.cs +12 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/JobErrorBase.cs +4 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/PrivateSourceTimedOut.cs +10 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestTextGenerator.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/UpdateHandlers/CreateSecurityUpdatePullRequestHandler.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/UpdateHandlers/GroupUpdateAllVersionsHandler.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/UpdateHandlers/RefreshGroupUpdatePullRequestHandler.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/UpdateHandlers/RefreshSecurityUpdatePullRequestHandler.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/UpdateHandlers/RefreshVersionUpdatePullRequestHandler.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/DotNetToolsJsonUpdater.cs +6 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/FileWriters/FileWriterWorker.cs +376 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/FileWriters/IFileWriter.cs +14 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/FileWriters/XmlFileWriter.cs +477 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/GlobalJsonUpdater.cs +9 -5
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdateOperationBase.cs +18 -7
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs +26 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +15 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/DependencySolver/MSBuildDependencySolverTests.cs +633 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.GlobalJson.cs +0 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs +0 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/SdkProjectDiscoveryTests.cs +49 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/GlobalJsonBuildFileTests.cs +0 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/EndToEndTests.cs +484 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/HttpApiHandlerTests.cs +1 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/JobErrorBaseTests.cs +7 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/MessageReportTests.cs +11 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/PullRequestTextTests.cs +21 -22
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/RunWorkerTests.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/SerializationTests.cs +8 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/DotNetToolsJsonUpdaterTests.cs +181 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/FileWriters/FileWriterTestsBase.cs +61 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/FileWriters/FileWriterWorkerTests.cs +917 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/FileWriters/FileWriterWorkerTests_MiscellaneousTests.cs +154 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/FileWriters/TestFileWriterReturnsConstantResult.cs +20 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/FileWriters/XmlFileWriterTests.cs +1620 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/FileWriters/XmlFileWriterTests_CreateUpdatedVersionRangeTests.cs +25 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/GlobalJsonUpdaterTests.cs +139 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/PackagesConfigUpdaterTests.cs +1961 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateOperationResultTests.cs +116 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +16 -1043
- data/helpers/lib/NuGetUpdater/global.json +1 -1
- metadata +21 -10
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DotNetTools.cs +0 -375
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.GlobalJson.cs +0 -296
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.LockFile.cs +0 -251
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Mixed.cs +0 -201
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackageReference.cs +0 -3821
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +0 -2706
data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs
DELETED
@@ -1,2706 +0,0 @@
|
|
1
|
-
using System.Collections.Immutable;
|
2
|
-
using System.Text;
|
3
|
-
using System.Text.Json;
|
4
|
-
|
5
|
-
using NuGet;
|
6
|
-
|
7
|
-
using NuGetUpdater.Core.Run.ApiModel;
|
8
|
-
using NuGetUpdater.Core.Test.Updater;
|
9
|
-
using NuGetUpdater.Core.Updater;
|
10
|
-
|
11
|
-
using Xunit;
|
12
|
-
|
13
|
-
namespace NuGetUpdater.Core.Test.Update;
|
14
|
-
|
15
|
-
public partial class UpdateWorkerTests
|
16
|
-
{
|
17
|
-
public class PackagesConfig : UpdateWorkerTestBase
|
18
|
-
{
|
19
|
-
[Fact]
|
20
|
-
public async Task UpdateSingleDependencyInPackagesConfig()
|
21
|
-
{
|
22
|
-
// update Some.Package from 7.0.1 to 13.0.1
|
23
|
-
await TestUpdateForProject("Some.Package", "7.0.1", "13.0.1",
|
24
|
-
packages:
|
25
|
-
[
|
26
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "7.0.1", "net45"),
|
27
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net45"),
|
28
|
-
],
|
29
|
-
// existing
|
30
|
-
projectContents: """
|
31
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
32
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
33
|
-
<PropertyGroup>
|
34
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
35
|
-
</PropertyGroup>
|
36
|
-
<ItemGroup>
|
37
|
-
<None Include="packages.config" />
|
38
|
-
</ItemGroup>
|
39
|
-
<ItemGroup>
|
40
|
-
<Reference Include="Some.Package, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
41
|
-
<HintPath>packages\Some.Package.7.0.1\lib\net45\Some.Package.dll</HintPath>
|
42
|
-
<Private>True</Private>
|
43
|
-
</Reference>
|
44
|
-
</ItemGroup>
|
45
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
46
|
-
</Project>
|
47
|
-
""",
|
48
|
-
packagesConfigContents: """
|
49
|
-
<packages>
|
50
|
-
<package id="Some.Package" version="7.0.1" targetFramework="net45" />
|
51
|
-
</packages>
|
52
|
-
""",
|
53
|
-
// expected
|
54
|
-
expectedProjectContents: """
|
55
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
56
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
57
|
-
<PropertyGroup>
|
58
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
59
|
-
</PropertyGroup>
|
60
|
-
<ItemGroup>
|
61
|
-
<None Include="packages.config" />
|
62
|
-
</ItemGroup>
|
63
|
-
<ItemGroup>
|
64
|
-
<Reference Include="Some.Package">
|
65
|
-
<HintPath>packages\Some.Package.13.0.1\lib\net45\Some.Package.dll</HintPath>
|
66
|
-
<Private>True</Private>
|
67
|
-
</Reference>
|
68
|
-
</ItemGroup>
|
69
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
70
|
-
</Project>
|
71
|
-
""",
|
72
|
-
expectedPackagesConfigContents: """
|
73
|
-
<?xml version="1.0" encoding="utf-8"?>
|
74
|
-
<packages>
|
75
|
-
<package id="Some.Package" version="13.0.1" targetFramework="net45" />
|
76
|
-
</packages>
|
77
|
-
"""
|
78
|
-
);
|
79
|
-
}
|
80
|
-
|
81
|
-
[Fact]
|
82
|
-
public async Task UpdateSingleDependencyInPackagesConfig_ReferenceHasNoAssemblyVersion()
|
83
|
-
{
|
84
|
-
// update Some.Package from 7.0.1 to 13.0.1
|
85
|
-
await TestUpdateForProject("Some.Package", "7.0.1", "13.0.1",
|
86
|
-
packages:
|
87
|
-
[
|
88
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "7.0.1", "net45"),
|
89
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net45"),
|
90
|
-
],
|
91
|
-
// existing
|
92
|
-
projectContents: """
|
93
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
94
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
95
|
-
<PropertyGroup>
|
96
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
97
|
-
</PropertyGroup>
|
98
|
-
<ItemGroup>
|
99
|
-
<None Include="packages.config" />
|
100
|
-
</ItemGroup>
|
101
|
-
<ItemGroup>
|
102
|
-
<Reference Include="Some.Package">
|
103
|
-
<HintPath>packages\Some.Package.7.0.1\lib\net45\Some.Package.dll</HintPath>
|
104
|
-
<Private>True</Private>
|
105
|
-
</Reference>
|
106
|
-
</ItemGroup>
|
107
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
108
|
-
</Project>
|
109
|
-
""",
|
110
|
-
packagesConfigContents: """
|
111
|
-
<packages>
|
112
|
-
<package id="Some.Package" version="7.0.1" targetFramework="net45" />
|
113
|
-
</packages>
|
114
|
-
""",
|
115
|
-
// expected
|
116
|
-
expectedProjectContents: """
|
117
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
118
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
119
|
-
<PropertyGroup>
|
120
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
121
|
-
</PropertyGroup>
|
122
|
-
<ItemGroup>
|
123
|
-
<None Include="packages.config" />
|
124
|
-
</ItemGroup>
|
125
|
-
<ItemGroup>
|
126
|
-
<Reference Include="Some.Package">
|
127
|
-
<HintPath>packages\Some.Package.13.0.1\lib\net45\Some.Package.dll</HintPath>
|
128
|
-
<Private>True</Private>
|
129
|
-
</Reference>
|
130
|
-
</ItemGroup>
|
131
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
132
|
-
</Project>
|
133
|
-
""",
|
134
|
-
expectedPackagesConfigContents: """
|
135
|
-
<?xml version="1.0" encoding="utf-8"?>
|
136
|
-
<packages>
|
137
|
-
<package id="Some.Package" version="13.0.1" targetFramework="net45" />
|
138
|
-
</packages>
|
139
|
-
"""
|
140
|
-
);
|
141
|
-
}
|
142
|
-
|
143
|
-
[Fact]
|
144
|
-
public async Task UpdateSingleDependencyInPackagesConfig_SpecifiedDependencyHasNoPackagesPath()
|
145
|
-
{
|
146
|
-
// update Package.With.No.Assembly from 1.0.0
|
147
|
-
await TestUpdateForProject("Package.With.No.Assembly", "1.0.0", "1.1.0",
|
148
|
-
packages:
|
149
|
-
[
|
150
|
-
// this package has no `lib` directory, but it's still valid because it has a `content` directory
|
151
|
-
new MockNuGetPackage("Package.With.No.Assembly", "1.0.0", Files: [("content/some-content.txt", [])]),
|
152
|
-
new MockNuGetPackage("Package.With.No.Assembly", "1.1.0", Files: [("content/some-content.txt", [])]),
|
153
|
-
// this is a regular package that's not being updated
|
154
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "1.0.0", "net46"),
|
155
|
-
],
|
156
|
-
// existing
|
157
|
-
projectContents: """
|
158
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
159
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
160
|
-
<PropertyGroup>
|
161
|
-
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
|
162
|
-
</PropertyGroup>
|
163
|
-
<ItemGroup>
|
164
|
-
<None Include="packages.config" />
|
165
|
-
</ItemGroup>
|
166
|
-
<ItemGroup>
|
167
|
-
<Reference Include="Some.Package">
|
168
|
-
<HintPath>packages\Some.Package.1.0.0\lib\net46\Some.Package.dll</HintPath>
|
169
|
-
<Private>True</Private>
|
170
|
-
</Reference>
|
171
|
-
</ItemGroup>
|
172
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
173
|
-
</Project>
|
174
|
-
""",
|
175
|
-
packagesConfigContents: """
|
176
|
-
<packages>
|
177
|
-
<package id="Package.With.No.Assembly" version="1.0.0" targetFramework="net46" />
|
178
|
-
<package id="Some.Package" version="1.0.0" targetFramework="net46" />
|
179
|
-
</packages>
|
180
|
-
""",
|
181
|
-
// expected
|
182
|
-
expectedProjectContents: """
|
183
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
184
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
185
|
-
<PropertyGroup>
|
186
|
-
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
|
187
|
-
</PropertyGroup>
|
188
|
-
<ItemGroup>
|
189
|
-
<None Include="packages.config" />
|
190
|
-
</ItemGroup>
|
191
|
-
<ItemGroup>
|
192
|
-
<Reference Include="Some.Package">
|
193
|
-
<HintPath>packages\Some.Package.1.0.0\lib\net46\Some.Package.dll</HintPath>
|
194
|
-
<Private>True</Private>
|
195
|
-
</Reference>
|
196
|
-
</ItemGroup>
|
197
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
198
|
-
</Project>
|
199
|
-
""",
|
200
|
-
expectedPackagesConfigContents: """
|
201
|
-
<?xml version="1.0" encoding="utf-8"?>
|
202
|
-
<packages>
|
203
|
-
<package id="Package.With.No.Assembly" version="1.1.0" targetFramework="net46" />
|
204
|
-
<package id="Some.Package" version="1.0.0" targetFramework="net46" />
|
205
|
-
</packages>
|
206
|
-
"""
|
207
|
-
);
|
208
|
-
}
|
209
|
-
|
210
|
-
[Fact]
|
211
|
-
public async Task UpdateSingleDependencyInPackagesConfig_NoPackagesPathCanBeFound()
|
212
|
-
{
|
213
|
-
// update Package.With.No.Assembly from 1.0.0 to 1.0.0
|
214
|
-
await TestUpdateForProject("Package.With.No.Assembly", "1.0.0", "1.1.0",
|
215
|
-
packages:
|
216
|
-
[
|
217
|
-
// this package has no `lib` directory, but it's still valid because it has a `content` directory
|
218
|
-
new MockNuGetPackage("Package.With.No.Assembly", "1.0.0", Files: [("content/some-content.txt", [])]),
|
219
|
-
new MockNuGetPackage("Package.With.No.Assembly", "1.1.0", Files: [("content/some-content.txt", [])]),
|
220
|
-
],
|
221
|
-
// existing
|
222
|
-
projectContents: """
|
223
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
224
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
225
|
-
<PropertyGroup>
|
226
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
227
|
-
</PropertyGroup>
|
228
|
-
<ItemGroup>
|
229
|
-
<None Include="packages.config" />
|
230
|
-
</ItemGroup>
|
231
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
232
|
-
</Project>
|
233
|
-
""",
|
234
|
-
packagesConfigContents: """
|
235
|
-
<packages>
|
236
|
-
<package id="Package.With.No.Assembly" version="1.0.0" targetFramework="net45" />
|
237
|
-
</packages>
|
238
|
-
""",
|
239
|
-
// expected
|
240
|
-
expectedProjectContents: """
|
241
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
242
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
243
|
-
<PropertyGroup>
|
244
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
245
|
-
</PropertyGroup>
|
246
|
-
<ItemGroup>
|
247
|
-
<None Include="packages.config" />
|
248
|
-
</ItemGroup>
|
249
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
250
|
-
</Project>
|
251
|
-
""",
|
252
|
-
expectedPackagesConfigContents: """
|
253
|
-
<?xml version="1.0" encoding="utf-8"?>
|
254
|
-
<packages>
|
255
|
-
<package id="Package.With.No.Assembly" version="1.1.0" targetFramework="net45" />
|
256
|
-
</packages>
|
257
|
-
"""
|
258
|
-
);
|
259
|
-
}
|
260
|
-
|
261
|
-
[Fact]
|
262
|
-
public async Task UpdateDependency_NoAssembliesAndContentDirectoryDiffersByCase()
|
263
|
-
{
|
264
|
-
// update Package.With.No.Assembly from 1.0.0 to 1.0.0
|
265
|
-
await TestUpdateForProject("Package.With.No.Assembly", "1.0.0", "1.1.0",
|
266
|
-
packages:
|
267
|
-
[
|
268
|
-
// this package is expected to have a directory named `content`, but here it differs by case as `Content`
|
269
|
-
new MockNuGetPackage("Package.With.No.Assembly", "1.0.0", Files: [("Content/some-content.txt", [])]),
|
270
|
-
new MockNuGetPackage("Package.With.No.Assembly", "1.1.0", Files: [("Content/some-content.txt", [])]),
|
271
|
-
],
|
272
|
-
// existing
|
273
|
-
projectContents: """
|
274
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
275
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
276
|
-
<PropertyGroup>
|
277
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
278
|
-
</PropertyGroup>
|
279
|
-
<ItemGroup>
|
280
|
-
<None Include="packages.config" />
|
281
|
-
</ItemGroup>
|
282
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
283
|
-
</Project>
|
284
|
-
""",
|
285
|
-
packagesConfigContents: """
|
286
|
-
<packages>
|
287
|
-
<package id="Package.With.No.Assembly" version="1.0.0" targetFramework="net45" />
|
288
|
-
</packages>
|
289
|
-
""",
|
290
|
-
// expected
|
291
|
-
expectedProjectContents: """
|
292
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
293
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
294
|
-
<PropertyGroup>
|
295
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
296
|
-
</PropertyGroup>
|
297
|
-
<ItemGroup>
|
298
|
-
<None Include="packages.config" />
|
299
|
-
</ItemGroup>
|
300
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
301
|
-
</Project>
|
302
|
-
""",
|
303
|
-
expectedPackagesConfigContents: """
|
304
|
-
<?xml version="1.0" encoding="utf-8"?>
|
305
|
-
<packages>
|
306
|
-
<package id="Package.With.No.Assembly" version="1.1.0" targetFramework="net45" />
|
307
|
-
</packages>
|
308
|
-
"""
|
309
|
-
);
|
310
|
-
}
|
311
|
-
|
312
|
-
[Fact]
|
313
|
-
public async Task UpdatePackageWithTargetsFileWhereProjectUsesBackslashes()
|
314
|
-
{
|
315
|
-
// The bug that caused this test to be written did not repro on Windows. The reason is that the packages
|
316
|
-
// directory is determined to be `..\packages`, but the backslash was retained. Later when packages were
|
317
|
-
// restored to that location, a directory with a name like `..?packages` would be created which didn't
|
318
|
-
// match the <Import> element's path of "..\packages\..." that had no `Condition="Exists(path)"` attribute.
|
319
|
-
await TestUpdateForProject("Some.Package", "1.0.0", "2.0.0",
|
320
|
-
packages:
|
321
|
-
[
|
322
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "1.0.0", "net45"),
|
323
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "2.0.0", "net45"),
|
324
|
-
new MockNuGetPackage("Package.With.Targets", "1.0.0", Files: [("build/SomeFile.targets", Encoding.UTF8.GetBytes("<Project />"))]),
|
325
|
-
],
|
326
|
-
// existing
|
327
|
-
projectFile: ("src/project.csproj", """
|
328
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
329
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
330
|
-
<PropertyGroup>
|
331
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
332
|
-
</PropertyGroup>
|
333
|
-
<ItemGroup>
|
334
|
-
<None Include="packages.config" />
|
335
|
-
</ItemGroup>
|
336
|
-
<ItemGroup>
|
337
|
-
<Reference Include="Some.Package">
|
338
|
-
<HintPath>..\packages\Some.Package.1.0.0\lib\net45\Some.Package.dll</HintPath>
|
339
|
-
<Private>True</Private>
|
340
|
-
</Reference>
|
341
|
-
</ItemGroup>
|
342
|
-
<Import Project="..\packages\Package.With.Targets.1.0.0\build\SomeFile.targets" />
|
343
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
344
|
-
</Project>
|
345
|
-
"""),
|
346
|
-
additionalFiles:
|
347
|
-
[
|
348
|
-
("src/packages.config", """
|
349
|
-
<?xml version="1.0" encoding="utf-8"?>
|
350
|
-
<packages>
|
351
|
-
<package id="Package.With.Targets" version="1.0.0" targetFramework="net45" />
|
352
|
-
<package id="Some.Package" version="1.0.0" targetFramework="net45" />
|
353
|
-
</packages>
|
354
|
-
""")
|
355
|
-
],
|
356
|
-
// expected
|
357
|
-
expectedProjectContents: """
|
358
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
359
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
360
|
-
<PropertyGroup>
|
361
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
362
|
-
</PropertyGroup>
|
363
|
-
<ItemGroup>
|
364
|
-
<None Include="packages.config" />
|
365
|
-
</ItemGroup>
|
366
|
-
<ItemGroup>
|
367
|
-
<Reference Include="Some.Package">
|
368
|
-
<HintPath>..\packages\Some.Package.2.0.0\lib\net45\Some.Package.dll</HintPath>
|
369
|
-
<Private>True</Private>
|
370
|
-
</Reference>
|
371
|
-
</ItemGroup>
|
372
|
-
<Import Project="..\packages\Package.With.Targets.1.0.0\build\SomeFile.targets" />
|
373
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
374
|
-
</Project>
|
375
|
-
""",
|
376
|
-
additionalFilesExpected:
|
377
|
-
[
|
378
|
-
("src/packages.config", """
|
379
|
-
<?xml version="1.0" encoding="utf-8"?>
|
380
|
-
<packages>
|
381
|
-
<package id="Package.With.Targets" version="1.0.0" targetFramework="net45" />
|
382
|
-
<package id="Some.Package" version="2.0.0" targetFramework="net45" />
|
383
|
-
</packages>
|
384
|
-
""")
|
385
|
-
]
|
386
|
-
);
|
387
|
-
}
|
388
|
-
|
389
|
-
[Fact]
|
390
|
-
public async Task UpdateSingleDependencyInPackagesConfigButNotToLatest()
|
391
|
-
{
|
392
|
-
// update Some.Package from 7.0.1 to 9.0.1, purposefully not updating all the way to the newest
|
393
|
-
await TestUpdateForProject("Some.Package", "7.0.1", "9.0.1",
|
394
|
-
packages:
|
395
|
-
[
|
396
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "7.0.1", "net45"),
|
397
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "9.0.1", "net45"),
|
398
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net45"),
|
399
|
-
],
|
400
|
-
// existing
|
401
|
-
projectContents: """
|
402
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
403
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
404
|
-
<PropertyGroup>
|
405
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
406
|
-
</PropertyGroup>
|
407
|
-
<ItemGroup>
|
408
|
-
<None Include="packages.config" />
|
409
|
-
</ItemGroup>
|
410
|
-
<ItemGroup>
|
411
|
-
<Reference Include="Some.Package">
|
412
|
-
<HintPath>packages\Some.Package.7.0.1\lib\net45\Some.Package.dll</HintPath>
|
413
|
-
<Private>True</Private>
|
414
|
-
</Reference>
|
415
|
-
</ItemGroup>
|
416
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
417
|
-
</Project>
|
418
|
-
""",
|
419
|
-
packagesConfigContents: """
|
420
|
-
<packages>
|
421
|
-
<package id="Some.Package" version="7.0.1" targetFramework="net45" />
|
422
|
-
</packages>
|
423
|
-
""",
|
424
|
-
// expected
|
425
|
-
expectedProjectContents: """
|
426
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
427
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
428
|
-
<PropertyGroup>
|
429
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
430
|
-
</PropertyGroup>
|
431
|
-
<ItemGroup>
|
432
|
-
<None Include="packages.config" />
|
433
|
-
</ItemGroup>
|
434
|
-
<ItemGroup>
|
435
|
-
<Reference Include="Some.Package">
|
436
|
-
<HintPath>packages\Some.Package.9.0.1\lib\net45\Some.Package.dll</HintPath>
|
437
|
-
<Private>True</Private>
|
438
|
-
</Reference>
|
439
|
-
</ItemGroup>
|
440
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
441
|
-
</Project>
|
442
|
-
""",
|
443
|
-
expectedPackagesConfigContents: """
|
444
|
-
<?xml version="1.0" encoding="utf-8"?>
|
445
|
-
<packages>
|
446
|
-
<package id="Some.Package" version="9.0.1" targetFramework="net45" />
|
447
|
-
</packages>
|
448
|
-
"""
|
449
|
-
);
|
450
|
-
}
|
451
|
-
|
452
|
-
[Fact]
|
453
|
-
public async Task UpdateSpecifiedVersionInPackagesConfigButNotOthers()
|
454
|
-
{
|
455
|
-
// update Some.Package from 7.0.1 to 13.0.1, but leave Some.Unrelated.Package alone
|
456
|
-
await TestUpdateForProject("Some.Package", "7.0.1", "13.0.1",
|
457
|
-
packages:
|
458
|
-
[
|
459
|
-
// this package is upgraded
|
460
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "7.0.1", "net45"),
|
461
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net45"),
|
462
|
-
// this package is not upgraded
|
463
|
-
MockNuGetPackage.CreateSimplePackage("Some.Unrelated.Package", "1.0.0", "net45"),
|
464
|
-
MockNuGetPackage.CreateSimplePackage("Some.Unrelated.Package", "1.1.0", "net45"),
|
465
|
-
],
|
466
|
-
// existing
|
467
|
-
projectContents: """
|
468
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
469
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
470
|
-
<PropertyGroup>
|
471
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
472
|
-
</PropertyGroup>
|
473
|
-
<ItemGroup>
|
474
|
-
<None Include="packages.config" />
|
475
|
-
</ItemGroup>
|
476
|
-
<ItemGroup>
|
477
|
-
<Reference Include="Some.Package">
|
478
|
-
<HintPath>packages\Some.Package.7.0.1\lib\net45\Some.Package.dll</HintPath>
|
479
|
-
<Private>True</Private>
|
480
|
-
</Reference>
|
481
|
-
<Reference Include="Some.Unrelated.Package">
|
482
|
-
<HintPath>packages\Some.Unrelated.Package.1.0.0\lib\net45\Some.Unrelated.Package.dll</HintPath>
|
483
|
-
<Private>True</Private>
|
484
|
-
</Reference>
|
485
|
-
</ItemGroup>
|
486
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
487
|
-
</Project>
|
488
|
-
""",
|
489
|
-
packagesConfigContents: """
|
490
|
-
<packages>
|
491
|
-
<package id="Some.Unrelated.Package" version="1.0.0" targetFramework="net45" />
|
492
|
-
<package id="Some.Package" version="7.0.1" targetFramework="net45" />
|
493
|
-
</packages>
|
494
|
-
""",
|
495
|
-
// expected
|
496
|
-
expectedProjectContents: """
|
497
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
498
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
499
|
-
<PropertyGroup>
|
500
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
501
|
-
</PropertyGroup>
|
502
|
-
<ItemGroup>
|
503
|
-
<None Include="packages.config" />
|
504
|
-
</ItemGroup>
|
505
|
-
<ItemGroup>
|
506
|
-
<Reference Include="Some.Package">
|
507
|
-
<HintPath>packages\Some.Package.13.0.1\lib\net45\Some.Package.dll</HintPath>
|
508
|
-
<Private>True</Private>
|
509
|
-
</Reference>
|
510
|
-
<Reference Include="Some.Unrelated.Package">
|
511
|
-
<HintPath>packages\Some.Unrelated.Package.1.0.0\lib\net45\Some.Unrelated.Package.dll</HintPath>
|
512
|
-
<Private>True</Private>
|
513
|
-
</Reference>
|
514
|
-
</ItemGroup>
|
515
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
516
|
-
</Project>
|
517
|
-
""",
|
518
|
-
expectedPackagesConfigContents: """
|
519
|
-
<?xml version="1.0" encoding="utf-8"?>
|
520
|
-
<packages>
|
521
|
-
<package id="Some.Unrelated.Package" version="1.0.0" targetFramework="net45" />
|
522
|
-
<package id="Some.Package" version="13.0.1" targetFramework="net45" />
|
523
|
-
</packages>
|
524
|
-
"""
|
525
|
-
);
|
526
|
-
}
|
527
|
-
|
528
|
-
[Fact]
|
529
|
-
public async Task UpdatePackagesConfigWithNonStandardLocationOfPackagesDirectory()
|
530
|
-
{
|
531
|
-
// update Some.Package from 7.0.1 to 13.0.1 with the actual assembly in a non-standard location
|
532
|
-
await TestUpdateForProject("Some.Package", "7.0.1", "13.0.1",
|
533
|
-
packages:
|
534
|
-
[
|
535
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "7.0.1", "net45"),
|
536
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net45"),
|
537
|
-
],
|
538
|
-
// existing
|
539
|
-
projectContents: """
|
540
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
541
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
542
|
-
<PropertyGroup>
|
543
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
544
|
-
</PropertyGroup>
|
545
|
-
<ItemGroup>
|
546
|
-
<None Include="packages.config" />
|
547
|
-
</ItemGroup>
|
548
|
-
<ItemGroup>
|
549
|
-
<Reference Include="Some.Package">
|
550
|
-
<HintPath>some-non-standard-location\Some.Package.7.0.1\lib\net45\Some.Package.dll</HintPath>
|
551
|
-
<Private>True</Private>
|
552
|
-
</Reference>
|
553
|
-
</ItemGroup>
|
554
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
555
|
-
</Project>
|
556
|
-
""",
|
557
|
-
packagesConfigContents: """
|
558
|
-
<packages>
|
559
|
-
<package id="Some.Package" version="7.0.1" targetFramework="net45" />
|
560
|
-
</packages>
|
561
|
-
""",
|
562
|
-
// expected
|
563
|
-
expectedProjectContents: """
|
564
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
565
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
566
|
-
<PropertyGroup>
|
567
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
568
|
-
</PropertyGroup>
|
569
|
-
<ItemGroup>
|
570
|
-
<None Include="packages.config" />
|
571
|
-
</ItemGroup>
|
572
|
-
<ItemGroup>
|
573
|
-
<Reference Include="Some.Package">
|
574
|
-
<HintPath>some-non-standard-location\Some.Package.13.0.1\lib\net45\Some.Package.dll</HintPath>
|
575
|
-
<Private>True</Private>
|
576
|
-
</Reference>
|
577
|
-
</ItemGroup>
|
578
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
579
|
-
</Project>
|
580
|
-
""",
|
581
|
-
expectedPackagesConfigContents: """
|
582
|
-
<?xml version="1.0" encoding="utf-8"?>
|
583
|
-
<packages>
|
584
|
-
<package id="Some.Package" version="13.0.1" targetFramework="net45" />
|
585
|
-
</packages>
|
586
|
-
"""
|
587
|
-
);
|
588
|
-
}
|
589
|
-
|
590
|
-
[Fact]
|
591
|
-
public async Task UpdateBindingRedirectInAppConfig()
|
592
|
-
{
|
593
|
-
await TestUpdateForProject("Some.Package", "7.0.1", "13.0.1",
|
594
|
-
packages:
|
595
|
-
[
|
596
|
-
MockNuGetPackage.CreatePackageWithAssembly("Some.Package", "7.0.1", "net45", "7.0.0.0"),
|
597
|
-
MockNuGetPackage.CreatePackageWithAssembly("Some.Package", "13.0.1", "net45", "13.0.0.0"),
|
598
|
-
MockNuGetPackage.CreatePackageWithAssembly("Unrelated.Package", "1.2.3", "net45","1.2.0.0"),
|
599
|
-
],
|
600
|
-
projectContents: """
|
601
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
602
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
603
|
-
<PropertyGroup>
|
604
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
605
|
-
</PropertyGroup>
|
606
|
-
<ItemGroup>
|
607
|
-
<None Include="packages.config" />
|
608
|
-
</ItemGroup>
|
609
|
-
<ItemGroup>
|
610
|
-
<None Include="app.config" />
|
611
|
-
</ItemGroup>
|
612
|
-
<ItemGroup>
|
613
|
-
<Reference Include="Some.Package, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null">
|
614
|
-
<HintPath>packages\Some.Package.7.0.1\lib\net45\Some.Package.dll</HintPath>
|
615
|
-
<Private>True</Private>
|
616
|
-
</Reference>
|
617
|
-
<Reference Include="Unrelated.Package, Version=1.2.0.0, Culture=neutral, PublicKeyToken=null">
|
618
|
-
<HintPath>packages\Unrelated.Package.1.2.3\lib\net45\Unrelated.Package.dll</HintPath>
|
619
|
-
<Private>True</Private>
|
620
|
-
</Reference>
|
621
|
-
</ItemGroup>
|
622
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
623
|
-
</Project>
|
624
|
-
""",
|
625
|
-
packagesConfigContents: """
|
626
|
-
<packages>
|
627
|
-
<package id="Some.Package" version="7.0.1" targetFramework="net45" />
|
628
|
-
</packages>
|
629
|
-
""",
|
630
|
-
additionalFiles:
|
631
|
-
[
|
632
|
-
("app.config", """
|
633
|
-
<configuration>
|
634
|
-
<runtime>
|
635
|
-
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
636
|
-
<dependentAssembly>
|
637
|
-
<assemblyIdentity name="Some.Package" publicKeyToken="null" culture="neutral" />
|
638
|
-
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
639
|
-
</dependentAssembly>
|
640
|
-
</assemblyBinding>
|
641
|
-
</runtime>
|
642
|
-
</configuration>
|
643
|
-
""")
|
644
|
-
],
|
645
|
-
expectedProjectContents: """
|
646
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
647
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
648
|
-
<PropertyGroup>
|
649
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
650
|
-
</PropertyGroup>
|
651
|
-
<ItemGroup>
|
652
|
-
<None Include="packages.config" />
|
653
|
-
</ItemGroup>
|
654
|
-
<ItemGroup>
|
655
|
-
<None Include="app.config" />
|
656
|
-
</ItemGroup>
|
657
|
-
<ItemGroup>
|
658
|
-
<Reference Include="Some.Package, Version=13.0.0.0, Culture=neutral, PublicKeyToken=null">
|
659
|
-
<HintPath>packages\Some.Package.13.0.1\lib\net45\Some.Package.dll</HintPath>
|
660
|
-
<Private>True</Private>
|
661
|
-
</Reference>
|
662
|
-
<Reference Include="Unrelated.Package, Version=1.2.0.0, Culture=neutral, PublicKeyToken=null">
|
663
|
-
<HintPath>packages\Unrelated.Package.1.2.3\lib\net45\Unrelated.Package.dll</HintPath>
|
664
|
-
<Private>True</Private>
|
665
|
-
</Reference>
|
666
|
-
</ItemGroup>
|
667
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
668
|
-
</Project>
|
669
|
-
""",
|
670
|
-
expectedPackagesConfigContents: """
|
671
|
-
<?xml version="1.0" encoding="utf-8"?>
|
672
|
-
<packages>
|
673
|
-
<package id="Some.Package" version="13.0.1" targetFramework="net45" />
|
674
|
-
</packages>
|
675
|
-
""",
|
676
|
-
additionalFilesExpected:
|
677
|
-
[
|
678
|
-
("app.config", """
|
679
|
-
<configuration>
|
680
|
-
<runtime>
|
681
|
-
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
682
|
-
<dependentAssembly>
|
683
|
-
<assemblyIdentity name="Some.Package" publicKeyToken="null" culture="neutral" />
|
684
|
-
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
|
685
|
-
</dependentAssembly>
|
686
|
-
</assemblyBinding>
|
687
|
-
</runtime>
|
688
|
-
</configuration>
|
689
|
-
""")
|
690
|
-
]
|
691
|
-
);
|
692
|
-
}
|
693
|
-
|
694
|
-
[Fact]
|
695
|
-
public async Task BindingRedirectIsAddedForUpdatedPackage()
|
696
|
-
{
|
697
|
-
await TestUpdateForProject("Some.Package", "7.0.1", "13.0.1",
|
698
|
-
packages:
|
699
|
-
[
|
700
|
-
MockNuGetPackage.CreatePackageWithAssembly("Some.Package", "7.0.1", "net45", "7.0.0.0"),
|
701
|
-
MockNuGetPackage.CreatePackageWithAssembly("Some.Package", "13.0.1", "net45", "13.0.0.0"),
|
702
|
-
MockNuGetPackage.CreatePackageWithAssembly("Unrelated.Package", "1.2.3", "net45","1.2.0.0"),
|
703
|
-
],
|
704
|
-
projectContents: """
|
705
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
706
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
707
|
-
<PropertyGroup>
|
708
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
709
|
-
</PropertyGroup>
|
710
|
-
<ItemGroup>
|
711
|
-
<None Include="packages.config" />
|
712
|
-
</ItemGroup>
|
713
|
-
<ItemGroup>
|
714
|
-
<None Include="app.config" />
|
715
|
-
</ItemGroup>
|
716
|
-
<ItemGroup>
|
717
|
-
<Reference Include="Some.Package, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null">
|
718
|
-
<HintPath>packages\Some.Package.7.0.1\lib\net45\Some.Package.dll</HintPath>
|
719
|
-
<Private>True</Private>
|
720
|
-
</Reference>
|
721
|
-
<Reference Include="Unrelated.Package, Version=1.2.0.0, Culture=neutral, PublicKeyToken=null">
|
722
|
-
<HintPath>packages\Unrelated.Package.1.2.3\lib\net45\Unrelated.Package.dll</HintPath>
|
723
|
-
<Private>True</Private>
|
724
|
-
</Reference>
|
725
|
-
</ItemGroup>
|
726
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
727
|
-
</Project>
|
728
|
-
""",
|
729
|
-
packagesConfigContents: """
|
730
|
-
<packages>
|
731
|
-
<package id="Some.Package" version="7.0.1" targetFramework="net45" />
|
732
|
-
</packages>
|
733
|
-
""",
|
734
|
-
additionalFiles:
|
735
|
-
[
|
736
|
-
("app.config", """
|
737
|
-
<configuration>
|
738
|
-
<runtime />
|
739
|
-
</configuration>
|
740
|
-
""")
|
741
|
-
],
|
742
|
-
expectedProjectContents: """
|
743
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
744
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
745
|
-
<PropertyGroup>
|
746
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
747
|
-
</PropertyGroup>
|
748
|
-
<ItemGroup>
|
749
|
-
<None Include="packages.config" />
|
750
|
-
</ItemGroup>
|
751
|
-
<ItemGroup>
|
752
|
-
<None Include="app.config" />
|
753
|
-
</ItemGroup>
|
754
|
-
<ItemGroup>
|
755
|
-
<Reference Include="Some.Package, Version=13.0.0.0, Culture=neutral, PublicKeyToken=null">
|
756
|
-
<HintPath>packages\Some.Package.13.0.1\lib\net45\Some.Package.dll</HintPath>
|
757
|
-
<Private>True</Private>
|
758
|
-
</Reference>
|
759
|
-
<Reference Include="Unrelated.Package, Version=1.2.0.0, Culture=neutral, PublicKeyToken=null">
|
760
|
-
<HintPath>packages\Unrelated.Package.1.2.3\lib\net45\Unrelated.Package.dll</HintPath>
|
761
|
-
<Private>True</Private>
|
762
|
-
</Reference>
|
763
|
-
</ItemGroup>
|
764
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
765
|
-
</Project>
|
766
|
-
""",
|
767
|
-
expectedPackagesConfigContents: """
|
768
|
-
<?xml version="1.0" encoding="utf-8"?>
|
769
|
-
<packages>
|
770
|
-
<package id="Some.Package" version="13.0.1" targetFramework="net45" />
|
771
|
-
</packages>
|
772
|
-
""",
|
773
|
-
additionalFilesExpected:
|
774
|
-
[
|
775
|
-
("app.config", """
|
776
|
-
<configuration>
|
777
|
-
<runtime>
|
778
|
-
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
779
|
-
<dependentAssembly>
|
780
|
-
<assemblyIdentity name="Some.Package" publicKeyToken="null" culture="neutral" />
|
781
|
-
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
|
782
|
-
</dependentAssembly>
|
783
|
-
</assemblyBinding>
|
784
|
-
</runtime>
|
785
|
-
</configuration>
|
786
|
-
""")
|
787
|
-
]
|
788
|
-
);
|
789
|
-
}
|
790
|
-
|
791
|
-
// the xml can take various shapes and they're all formatted, so we need very specific values here
|
792
|
-
[Theory]
|
793
|
-
[InlineData("<Content Include=\"web.config\" />")]
|
794
|
-
[InlineData("<Content Include=\"web.config\">\n </Content>")]
|
795
|
-
[InlineData("<Content Include=\"web.config\">\n <SubType>Designer</SubType>\n </Content>")]
|
796
|
-
public async Task UpdateBindingRedirectInWebConfig(string webConfigXml)
|
797
|
-
{
|
798
|
-
await TestUpdateForProject("Some.Package", "7.0.1", "13.0.1",
|
799
|
-
packages:
|
800
|
-
[
|
801
|
-
MockNuGetPackage.CreatePackageWithAssembly("Some.Package", "7.0.1", "net45", "7.0.0.0"),
|
802
|
-
MockNuGetPackage.CreatePackageWithAssembly("Some.Package", "13.0.1", "net45", "13.0.0.0"),
|
803
|
-
],
|
804
|
-
projectContents: $$"""
|
805
|
-
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
806
|
-
<PropertyGroup>
|
807
|
-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
808
|
-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
809
|
-
<ProductVersion>
|
810
|
-
</ProductVersion>
|
811
|
-
<SchemaVersion>2.0</SchemaVersion>
|
812
|
-
<ProjectGuid>ac83fc79-b637-445b-acb0-9be238ad077f</ProjectGuid>
|
813
|
-
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
814
|
-
<OutputType>Library</OutputType>
|
815
|
-
<AppDesignerFolder>Properties</AppDesignerFolder>
|
816
|
-
<RootNamespace>TestProject</RootNamespace>
|
817
|
-
<AssemblyName>TestProject</AssemblyName>
|
818
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
819
|
-
</PropertyGroup>
|
820
|
-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
821
|
-
<DebugSymbols>true</DebugSymbols>
|
822
|
-
<DebugType>full</DebugType>
|
823
|
-
<Optimize>false</Optimize>
|
824
|
-
<OutputPath>bin\</OutputPath>
|
825
|
-
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
826
|
-
<ErrorReport>prompt</ErrorReport>
|
827
|
-
<WarningLevel>4</WarningLevel>
|
828
|
-
</PropertyGroup>
|
829
|
-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
830
|
-
<DebugType>pdbonly</DebugType>
|
831
|
-
<Optimize>true</Optimize>
|
832
|
-
<OutputPath>bin\</OutputPath>
|
833
|
-
<DefineConstants>TRACE</DefineConstants>
|
834
|
-
<ErrorReport>prompt</ErrorReport>
|
835
|
-
<WarningLevel>4</WarningLevel>
|
836
|
-
</PropertyGroup>
|
837
|
-
<ItemGroup>
|
838
|
-
<Reference Include="Microsoft.CSharp" />
|
839
|
-
<Reference Include="Some.Package, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null">
|
840
|
-
<HintPath>packages\Some.Package.7.0.1\lib\net45\Some.Package.dll</HintPath>
|
841
|
-
<Private>True</Private>
|
842
|
-
</Reference>
|
843
|
-
<Reference Include="System.Web.DynamicData" />
|
844
|
-
<Reference Include="System.Web.Entity" />
|
845
|
-
<Reference Include="System.Web.ApplicationServices" />
|
846
|
-
<Reference Include="System" />
|
847
|
-
<Reference Include="System.Data" />
|
848
|
-
<Reference Include="System.Core" />
|
849
|
-
<Reference Include="System.Data.DataSetExtensions" />
|
850
|
-
<Reference Include="System.Web.Extensions" />
|
851
|
-
<Reference Include="System.Xml.Linq" />
|
852
|
-
<Reference Include="System.Drawing" />
|
853
|
-
<Reference Include="System.Web" />
|
854
|
-
<Reference Include="System.Xml" />
|
855
|
-
<Reference Include="System.Configuration" />
|
856
|
-
<Reference Include="System.Web.Services" />
|
857
|
-
<Reference Include="System.EnterpriseServices" />
|
858
|
-
</ItemGroup>
|
859
|
-
<ItemGroup>
|
860
|
-
<None Include="packages.config" />
|
861
|
-
{{webConfigXml}}
|
862
|
-
<Content Include="web.Debug.config">
|
863
|
-
<DependentUpon>web.config</DependentUpon>
|
864
|
-
</Content>
|
865
|
-
<Content Include="web.Release.config">
|
866
|
-
<DependentUpon>web.config</DependentUpon>
|
867
|
-
</Content>
|
868
|
-
</ItemGroup>
|
869
|
-
<ItemGroup>
|
870
|
-
<Compile Include="Properties\AssemblyInfo.cs" />
|
871
|
-
</ItemGroup>
|
872
|
-
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
873
|
-
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
|
874
|
-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
875
|
-
Other similar extension points exist, see Microsoft.Common.targets.
|
876
|
-
<Target Name="BeforeBuild">
|
877
|
-
</Target>
|
878
|
-
<Target Name="AfterBuild">
|
879
|
-
</Target>
|
880
|
-
-->
|
881
|
-
</Project>
|
882
|
-
""",
|
883
|
-
packagesConfigContents: """
|
884
|
-
<packages>
|
885
|
-
<package id="Some.Package" version="7.0.1" targetFramework="net45" />
|
886
|
-
</packages>
|
887
|
-
""",
|
888
|
-
additionalFiles:
|
889
|
-
[
|
890
|
-
("web.config", """
|
891
|
-
<configuration>
|
892
|
-
<runtime>
|
893
|
-
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
894
|
-
<dependentAssembly>
|
895
|
-
<assemblyIdentity name="Some.Package" publicKeyToken="null" culture="neutral" />
|
896
|
-
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
897
|
-
</dependentAssembly>
|
898
|
-
</assemblyBinding>
|
899
|
-
</runtime>
|
900
|
-
</configuration>
|
901
|
-
""")
|
902
|
-
],
|
903
|
-
expectedProjectContents: $$"""
|
904
|
-
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
905
|
-
<PropertyGroup>
|
906
|
-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
907
|
-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
908
|
-
<ProductVersion>
|
909
|
-
</ProductVersion>
|
910
|
-
<SchemaVersion>2.0</SchemaVersion>
|
911
|
-
<ProjectGuid>ac83fc79-b637-445b-acb0-9be238ad077f</ProjectGuid>
|
912
|
-
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
913
|
-
<OutputType>Library</OutputType>
|
914
|
-
<AppDesignerFolder>Properties</AppDesignerFolder>
|
915
|
-
<RootNamespace>TestProject</RootNamespace>
|
916
|
-
<AssemblyName>TestProject</AssemblyName>
|
917
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
918
|
-
</PropertyGroup>
|
919
|
-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
920
|
-
<DebugSymbols>true</DebugSymbols>
|
921
|
-
<DebugType>full</DebugType>
|
922
|
-
<Optimize>false</Optimize>
|
923
|
-
<OutputPath>bin\</OutputPath>
|
924
|
-
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
925
|
-
<ErrorReport>prompt</ErrorReport>
|
926
|
-
<WarningLevel>4</WarningLevel>
|
927
|
-
</PropertyGroup>
|
928
|
-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
929
|
-
<DebugType>pdbonly</DebugType>
|
930
|
-
<Optimize>true</Optimize>
|
931
|
-
<OutputPath>bin\</OutputPath>
|
932
|
-
<DefineConstants>TRACE</DefineConstants>
|
933
|
-
<ErrorReport>prompt</ErrorReport>
|
934
|
-
<WarningLevel>4</WarningLevel>
|
935
|
-
</PropertyGroup>
|
936
|
-
<ItemGroup>
|
937
|
-
<Reference Include="Microsoft.CSharp" />
|
938
|
-
<Reference Include="Some.Package, Version=13.0.0.0, Culture=neutral, PublicKeyToken=null">
|
939
|
-
<HintPath>packages\Some.Package.13.0.1\lib\net45\Some.Package.dll</HintPath>
|
940
|
-
<Private>True</Private>
|
941
|
-
</Reference>
|
942
|
-
<Reference Include="System.Web.DynamicData" />
|
943
|
-
<Reference Include="System.Web.Entity" />
|
944
|
-
<Reference Include="System.Web.ApplicationServices" />
|
945
|
-
<Reference Include="System" />
|
946
|
-
<Reference Include="System.Data" />
|
947
|
-
<Reference Include="System.Core" />
|
948
|
-
<Reference Include="System.Data.DataSetExtensions" />
|
949
|
-
<Reference Include="System.Web.Extensions" />
|
950
|
-
<Reference Include="System.Xml.Linq" />
|
951
|
-
<Reference Include="System.Drawing" />
|
952
|
-
<Reference Include="System.Web" />
|
953
|
-
<Reference Include="System.Xml" />
|
954
|
-
<Reference Include="System.Configuration" />
|
955
|
-
<Reference Include="System.Web.Services" />
|
956
|
-
<Reference Include="System.EnterpriseServices" />
|
957
|
-
</ItemGroup>
|
958
|
-
<ItemGroup>
|
959
|
-
<None Include="packages.config" />
|
960
|
-
{{webConfigXml}}
|
961
|
-
<Content Include="web.Debug.config">
|
962
|
-
<DependentUpon>web.config</DependentUpon>
|
963
|
-
</Content>
|
964
|
-
<Content Include="web.Release.config">
|
965
|
-
<DependentUpon>web.config</DependentUpon>
|
966
|
-
</Content>
|
967
|
-
</ItemGroup>
|
968
|
-
<ItemGroup>
|
969
|
-
<Compile Include="Properties\AssemblyInfo.cs" />
|
970
|
-
</ItemGroup>
|
971
|
-
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
972
|
-
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
|
973
|
-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
974
|
-
Other similar extension points exist, see Microsoft.Common.targets.
|
975
|
-
<Target Name="BeforeBuild">
|
976
|
-
</Target>
|
977
|
-
<Target Name="AfterBuild">
|
978
|
-
</Target>
|
979
|
-
-->
|
980
|
-
</Project>
|
981
|
-
""",
|
982
|
-
expectedPackagesConfigContents: """
|
983
|
-
<?xml version="1.0" encoding="utf-8"?>
|
984
|
-
<packages>
|
985
|
-
<package id="Some.Package" version="13.0.1" targetFramework="net45" />
|
986
|
-
</packages>
|
987
|
-
""",
|
988
|
-
additionalFilesExpected:
|
989
|
-
[
|
990
|
-
("web.config", """
|
991
|
-
<configuration>
|
992
|
-
<runtime>
|
993
|
-
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
994
|
-
<dependentAssembly>
|
995
|
-
<assemblyIdentity name="Some.Package" publicKeyToken="null" culture="neutral" />
|
996
|
-
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
|
997
|
-
</dependentAssembly>
|
998
|
-
</assemblyBinding>
|
999
|
-
</runtime>
|
1000
|
-
</configuration>
|
1001
|
-
""")
|
1002
|
-
]
|
1003
|
-
);
|
1004
|
-
}
|
1005
|
-
|
1006
|
-
[Fact]
|
1007
|
-
public async Task AddsBindingRedirectInWebConfig()
|
1008
|
-
{
|
1009
|
-
await TestUpdateForProject("Some.Package", "7.0.1", "13.0.1",
|
1010
|
-
packages:
|
1011
|
-
[
|
1012
|
-
MockNuGetPackage.CreatePackageWithAssembly("Some.Package", "7.0.1", "net45", "7.0.0.0"),
|
1013
|
-
MockNuGetPackage.CreatePackageWithAssembly("Some.Package", "13.0.1", "net45", "13.0.0.0"),
|
1014
|
-
],
|
1015
|
-
projectContents: """
|
1016
|
-
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
1017
|
-
<PropertyGroup>
|
1018
|
-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
1019
|
-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
1020
|
-
<ProductVersion>
|
1021
|
-
</ProductVersion>
|
1022
|
-
<SchemaVersion>2.0</SchemaVersion>
|
1023
|
-
<ProjectGuid>ac83fc79-b637-445b-acb0-9be238ad077f</ProjectGuid>
|
1024
|
-
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
1025
|
-
<OutputType>Library</OutputType>
|
1026
|
-
<AppDesignerFolder>Properties</AppDesignerFolder>
|
1027
|
-
<RootNamespace>TestProject</RootNamespace>
|
1028
|
-
<AssemblyName>TestProject</AssemblyName>
|
1029
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
1030
|
-
</PropertyGroup>
|
1031
|
-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
1032
|
-
<DebugSymbols>true</DebugSymbols>
|
1033
|
-
<DebugType>full</DebugType>
|
1034
|
-
<Optimize>false</Optimize>
|
1035
|
-
<OutputPath>bin\</OutputPath>
|
1036
|
-
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
1037
|
-
<ErrorReport>prompt</ErrorReport>
|
1038
|
-
<WarningLevel>4</WarningLevel>
|
1039
|
-
</PropertyGroup>
|
1040
|
-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
1041
|
-
<DebugType>pdbonly</DebugType>
|
1042
|
-
<Optimize>true</Optimize>
|
1043
|
-
<OutputPath>bin\</OutputPath>
|
1044
|
-
<DefineConstants>TRACE</DefineConstants>
|
1045
|
-
<ErrorReport>prompt</ErrorReport>
|
1046
|
-
<WarningLevel>4</WarningLevel>
|
1047
|
-
</PropertyGroup>
|
1048
|
-
<ItemGroup>
|
1049
|
-
<Reference Include="Microsoft.CSharp" />
|
1050
|
-
<Reference Include="Some.Package, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null">
|
1051
|
-
<HintPath>packages\Some.Package.7.0.1\lib\net45\Some.Package.dll</HintPath>
|
1052
|
-
<Private>True</Private>
|
1053
|
-
</Reference>
|
1054
|
-
<Reference Include="System.Web.DynamicData" />
|
1055
|
-
<Reference Include="System.Web.Entity" />
|
1056
|
-
<Reference Include="System.Web.ApplicationServices" />
|
1057
|
-
<Reference Include="System" />
|
1058
|
-
<Reference Include="System.Data" />
|
1059
|
-
<Reference Include="System.Core" />
|
1060
|
-
<Reference Include="System.Data.DataSetExtensions" />
|
1061
|
-
<Reference Include="System.Web.Extensions" />
|
1062
|
-
<Reference Include="System.Xml.Linq" />
|
1063
|
-
<Reference Include="System.Drawing" />
|
1064
|
-
<Reference Include="System.Web" />
|
1065
|
-
<Reference Include="System.Xml" />
|
1066
|
-
<Reference Include="System.Configuration" />
|
1067
|
-
<Reference Include="System.Web.Services" />
|
1068
|
-
<Reference Include="System.EnterpriseServices" />
|
1069
|
-
</ItemGroup>
|
1070
|
-
<ItemGroup>
|
1071
|
-
<None Include="packages.config" />
|
1072
|
-
<Content Include="web.config" />
|
1073
|
-
<Content Include="web.Debug.config">
|
1074
|
-
<DependentUpon>web.config</DependentUpon>
|
1075
|
-
</Content>
|
1076
|
-
<Content Include="web.Release.config">
|
1077
|
-
<DependentUpon>web.config</DependentUpon>
|
1078
|
-
</Content>
|
1079
|
-
</ItemGroup>
|
1080
|
-
<ItemGroup>
|
1081
|
-
<Compile Include="Properties\AssemblyInfo.cs" />
|
1082
|
-
</ItemGroup>
|
1083
|
-
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
1084
|
-
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
|
1085
|
-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
1086
|
-
Other similar extension points exist, see Microsoft.Common.targets.
|
1087
|
-
<Target Name="BeforeBuild">
|
1088
|
-
</Target>
|
1089
|
-
<Target Name="AfterBuild">
|
1090
|
-
</Target>
|
1091
|
-
-->
|
1092
|
-
</Project>
|
1093
|
-
""",
|
1094
|
-
packagesConfigContents: """
|
1095
|
-
<packages>
|
1096
|
-
<package id="Some.Package" version="7.0.1" targetFramework="net45" />
|
1097
|
-
</packages>
|
1098
|
-
""",
|
1099
|
-
additionalFiles:
|
1100
|
-
[
|
1101
|
-
("web.config", """
|
1102
|
-
<configuration>
|
1103
|
-
<runtime>
|
1104
|
-
</runtime>
|
1105
|
-
</configuration>
|
1106
|
-
""")
|
1107
|
-
],
|
1108
|
-
expectedProjectContents: """
|
1109
|
-
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
1110
|
-
<PropertyGroup>
|
1111
|
-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
1112
|
-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
1113
|
-
<ProductVersion>
|
1114
|
-
</ProductVersion>
|
1115
|
-
<SchemaVersion>2.0</SchemaVersion>
|
1116
|
-
<ProjectGuid>ac83fc79-b637-445b-acb0-9be238ad077f</ProjectGuid>
|
1117
|
-
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
1118
|
-
<OutputType>Library</OutputType>
|
1119
|
-
<AppDesignerFolder>Properties</AppDesignerFolder>
|
1120
|
-
<RootNamespace>TestProject</RootNamespace>
|
1121
|
-
<AssemblyName>TestProject</AssemblyName>
|
1122
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
1123
|
-
</PropertyGroup>
|
1124
|
-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
1125
|
-
<DebugSymbols>true</DebugSymbols>
|
1126
|
-
<DebugType>full</DebugType>
|
1127
|
-
<Optimize>false</Optimize>
|
1128
|
-
<OutputPath>bin\</OutputPath>
|
1129
|
-
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
1130
|
-
<ErrorReport>prompt</ErrorReport>
|
1131
|
-
<WarningLevel>4</WarningLevel>
|
1132
|
-
</PropertyGroup>
|
1133
|
-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
1134
|
-
<DebugType>pdbonly</DebugType>
|
1135
|
-
<Optimize>true</Optimize>
|
1136
|
-
<OutputPath>bin\</OutputPath>
|
1137
|
-
<DefineConstants>TRACE</DefineConstants>
|
1138
|
-
<ErrorReport>prompt</ErrorReport>
|
1139
|
-
<WarningLevel>4</WarningLevel>
|
1140
|
-
</PropertyGroup>
|
1141
|
-
<ItemGroup>
|
1142
|
-
<Reference Include="Microsoft.CSharp" />
|
1143
|
-
<Reference Include="Some.Package, Version=13.0.0.0, Culture=neutral, PublicKeyToken=null">
|
1144
|
-
<HintPath>packages\Some.Package.13.0.1\lib\net45\Some.Package.dll</HintPath>
|
1145
|
-
<Private>True</Private>
|
1146
|
-
</Reference>
|
1147
|
-
<Reference Include="System.Web.DynamicData" />
|
1148
|
-
<Reference Include="System.Web.Entity" />
|
1149
|
-
<Reference Include="System.Web.ApplicationServices" />
|
1150
|
-
<Reference Include="System" />
|
1151
|
-
<Reference Include="System.Data" />
|
1152
|
-
<Reference Include="System.Core" />
|
1153
|
-
<Reference Include="System.Data.DataSetExtensions" />
|
1154
|
-
<Reference Include="System.Web.Extensions" />
|
1155
|
-
<Reference Include="System.Xml.Linq" />
|
1156
|
-
<Reference Include="System.Drawing" />
|
1157
|
-
<Reference Include="System.Web" />
|
1158
|
-
<Reference Include="System.Xml" />
|
1159
|
-
<Reference Include="System.Configuration" />
|
1160
|
-
<Reference Include="System.Web.Services" />
|
1161
|
-
<Reference Include="System.EnterpriseServices" />
|
1162
|
-
</ItemGroup>
|
1163
|
-
<ItemGroup>
|
1164
|
-
<None Include="packages.config" />
|
1165
|
-
<Content Include="web.config" />
|
1166
|
-
<Content Include="web.Debug.config">
|
1167
|
-
<DependentUpon>web.config</DependentUpon>
|
1168
|
-
</Content>
|
1169
|
-
<Content Include="web.Release.config">
|
1170
|
-
<DependentUpon>web.config</DependentUpon>
|
1171
|
-
</Content>
|
1172
|
-
</ItemGroup>
|
1173
|
-
<ItemGroup>
|
1174
|
-
<Compile Include="Properties\AssemblyInfo.cs" />
|
1175
|
-
</ItemGroup>
|
1176
|
-
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
1177
|
-
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
|
1178
|
-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
1179
|
-
Other similar extension points exist, see Microsoft.Common.targets.
|
1180
|
-
<Target Name="BeforeBuild">
|
1181
|
-
</Target>
|
1182
|
-
<Target Name="AfterBuild">
|
1183
|
-
</Target>
|
1184
|
-
-->
|
1185
|
-
</Project>
|
1186
|
-
""",
|
1187
|
-
expectedPackagesConfigContents: """
|
1188
|
-
<?xml version="1.0" encoding="utf-8"?>
|
1189
|
-
<packages>
|
1190
|
-
<package id="Some.Package" version="13.0.1" targetFramework="net45" />
|
1191
|
-
</packages>
|
1192
|
-
""",
|
1193
|
-
additionalFilesExpected:
|
1194
|
-
[
|
1195
|
-
("web.config", """
|
1196
|
-
<configuration>
|
1197
|
-
<runtime>
|
1198
|
-
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
1199
|
-
<dependentAssembly>
|
1200
|
-
<assemblyIdentity name="Some.Package" publicKeyToken="null" culture="neutral" />
|
1201
|
-
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
|
1202
|
-
</dependentAssembly>
|
1203
|
-
</assemblyBinding>
|
1204
|
-
</runtime>
|
1205
|
-
</configuration>
|
1206
|
-
""")
|
1207
|
-
]
|
1208
|
-
);
|
1209
|
-
}
|
1210
|
-
|
1211
|
-
[Fact]
|
1212
|
-
public async Task UpdateBindingRedirect_UnrelatedAssemblyReferenceWithMissingPublicKeyTokenAttribute()
|
1213
|
-
{
|
1214
|
-
await TestUpdateForProject("Some.Package", "7.0.1", "13.0.1",
|
1215
|
-
packages:
|
1216
|
-
[
|
1217
|
-
MockNuGetPackage.CreatePackageWithAssembly("Some.Package", "7.0.1", "net45", "7.0.0.0"),
|
1218
|
-
MockNuGetPackage.CreatePackageWithAssembly("Some.Package", "13.0.1", "net45", "13.0.0.0"),
|
1219
|
-
],
|
1220
|
-
projectContents: """
|
1221
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
1222
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
1223
|
-
<PropertyGroup>
|
1224
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
1225
|
-
</PropertyGroup>
|
1226
|
-
<ItemGroup>
|
1227
|
-
<None Include="packages.config" />
|
1228
|
-
</ItemGroup>
|
1229
|
-
<ItemGroup>
|
1230
|
-
<None Include="app.config" />
|
1231
|
-
</ItemGroup>
|
1232
|
-
<ItemGroup>
|
1233
|
-
<Reference Include="Some.Package, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null">
|
1234
|
-
<HintPath>packages\Some.Package.7.0.1\lib\net45\Some.Package.dll</HintPath>
|
1235
|
-
<Private>True</Private>
|
1236
|
-
</Reference>
|
1237
|
-
<Reference Include="Some.Unrelated.Package, Version=1.0.0.0, Culture=neutral">
|
1238
|
-
<HintPath>packages\Some.Unrelated.Package.1.0.0\lib\net45\Some.Unrelated.Package.dll</HintPath>
|
1239
|
-
</Reference>
|
1240
|
-
</ItemGroup>
|
1241
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
1242
|
-
</Project>
|
1243
|
-
""",
|
1244
|
-
packagesConfigContents: """
|
1245
|
-
<packages>
|
1246
|
-
<package id="Some.Package" version="7.0.1" targetFramework="net45" />
|
1247
|
-
</packages>
|
1248
|
-
""",
|
1249
|
-
additionalFiles:
|
1250
|
-
[
|
1251
|
-
("app.config", """
|
1252
|
-
<configuration>
|
1253
|
-
<runtime>
|
1254
|
-
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
1255
|
-
<dependentAssembly>
|
1256
|
-
<assemblyIdentity name="Some.Package" publicKeyToken="null" culture="neutral" />
|
1257
|
-
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
1258
|
-
</dependentAssembly>
|
1259
|
-
<dependentAssembly>
|
1260
|
-
<assemblyIdentity name="Some.Unrelated.Package" culture="neutral" />
|
1261
|
-
<bindingRedirect oldVersion="0.0.0.0-1.0.0.0" newVersion="1.0.0.0" />
|
1262
|
-
</dependentAssembly>
|
1263
|
-
</assemblyBinding>
|
1264
|
-
</runtime>
|
1265
|
-
</configuration>
|
1266
|
-
""")
|
1267
|
-
],
|
1268
|
-
expectedProjectContents: """
|
1269
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
1270
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
1271
|
-
<PropertyGroup>
|
1272
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
1273
|
-
</PropertyGroup>
|
1274
|
-
<ItemGroup>
|
1275
|
-
<None Include="packages.config" />
|
1276
|
-
</ItemGroup>
|
1277
|
-
<ItemGroup>
|
1278
|
-
<None Include="app.config" />
|
1279
|
-
</ItemGroup>
|
1280
|
-
<ItemGroup>
|
1281
|
-
<Reference Include="Some.Package, Version=13.0.0.0, Culture=neutral, PublicKeyToken=null">
|
1282
|
-
<HintPath>packages\Some.Package.13.0.1\lib\net45\Some.Package.dll</HintPath>
|
1283
|
-
<Private>True</Private>
|
1284
|
-
</Reference>
|
1285
|
-
<Reference Include="Some.Unrelated.Package, Version=1.0.0.0, Culture=neutral">
|
1286
|
-
<HintPath>packages\Some.Unrelated.Package.1.0.0\lib\net45\Some.Unrelated.Package.dll</HintPath>
|
1287
|
-
</Reference>
|
1288
|
-
</ItemGroup>
|
1289
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
1290
|
-
</Project>
|
1291
|
-
""",
|
1292
|
-
expectedPackagesConfigContents: """
|
1293
|
-
<?xml version="1.0" encoding="utf-8"?>
|
1294
|
-
<packages>
|
1295
|
-
<package id="Some.Package" version="13.0.1" targetFramework="net45" />
|
1296
|
-
</packages>
|
1297
|
-
""",
|
1298
|
-
additionalFilesExpected:
|
1299
|
-
[
|
1300
|
-
("app.config", """
|
1301
|
-
<configuration>
|
1302
|
-
<runtime>
|
1303
|
-
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
1304
|
-
<dependentAssembly>
|
1305
|
-
<assemblyIdentity name="Some.Package" publicKeyToken="null" culture="neutral" />
|
1306
|
-
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
|
1307
|
-
</dependentAssembly>
|
1308
|
-
<dependentAssembly>
|
1309
|
-
<assemblyIdentity name="Some.Unrelated.Package" culture="neutral" />
|
1310
|
-
<bindingRedirect oldVersion="0.0.0.0-1.0.0.0" newVersion="1.0.0.0" />
|
1311
|
-
</dependentAssembly>
|
1312
|
-
</assemblyBinding>
|
1313
|
-
</runtime>
|
1314
|
-
</configuration>
|
1315
|
-
""")
|
1316
|
-
]
|
1317
|
-
);
|
1318
|
-
}
|
1319
|
-
|
1320
|
-
[Fact]
|
1321
|
-
public async Task UpdateBindingRedirect_UnrelatedAssemblyReferenceWithMissingCultureAttribute()
|
1322
|
-
{
|
1323
|
-
await TestUpdateForProject("Some.Package", "7.0.1", "13.0.1",
|
1324
|
-
packages:
|
1325
|
-
[
|
1326
|
-
MockNuGetPackage.CreatePackageWithAssembly("Some.Package", "7.0.1", "net45", "7.0.0.0"),
|
1327
|
-
MockNuGetPackage.CreatePackageWithAssembly("Some.Package", "13.0.1", "net45", "13.0.0.0"),
|
1328
|
-
],
|
1329
|
-
projectContents: """
|
1330
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
1331
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
1332
|
-
<PropertyGroup>
|
1333
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
1334
|
-
</PropertyGroup>
|
1335
|
-
<ItemGroup>
|
1336
|
-
<None Include="packages.config" />
|
1337
|
-
</ItemGroup>
|
1338
|
-
<ItemGroup>
|
1339
|
-
<None Include="app.config" />
|
1340
|
-
</ItemGroup>
|
1341
|
-
<ItemGroup>
|
1342
|
-
<Reference Include="Some.Package, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null">
|
1343
|
-
<HintPath>packages\Some.Package.7.0.1\lib\net45\Some.Package.dll</HintPath>
|
1344
|
-
<Private>True</Private>
|
1345
|
-
</Reference>
|
1346
|
-
<Reference Include="Some.Unrelated.Package, Version=1.0.0.0, PublicKeyToken=null">
|
1347
|
-
<HintPath>packages\Some.Unrelated.Package.1.0.0\lib\net45\Some.Unrelated.Package.dll</HintPath>
|
1348
|
-
</Reference>
|
1349
|
-
</ItemGroup>
|
1350
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
1351
|
-
</Project>
|
1352
|
-
""",
|
1353
|
-
packagesConfigContents: """
|
1354
|
-
<packages>
|
1355
|
-
<package id="Some.Package" version="7.0.1" targetFramework="net45" />
|
1356
|
-
</packages>
|
1357
|
-
""",
|
1358
|
-
additionalFiles:
|
1359
|
-
[
|
1360
|
-
("app.config", """
|
1361
|
-
<configuration>
|
1362
|
-
<runtime>
|
1363
|
-
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
1364
|
-
<dependentAssembly>
|
1365
|
-
<assemblyIdentity name="Some.Package" publicKeyToken="null" culture="neutral" />
|
1366
|
-
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
1367
|
-
</dependentAssembly>
|
1368
|
-
<dependentAssembly>
|
1369
|
-
<assemblyIdentity name="Some.Unrelated.Package" publicKeyToken="null" />
|
1370
|
-
<bindingRedirect oldVersion="0.0.0.0-1.0.0.0" newVersion="1.0.0.0" />
|
1371
|
-
</dependentAssembly>
|
1372
|
-
</assemblyBinding>
|
1373
|
-
</runtime>
|
1374
|
-
</configuration>
|
1375
|
-
""")
|
1376
|
-
],
|
1377
|
-
expectedProjectContents: """
|
1378
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
1379
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
1380
|
-
<PropertyGroup>
|
1381
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
1382
|
-
</PropertyGroup>
|
1383
|
-
<ItemGroup>
|
1384
|
-
<None Include="packages.config" />
|
1385
|
-
</ItemGroup>
|
1386
|
-
<ItemGroup>
|
1387
|
-
<None Include="app.config" />
|
1388
|
-
</ItemGroup>
|
1389
|
-
<ItemGroup>
|
1390
|
-
<Reference Include="Some.Package, Version=13.0.0.0, Culture=neutral, PublicKeyToken=null">
|
1391
|
-
<HintPath>packages\Some.Package.13.0.1\lib\net45\Some.Package.dll</HintPath>
|
1392
|
-
<Private>True</Private>
|
1393
|
-
</Reference>
|
1394
|
-
<Reference Include="Some.Unrelated.Package, Version=1.0.0.0, PublicKeyToken=null">
|
1395
|
-
<HintPath>packages\Some.Unrelated.Package.1.0.0\lib\net45\Some.Unrelated.Package.dll</HintPath>
|
1396
|
-
</Reference>
|
1397
|
-
</ItemGroup>
|
1398
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
1399
|
-
</Project>
|
1400
|
-
""",
|
1401
|
-
expectedPackagesConfigContents: """
|
1402
|
-
<?xml version="1.0" encoding="utf-8"?>
|
1403
|
-
<packages>
|
1404
|
-
<package id="Some.Package" version="13.0.1" targetFramework="net45" />
|
1405
|
-
</packages>
|
1406
|
-
""",
|
1407
|
-
additionalFilesExpected:
|
1408
|
-
[
|
1409
|
-
("app.config", """
|
1410
|
-
<configuration>
|
1411
|
-
<runtime>
|
1412
|
-
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
1413
|
-
<dependentAssembly>
|
1414
|
-
<assemblyIdentity name="Some.Package" publicKeyToken="null" culture="neutral" />
|
1415
|
-
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
|
1416
|
-
</dependentAssembly>
|
1417
|
-
<dependentAssembly>
|
1418
|
-
<assemblyIdentity name="Some.Unrelated.Package" publicKeyToken="null" />
|
1419
|
-
<bindingRedirect oldVersion="0.0.0.0-1.0.0.0" newVersion="1.0.0.0" />
|
1420
|
-
</dependentAssembly>
|
1421
|
-
</assemblyBinding>
|
1422
|
-
</runtime>
|
1423
|
-
</configuration>
|
1424
|
-
""")
|
1425
|
-
]
|
1426
|
-
);
|
1427
|
-
}
|
1428
|
-
|
1429
|
-
[Fact]
|
1430
|
-
public async Task UpdateBindingRedirect_DuplicateRedirectsForTheSameAssemblyAreRemoved()
|
1431
|
-
{
|
1432
|
-
await TestUpdateForProject("Some.Package", "7.0.1", "13.0.1",
|
1433
|
-
packages:
|
1434
|
-
[
|
1435
|
-
MockNuGetPackage.CreatePackageWithAssembly("Some.Package", "7.0.1", "net45", "7.0.0.0"),
|
1436
|
-
MockNuGetPackage.CreatePackageWithAssembly("Some.Package", "13.0.1", "net45", "13.0.0.0"),
|
1437
|
-
],
|
1438
|
-
projectContents: """
|
1439
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
1440
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
1441
|
-
<PropertyGroup>
|
1442
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
1443
|
-
</PropertyGroup>
|
1444
|
-
<ItemGroup>
|
1445
|
-
<None Include="packages.config" />
|
1446
|
-
</ItemGroup>
|
1447
|
-
<ItemGroup>
|
1448
|
-
<None Include="app.config" />
|
1449
|
-
</ItemGroup>
|
1450
|
-
<ItemGroup>
|
1451
|
-
<Reference Include="Some.Package, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null">
|
1452
|
-
<HintPath>packages\Some.Package.7.0.1\lib\net45\Some.Package.dll</HintPath>
|
1453
|
-
<Private>True</Private>
|
1454
|
-
</Reference>
|
1455
|
-
</ItemGroup>
|
1456
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
1457
|
-
</Project>
|
1458
|
-
""",
|
1459
|
-
packagesConfigContents: """
|
1460
|
-
<packages>
|
1461
|
-
<package id="Some.Package" version="7.0.1" targetFramework="net45" />
|
1462
|
-
</packages>
|
1463
|
-
""",
|
1464
|
-
additionalFiles:
|
1465
|
-
[
|
1466
|
-
("app.config", """
|
1467
|
-
<configuration>
|
1468
|
-
<runtime>
|
1469
|
-
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
1470
|
-
<dependentAssembly>
|
1471
|
-
<assemblyIdentity name="Some.Package" publicKeyToken="null" culture="neutral" />
|
1472
|
-
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
1473
|
-
</dependentAssembly>
|
1474
|
-
<dependentAssembly>
|
1475
|
-
<assemblyIdentity name="Some.Package" publicKeyToken="null" culture="neutral" />
|
1476
|
-
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
1477
|
-
</dependentAssembly>
|
1478
|
-
</assemblyBinding>
|
1479
|
-
</runtime>
|
1480
|
-
</configuration>
|
1481
|
-
""")
|
1482
|
-
],
|
1483
|
-
expectedProjectContents: """
|
1484
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
1485
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
1486
|
-
<PropertyGroup>
|
1487
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
1488
|
-
</PropertyGroup>
|
1489
|
-
<ItemGroup>
|
1490
|
-
<None Include="packages.config" />
|
1491
|
-
</ItemGroup>
|
1492
|
-
<ItemGroup>
|
1493
|
-
<None Include="app.config" />
|
1494
|
-
</ItemGroup>
|
1495
|
-
<ItemGroup>
|
1496
|
-
<Reference Include="Some.Package, Version=13.0.0.0, Culture=neutral, PublicKeyToken=null">
|
1497
|
-
<HintPath>packages\Some.Package.13.0.1\lib\net45\Some.Package.dll</HintPath>
|
1498
|
-
<Private>True</Private>
|
1499
|
-
</Reference>
|
1500
|
-
</ItemGroup>
|
1501
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
1502
|
-
</Project>
|
1503
|
-
""",
|
1504
|
-
expectedPackagesConfigContents: """
|
1505
|
-
<?xml version="1.0" encoding="utf-8"?>
|
1506
|
-
<packages>
|
1507
|
-
<package id="Some.Package" version="13.0.1" targetFramework="net45" />
|
1508
|
-
</packages>
|
1509
|
-
""",
|
1510
|
-
additionalFilesExpected:
|
1511
|
-
[
|
1512
|
-
("app.config", """
|
1513
|
-
<configuration>
|
1514
|
-
<runtime>
|
1515
|
-
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
1516
|
-
<dependentAssembly>
|
1517
|
-
<assemblyIdentity name="Some.Package" publicKeyToken="null" culture="neutral" />
|
1518
|
-
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
|
1519
|
-
</dependentAssembly>
|
1520
|
-
</assemblyBinding>
|
1521
|
-
</runtime>
|
1522
|
-
</configuration>
|
1523
|
-
""")
|
1524
|
-
]
|
1525
|
-
);
|
1526
|
-
}
|
1527
|
-
|
1528
|
-
[Fact]
|
1529
|
-
public async Task UpdateBindingRedirect_ExistingRedirectForAssemblyPublicKeyTokenDiffersByCase()
|
1530
|
-
{
|
1531
|
-
// Generated using "sn -k keypair.snk && sn -p keypair.snk public.snk" then converting public.snk to base64
|
1532
|
-
// https://learn.microsoft.com/en-us/dotnet/standard/assembly/create-public-private-key-pair
|
1533
|
-
var assemblyStrongNamePublicKey = Convert.FromBase64String(
|
1534
|
-
"ACQAAASAAACUAAAABgIAAAAkAABSU0ExAAQAAAEAAQAJJW4hmKpxa9pU0JPDvJ9KqjvfQuMUovGtFjkZ9b0i1KQ/7kqEOjW3Va0eGpU7Kz0qHp14iYQ3SsMzBZU3mZ2Ezeqg+dCVuDk7o2lp++4m1FstHsebtXBetyOzWkneo+3iKSzOQ7bOXj2s5M9umqRPk+yj0ZBILf+HvfAd07iIuQ=="
|
1535
|
-
).ToImmutableArray();
|
1536
|
-
|
1537
|
-
await TestUpdateForProject("Some.Package", "7.0.1", "13.0.1",
|
1538
|
-
packages:
|
1539
|
-
[
|
1540
|
-
MockNuGetPackage.CreatePackageWithAssembly("Some.Package", "7.0.1", "net45", "7.0.0.0", assemblyPublicKey: assemblyStrongNamePublicKey),
|
1541
|
-
MockNuGetPackage.CreatePackageWithAssembly("Some.Package", "13.0.1", "net45", "13.0.0.0", assemblyPublicKey: assemblyStrongNamePublicKey),
|
1542
|
-
],
|
1543
|
-
projectContents: """
|
1544
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
1545
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
1546
|
-
<PropertyGroup>
|
1547
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
1548
|
-
</PropertyGroup>
|
1549
|
-
<ItemGroup>
|
1550
|
-
<None Include="packages.config" />
|
1551
|
-
</ItemGroup>
|
1552
|
-
<ItemGroup>
|
1553
|
-
<None Include="app.config" />
|
1554
|
-
</ItemGroup>
|
1555
|
-
<ItemGroup>
|
1556
|
-
<Reference Include="Some.Package, Version=7.0.0.0, Culture=neutral, PublicKeyToken=13523fc3be375af1">
|
1557
|
-
<HintPath>packages\Some.Package.7.0.1\lib\net45\Some.Package.dll</HintPath>
|
1558
|
-
<Private>True</Private>
|
1559
|
-
</Reference>
|
1560
|
-
</ItemGroup>
|
1561
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
1562
|
-
</Project>
|
1563
|
-
""",
|
1564
|
-
packagesConfigContents: """
|
1565
|
-
<packages>
|
1566
|
-
<package id="Some.Package" version="7.0.1" targetFramework="net45" />
|
1567
|
-
</packages>
|
1568
|
-
""",
|
1569
|
-
additionalFiles:
|
1570
|
-
[
|
1571
|
-
("app.config", """
|
1572
|
-
<configuration>
|
1573
|
-
<runtime>
|
1574
|
-
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
1575
|
-
<dependentAssembly>
|
1576
|
-
<assemblyIdentity name="Some.Package" publicKeyToken="13523FC3BE375AF1" culture="neutral" />
|
1577
|
-
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
1578
|
-
</dependentAssembly>
|
1579
|
-
</assemblyBinding>
|
1580
|
-
</runtime>
|
1581
|
-
</configuration>
|
1582
|
-
""")
|
1583
|
-
],
|
1584
|
-
expectedProjectContents: """
|
1585
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
1586
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
1587
|
-
<PropertyGroup>
|
1588
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
1589
|
-
</PropertyGroup>
|
1590
|
-
<ItemGroup>
|
1591
|
-
<None Include="packages.config" />
|
1592
|
-
</ItemGroup>
|
1593
|
-
<ItemGroup>
|
1594
|
-
<None Include="app.config" />
|
1595
|
-
</ItemGroup>
|
1596
|
-
<ItemGroup>
|
1597
|
-
<Reference Include="Some.Package, Version=13.0.0.0, Culture=neutral, PublicKeyToken=13523fc3be375af1">
|
1598
|
-
<HintPath>packages\Some.Package.13.0.1\lib\net45\Some.Package.dll</HintPath>
|
1599
|
-
<Private>True</Private>
|
1600
|
-
</Reference>
|
1601
|
-
</ItemGroup>
|
1602
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
1603
|
-
</Project>
|
1604
|
-
""",
|
1605
|
-
expectedPackagesConfigContents: """
|
1606
|
-
<?xml version="1.0" encoding="utf-8"?>
|
1607
|
-
<packages>
|
1608
|
-
<package id="Some.Package" version="13.0.1" targetFramework="net45" />
|
1609
|
-
</packages>
|
1610
|
-
""",
|
1611
|
-
additionalFilesExpected:
|
1612
|
-
[
|
1613
|
-
("app.config", """
|
1614
|
-
<configuration>
|
1615
|
-
<runtime>
|
1616
|
-
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
1617
|
-
<dependentAssembly>
|
1618
|
-
<assemblyIdentity name="Some.Package" publicKeyToken="13523FC3BE375AF1" culture="neutral" />
|
1619
|
-
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
|
1620
|
-
</dependentAssembly>
|
1621
|
-
</assemblyBinding>
|
1622
|
-
</runtime>
|
1623
|
-
</configuration>
|
1624
|
-
""")
|
1625
|
-
]
|
1626
|
-
);
|
1627
|
-
}
|
1628
|
-
|
1629
|
-
[Fact]
|
1630
|
-
public async Task UpdateBindingRedirect_ConfigXmlDeclarationNodeIsPreserved()
|
1631
|
-
{
|
1632
|
-
await TestUpdateForProject("Some.Package", "7.0.1", "13.0.1",
|
1633
|
-
packages:
|
1634
|
-
[
|
1635
|
-
MockNuGetPackage.CreatePackageWithAssembly("Some.Package", "7.0.1", "net45", "7.0.0.0"),
|
1636
|
-
MockNuGetPackage.CreatePackageWithAssembly("Some.Package", "13.0.1", "net45", "13.0.0.0"),
|
1637
|
-
],
|
1638
|
-
projectContents: """
|
1639
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
1640
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
1641
|
-
<PropertyGroup>
|
1642
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
1643
|
-
</PropertyGroup>
|
1644
|
-
<ItemGroup>
|
1645
|
-
<None Include="packages.config" />
|
1646
|
-
</ItemGroup>
|
1647
|
-
<ItemGroup>
|
1648
|
-
<None Include="app.config" />
|
1649
|
-
</ItemGroup>
|
1650
|
-
<ItemGroup>
|
1651
|
-
<Reference Include="Some.Package, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null">
|
1652
|
-
<HintPath>packages\Some.Package.7.0.1\lib\net45\Some.Package.dll</HintPath>
|
1653
|
-
<Private>True</Private>
|
1654
|
-
</Reference>
|
1655
|
-
</ItemGroup>
|
1656
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
1657
|
-
</Project>
|
1658
|
-
""",
|
1659
|
-
packagesConfigContents: """
|
1660
|
-
<packages>
|
1661
|
-
<package id="Some.Package" version="7.0.1" targetFramework="net45" />
|
1662
|
-
</packages>
|
1663
|
-
""",
|
1664
|
-
additionalFiles:
|
1665
|
-
[
|
1666
|
-
("app.config", """
|
1667
|
-
<?xml version="1.0" encoding="utf-8"?>
|
1668
|
-
<configuration>
|
1669
|
-
<runtime>
|
1670
|
-
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
1671
|
-
<dependentAssembly>
|
1672
|
-
<assemblyIdentity name="Some.Package" publicKeyToken="null" culture="neutral" />
|
1673
|
-
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
1674
|
-
</dependentAssembly>
|
1675
|
-
<dependentAssembly>
|
1676
|
-
<assemblyIdentity name="Some.Package" publicKeyToken="null" culture="neutral" />
|
1677
|
-
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
1678
|
-
</dependentAssembly>
|
1679
|
-
</assemblyBinding>
|
1680
|
-
</runtime>
|
1681
|
-
</configuration>
|
1682
|
-
""")
|
1683
|
-
],
|
1684
|
-
expectedProjectContents: """
|
1685
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
1686
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
1687
|
-
<PropertyGroup>
|
1688
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
1689
|
-
</PropertyGroup>
|
1690
|
-
<ItemGroup>
|
1691
|
-
<None Include="packages.config" />
|
1692
|
-
</ItemGroup>
|
1693
|
-
<ItemGroup>
|
1694
|
-
<None Include="app.config" />
|
1695
|
-
</ItemGroup>
|
1696
|
-
<ItemGroup>
|
1697
|
-
<Reference Include="Some.Package, Version=13.0.0.0, Culture=neutral, PublicKeyToken=null">
|
1698
|
-
<HintPath>packages\Some.Package.13.0.1\lib\net45\Some.Package.dll</HintPath>
|
1699
|
-
<Private>True</Private>
|
1700
|
-
</Reference>
|
1701
|
-
</ItemGroup>
|
1702
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
1703
|
-
</Project>
|
1704
|
-
""",
|
1705
|
-
expectedPackagesConfigContents: """
|
1706
|
-
<?xml version="1.0" encoding="utf-8"?>
|
1707
|
-
<packages>
|
1708
|
-
<package id="Some.Package" version="13.0.1" targetFramework="net45" />
|
1709
|
-
</packages>
|
1710
|
-
""",
|
1711
|
-
additionalFilesExpected:
|
1712
|
-
[
|
1713
|
-
("app.config", """
|
1714
|
-
<?xml version="1.0" encoding="utf-8"?>
|
1715
|
-
<configuration>
|
1716
|
-
<runtime>
|
1717
|
-
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
1718
|
-
<dependentAssembly>
|
1719
|
-
<assemblyIdentity name="Some.Package" publicKeyToken="null" culture="neutral" />
|
1720
|
-
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
|
1721
|
-
</dependentAssembly>
|
1722
|
-
</assemblyBinding>
|
1723
|
-
</runtime>
|
1724
|
-
</configuration>
|
1725
|
-
""")
|
1726
|
-
]
|
1727
|
-
);
|
1728
|
-
}
|
1729
|
-
|
1730
|
-
[Fact]
|
1731
|
-
public async Task PackagesConfigUpdateCanHappenEvenWithMismatchedVersionNumbers()
|
1732
|
-
{
|
1733
|
-
// `packages.config` reports `7.0.1` and that's what we want to update, but the project file has a mismatch that's corrected
|
1734
|
-
await TestUpdateForProject("Some.Package", "7.0.1", "13.0.1",
|
1735
|
-
packages:
|
1736
|
-
[
|
1737
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "7.0.1", "net45"),
|
1738
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net45"),
|
1739
|
-
],
|
1740
|
-
projectContents: """
|
1741
|
-
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
1742
|
-
<PropertyGroup>
|
1743
|
-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
1744
|
-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
1745
|
-
<ProductVersion>
|
1746
|
-
</ProductVersion>
|
1747
|
-
<SchemaVersion>2.0</SchemaVersion>
|
1748
|
-
<ProjectGuid>ac83fc79-b637-445b-acb0-9be238ad077f</ProjectGuid>
|
1749
|
-
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
1750
|
-
<OutputType>Library</OutputType>
|
1751
|
-
<AppDesignerFolder>Properties</AppDesignerFolder>
|
1752
|
-
<RootNamespace>TestProject</RootNamespace>
|
1753
|
-
<AssemblyName>TestProject</AssemblyName>
|
1754
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
1755
|
-
</PropertyGroup>
|
1756
|
-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
1757
|
-
<DebugSymbols>true</DebugSymbols>
|
1758
|
-
<DebugType>full</DebugType>
|
1759
|
-
<Optimize>false</Optimize>
|
1760
|
-
<OutputPath>bin\</OutputPath>
|
1761
|
-
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
1762
|
-
<ErrorReport>prompt</ErrorReport>
|
1763
|
-
<WarningLevel>4</WarningLevel>
|
1764
|
-
</PropertyGroup>
|
1765
|
-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
1766
|
-
<DebugType>pdbonly</DebugType>
|
1767
|
-
<Optimize>true</Optimize>
|
1768
|
-
<OutputPath>bin\</OutputPath>
|
1769
|
-
<DefineConstants>TRACE</DefineConstants>
|
1770
|
-
<ErrorReport>prompt</ErrorReport>
|
1771
|
-
<WarningLevel>4</WarningLevel>
|
1772
|
-
</PropertyGroup>
|
1773
|
-
<ItemGroup>
|
1774
|
-
<Reference Include="Microsoft.CSharp" />
|
1775
|
-
<Reference Include="Some.Package, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
1776
|
-
<HintPath>packages\Some.Package.6.0.8\lib\net45\Some.Package.dll</HintPath>
|
1777
|
-
<Private>True</Private>
|
1778
|
-
</Reference>
|
1779
|
-
<Reference Include="System.Web.DynamicData" />
|
1780
|
-
<Reference Include="System.Web.Entity" />
|
1781
|
-
<Reference Include="System.Web.ApplicationServices" />
|
1782
|
-
<Reference Include="System" />
|
1783
|
-
<Reference Include="System.Data" />
|
1784
|
-
<Reference Include="System.Core" />
|
1785
|
-
<Reference Include="System.Data.DataSetExtensions" />
|
1786
|
-
<Reference Include="System.Web.Extensions" />
|
1787
|
-
<Reference Include="System.Xml.Linq" />
|
1788
|
-
<Reference Include="System.Drawing" />
|
1789
|
-
<Reference Include="System.Web" />
|
1790
|
-
<Reference Include="System.Xml" />
|
1791
|
-
<Reference Include="System.Configuration" />
|
1792
|
-
<Reference Include="System.Web.Services" />
|
1793
|
-
<Reference Include="System.EnterpriseServices" />
|
1794
|
-
</ItemGroup>
|
1795
|
-
<ItemGroup>
|
1796
|
-
<None Include="packages.config" />
|
1797
|
-
</ItemGroup>
|
1798
|
-
<ItemGroup>
|
1799
|
-
<Compile Include="Properties\AssemblyInfo.cs" />
|
1800
|
-
</ItemGroup>
|
1801
|
-
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
1802
|
-
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
|
1803
|
-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
1804
|
-
Other similar extension points exist, see Microsoft.Common.targets.
|
1805
|
-
<Target Name="BeforeBuild">
|
1806
|
-
</Target>
|
1807
|
-
<Target Name="AfterBuild">
|
1808
|
-
</Target>
|
1809
|
-
-->
|
1810
|
-
</Project>
|
1811
|
-
""",
|
1812
|
-
packagesConfigContents: """
|
1813
|
-
<packages>
|
1814
|
-
<package id="Some.Package" version="7.0.1" targetFramework="net45" />
|
1815
|
-
</packages>
|
1816
|
-
""",
|
1817
|
-
expectedProjectContents: """
|
1818
|
-
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
1819
|
-
<PropertyGroup>
|
1820
|
-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
1821
|
-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
1822
|
-
<ProductVersion>
|
1823
|
-
</ProductVersion>
|
1824
|
-
<SchemaVersion>2.0</SchemaVersion>
|
1825
|
-
<ProjectGuid>ac83fc79-b637-445b-acb0-9be238ad077f</ProjectGuid>
|
1826
|
-
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
1827
|
-
<OutputType>Library</OutputType>
|
1828
|
-
<AppDesignerFolder>Properties</AppDesignerFolder>
|
1829
|
-
<RootNamespace>TestProject</RootNamespace>
|
1830
|
-
<AssemblyName>TestProject</AssemblyName>
|
1831
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
1832
|
-
</PropertyGroup>
|
1833
|
-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
1834
|
-
<DebugSymbols>true</DebugSymbols>
|
1835
|
-
<DebugType>full</DebugType>
|
1836
|
-
<Optimize>false</Optimize>
|
1837
|
-
<OutputPath>bin\</OutputPath>
|
1838
|
-
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
1839
|
-
<ErrorReport>prompt</ErrorReport>
|
1840
|
-
<WarningLevel>4</WarningLevel>
|
1841
|
-
</PropertyGroup>
|
1842
|
-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
1843
|
-
<DebugType>pdbonly</DebugType>
|
1844
|
-
<Optimize>true</Optimize>
|
1845
|
-
<OutputPath>bin\</OutputPath>
|
1846
|
-
<DefineConstants>TRACE</DefineConstants>
|
1847
|
-
<ErrorReport>prompt</ErrorReport>
|
1848
|
-
<WarningLevel>4</WarningLevel>
|
1849
|
-
</PropertyGroup>
|
1850
|
-
<ItemGroup>
|
1851
|
-
<Reference Include="Microsoft.CSharp" />
|
1852
|
-
<Reference Include="Some.Package">
|
1853
|
-
<HintPath>packages\Some.Package.13.0.1\lib\net45\Some.Package.dll</HintPath>
|
1854
|
-
<Private>True</Private>
|
1855
|
-
</Reference>
|
1856
|
-
<Reference Include="System.Web.DynamicData" />
|
1857
|
-
<Reference Include="System.Web.Entity" />
|
1858
|
-
<Reference Include="System.Web.ApplicationServices" />
|
1859
|
-
<Reference Include="System" />
|
1860
|
-
<Reference Include="System.Data" />
|
1861
|
-
<Reference Include="System.Core" />
|
1862
|
-
<Reference Include="System.Data.DataSetExtensions" />
|
1863
|
-
<Reference Include="System.Web.Extensions" />
|
1864
|
-
<Reference Include="System.Xml.Linq" />
|
1865
|
-
<Reference Include="System.Drawing" />
|
1866
|
-
<Reference Include="System.Web" />
|
1867
|
-
<Reference Include="System.Xml" />
|
1868
|
-
<Reference Include="System.Configuration" />
|
1869
|
-
<Reference Include="System.Web.Services" />
|
1870
|
-
<Reference Include="System.EnterpriseServices" />
|
1871
|
-
</ItemGroup>
|
1872
|
-
<ItemGroup>
|
1873
|
-
<None Include="packages.config" />
|
1874
|
-
</ItemGroup>
|
1875
|
-
<ItemGroup>
|
1876
|
-
<Compile Include="Properties\AssemblyInfo.cs" />
|
1877
|
-
</ItemGroup>
|
1878
|
-
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
1879
|
-
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
|
1880
|
-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
1881
|
-
Other similar extension points exist, see Microsoft.Common.targets.
|
1882
|
-
<Target Name="BeforeBuild">
|
1883
|
-
</Target>
|
1884
|
-
<Target Name="AfterBuild">
|
1885
|
-
</Target>
|
1886
|
-
-->
|
1887
|
-
</Project>
|
1888
|
-
""",
|
1889
|
-
expectedPackagesConfigContents: """
|
1890
|
-
<?xml version="1.0" encoding="utf-8"?>
|
1891
|
-
<packages>
|
1892
|
-
<package id="Some.Package" version="13.0.1" targetFramework="net45" />
|
1893
|
-
</packages>
|
1894
|
-
"""
|
1895
|
-
);
|
1896
|
-
}
|
1897
|
-
|
1898
|
-
[Fact]
|
1899
|
-
public async Task PackagesConfigUpdateIsNotThwartedBy_VSToolsPath_PropertyBeingSetInUserCode()
|
1900
|
-
{
|
1901
|
-
await TestUpdateForProject("Some.Package", "7.0.1", "13.0.1",
|
1902
|
-
packages:
|
1903
|
-
[
|
1904
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "7.0.1", "net45"),
|
1905
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net45"),
|
1906
|
-
],
|
1907
|
-
projectContents: """
|
1908
|
-
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
1909
|
-
<PropertyGroup>
|
1910
|
-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
1911
|
-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
1912
|
-
<ProductVersion>
|
1913
|
-
</ProductVersion>
|
1914
|
-
<SchemaVersion>2.0</SchemaVersion>
|
1915
|
-
<ProjectGuid>68ed3303-52a0-47b8-a687-3abbb07530da</ProjectGuid>
|
1916
|
-
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
1917
|
-
<OutputType>Library</OutputType>
|
1918
|
-
<AppDesignerFolder>Properties</AppDesignerFolder>
|
1919
|
-
<RootNamespace>TestProject</RootNamespace>
|
1920
|
-
<AssemblyName>TestProject</AssemblyName>
|
1921
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
1922
|
-
</PropertyGroup>
|
1923
|
-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
1924
|
-
<DebugSymbols>true</DebugSymbols>
|
1925
|
-
<DebugType>full</DebugType>
|
1926
|
-
<Optimize>false</Optimize>
|
1927
|
-
<OutputPath>bin\</OutputPath>
|
1928
|
-
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
1929
|
-
<ErrorReport>prompt</ErrorReport>
|
1930
|
-
<WarningLevel>4</WarningLevel>
|
1931
|
-
</PropertyGroup>
|
1932
|
-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
1933
|
-
<DebugType>pdbonly</DebugType>
|
1934
|
-
<Optimize>true</Optimize>
|
1935
|
-
<OutputPath>bin\</OutputPath>
|
1936
|
-
<DefineConstants>TRACE</DefineConstants>
|
1937
|
-
<ErrorReport>prompt</ErrorReport>
|
1938
|
-
<WarningLevel>4</WarningLevel>
|
1939
|
-
</PropertyGroup>
|
1940
|
-
<ItemGroup>
|
1941
|
-
<Reference Include="Microsoft.CSharp" />
|
1942
|
-
<Reference Include="Some.Package">
|
1943
|
-
<HintPath>packages\Some.Package.7.0.1\lib\net45\Some.Package.dll</HintPath>
|
1944
|
-
<Private>True</Private>
|
1945
|
-
</Reference>
|
1946
|
-
<Reference Include="System.Web.DynamicData" />
|
1947
|
-
<Reference Include="System.Web.Entity" />
|
1948
|
-
<Reference Include="System.Web.ApplicationServices" />
|
1949
|
-
<Reference Include="System" />
|
1950
|
-
<Reference Include="System.Data" />
|
1951
|
-
<Reference Include="System.Core" />
|
1952
|
-
<Reference Include="System.Data.DataSetExtensions" />
|
1953
|
-
<Reference Include="System.Web.Extensions" />
|
1954
|
-
<Reference Include="System.Xml.Linq" />
|
1955
|
-
<Reference Include="System.Drawing" />
|
1956
|
-
<Reference Include="System.Web" />
|
1957
|
-
<Reference Include="System.Xml" />
|
1958
|
-
<Reference Include="System.Configuration" />
|
1959
|
-
<Reference Include="System.Web.Services" />
|
1960
|
-
<Reference Include="System.EnterpriseServices" />
|
1961
|
-
</ItemGroup>
|
1962
|
-
<ItemGroup>
|
1963
|
-
<None Include="packages.config" />
|
1964
|
-
</ItemGroup>
|
1965
|
-
<ItemGroup>
|
1966
|
-
<Compile Include="Properties\AssemblyInfo.cs" />
|
1967
|
-
</ItemGroup>
|
1968
|
-
<ItemGroup>
|
1969
|
-
<ProjectReference Include="other-project\other-project.csproj" />
|
1970
|
-
</ItemGroup>
|
1971
|
-
<PropertyGroup>
|
1972
|
-
<!-- some project files set this property which makes the Microsoft.WebApplication.targets import a few lines down always fail -->
|
1973
|
-
<VSToolsPath Condition="'$(VSToolsPath)' == ''">C:\some\path\that\does\not\exist</VSToolsPath>
|
1974
|
-
</PropertyGroup>
|
1975
|
-
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
1976
|
-
<Import Project="$(VSToolsPath)\SomeSubPath\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
|
1977
|
-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
1978
|
-
Other similar extension points exist, see Microsoft.Common.targets.
|
1979
|
-
<Target Name="BeforeBuild">
|
1980
|
-
</Target>
|
1981
|
-
<Target Name="AfterBuild">
|
1982
|
-
</Target>
|
1983
|
-
-->
|
1984
|
-
</Project>
|
1985
|
-
""",
|
1986
|
-
packagesConfigContents: """
|
1987
|
-
<packages>
|
1988
|
-
<package id="Some.Package" version="7.0.1" targetFramework="net45" />
|
1989
|
-
</packages>
|
1990
|
-
""",
|
1991
|
-
additionalFiles:
|
1992
|
-
[
|
1993
|
-
("other-project/other-project.csproj", """
|
1994
|
-
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
1995
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
1996
|
-
<PropertyGroup>
|
1997
|
-
<OutputType>Library</OutputType>
|
1998
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
1999
|
-
</PropertyGroup>
|
2000
|
-
<Import Project="$(VSToolsPath)\SomeSubPath\WebApplications\Microsoft.WebApplication.targets" />
|
2001
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
2002
|
-
</Project>
|
2003
|
-
""")
|
2004
|
-
],
|
2005
|
-
expectedProjectContents: """
|
2006
|
-
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
2007
|
-
<PropertyGroup>
|
2008
|
-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
2009
|
-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
2010
|
-
<ProductVersion>
|
2011
|
-
</ProductVersion>
|
2012
|
-
<SchemaVersion>2.0</SchemaVersion>
|
2013
|
-
<ProjectGuid>68ed3303-52a0-47b8-a687-3abbb07530da</ProjectGuid>
|
2014
|
-
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
2015
|
-
<OutputType>Library</OutputType>
|
2016
|
-
<AppDesignerFolder>Properties</AppDesignerFolder>
|
2017
|
-
<RootNamespace>TestProject</RootNamespace>
|
2018
|
-
<AssemblyName>TestProject</AssemblyName>
|
2019
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
2020
|
-
</PropertyGroup>
|
2021
|
-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
2022
|
-
<DebugSymbols>true</DebugSymbols>
|
2023
|
-
<DebugType>full</DebugType>
|
2024
|
-
<Optimize>false</Optimize>
|
2025
|
-
<OutputPath>bin\</OutputPath>
|
2026
|
-
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
2027
|
-
<ErrorReport>prompt</ErrorReport>
|
2028
|
-
<WarningLevel>4</WarningLevel>
|
2029
|
-
</PropertyGroup>
|
2030
|
-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
2031
|
-
<DebugType>pdbonly</DebugType>
|
2032
|
-
<Optimize>true</Optimize>
|
2033
|
-
<OutputPath>bin\</OutputPath>
|
2034
|
-
<DefineConstants>TRACE</DefineConstants>
|
2035
|
-
<ErrorReport>prompt</ErrorReport>
|
2036
|
-
<WarningLevel>4</WarningLevel>
|
2037
|
-
</PropertyGroup>
|
2038
|
-
<ItemGroup>
|
2039
|
-
<Reference Include="Microsoft.CSharp" />
|
2040
|
-
<Reference Include="Some.Package">
|
2041
|
-
<HintPath>packages\Some.Package.13.0.1\lib\net45\Some.Package.dll</HintPath>
|
2042
|
-
<Private>True</Private>
|
2043
|
-
</Reference>
|
2044
|
-
<Reference Include="System.Web.DynamicData" />
|
2045
|
-
<Reference Include="System.Web.Entity" />
|
2046
|
-
<Reference Include="System.Web.ApplicationServices" />
|
2047
|
-
<Reference Include="System" />
|
2048
|
-
<Reference Include="System.Data" />
|
2049
|
-
<Reference Include="System.Core" />
|
2050
|
-
<Reference Include="System.Data.DataSetExtensions" />
|
2051
|
-
<Reference Include="System.Web.Extensions" />
|
2052
|
-
<Reference Include="System.Xml.Linq" />
|
2053
|
-
<Reference Include="System.Drawing" />
|
2054
|
-
<Reference Include="System.Web" />
|
2055
|
-
<Reference Include="System.Xml" />
|
2056
|
-
<Reference Include="System.Configuration" />
|
2057
|
-
<Reference Include="System.Web.Services" />
|
2058
|
-
<Reference Include="System.EnterpriseServices" />
|
2059
|
-
</ItemGroup>
|
2060
|
-
<ItemGroup>
|
2061
|
-
<None Include="packages.config" />
|
2062
|
-
</ItemGroup>
|
2063
|
-
<ItemGroup>
|
2064
|
-
<Compile Include="Properties\AssemblyInfo.cs" />
|
2065
|
-
</ItemGroup>
|
2066
|
-
<ItemGroup>
|
2067
|
-
<ProjectReference Include="other-project\other-project.csproj" />
|
2068
|
-
</ItemGroup>
|
2069
|
-
<PropertyGroup>
|
2070
|
-
<!-- some project files set this property which makes the Microsoft.WebApplication.targets import a few lines down always fail -->
|
2071
|
-
<VSToolsPath Condition="'$(VSToolsPath)' == ''">C:\some\path\that\does\not\exist</VSToolsPath>
|
2072
|
-
</PropertyGroup>
|
2073
|
-
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
2074
|
-
<Import Project="$(VSToolsPath)\SomeSubPath\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
|
2075
|
-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
2076
|
-
Other similar extension points exist, see Microsoft.Common.targets.
|
2077
|
-
<Target Name="BeforeBuild">
|
2078
|
-
</Target>
|
2079
|
-
<Target Name="AfterBuild">
|
2080
|
-
</Target>
|
2081
|
-
-->
|
2082
|
-
</Project>
|
2083
|
-
""",
|
2084
|
-
expectedPackagesConfigContents: """
|
2085
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2086
|
-
<packages>
|
2087
|
-
<package id="Some.Package" version="13.0.1" targetFramework="net45" />
|
2088
|
-
</packages>
|
2089
|
-
"""
|
2090
|
-
);
|
2091
|
-
}
|
2092
|
-
|
2093
|
-
[Fact]
|
2094
|
-
public async Task PackageCanBeUpdatedWhenAnotherInstalledPackageHasBeenDelisted()
|
2095
|
-
{
|
2096
|
-
// updating one package (Some.Package) when another installed package (Delisted.Package/5.0.0) has been delisted
|
2097
|
-
// this test can't be faked with a local package source and requires an HTTP endpoint; the important part is
|
2098
|
-
// the `"listed": false` in the registration index
|
2099
|
-
static (int, byte[]) TestHttpHandler(string uriString)
|
2100
|
-
{
|
2101
|
-
var uri = new Uri(uriString, UriKind.Absolute);
|
2102
|
-
var baseUrl = $"{uri.Scheme}://{uri.Host}:{uri.Port}";
|
2103
|
-
return uri.PathAndQuery switch
|
2104
|
-
{
|
2105
|
-
"/index.json" => (200, Encoding.UTF8.GetBytes($$"""
|
2106
|
-
{
|
2107
|
-
"version": "3.0.0",
|
2108
|
-
"resources": [
|
2109
|
-
{
|
2110
|
-
"@id": "{{baseUrl}}/download",
|
2111
|
-
"@type": "PackageBaseAddress/3.0.0"
|
2112
|
-
},
|
2113
|
-
{
|
2114
|
-
"@id": "{{baseUrl}}/query",
|
2115
|
-
"@type": "SearchQueryService"
|
2116
|
-
},
|
2117
|
-
{
|
2118
|
-
"@id": "{{baseUrl}}/registrations",
|
2119
|
-
"@type": "RegistrationsBaseUrl"
|
2120
|
-
}
|
2121
|
-
]
|
2122
|
-
}
|
2123
|
-
""")),
|
2124
|
-
"/registrations/delisted.package/index.json" => (200, Encoding.UTF8.GetBytes($$"""
|
2125
|
-
{
|
2126
|
-
"count": 1,
|
2127
|
-
"items": [
|
2128
|
-
{
|
2129
|
-
"lower": "5.0.0",
|
2130
|
-
"upper": "5.0.0",
|
2131
|
-
"items": [
|
2132
|
-
{
|
2133
|
-
"catalogEntry": {
|
2134
|
-
"id": "Delisted.Package",
|
2135
|
-
"listed": false,
|
2136
|
-
"version": "5.0.0"
|
2137
|
-
},
|
2138
|
-
"packageContent": "{{baseUrl}}/download/delisted.package/5.0.0/delisted.package.5.0.0.nupkg",
|
2139
|
-
}
|
2140
|
-
]
|
2141
|
-
}
|
2142
|
-
]
|
2143
|
-
}
|
2144
|
-
""")),
|
2145
|
-
"/registrations/some.package/index.json" => (200, Encoding.UTF8.GetBytes($$"""
|
2146
|
-
{
|
2147
|
-
"count": 1,
|
2148
|
-
"items": [
|
2149
|
-
{
|
2150
|
-
"lower": "1.0.0",
|
2151
|
-
"upper": "2.0.0",
|
2152
|
-
"items": [
|
2153
|
-
{
|
2154
|
-
"catalogEntry": {
|
2155
|
-
"id": "Some.Package",
|
2156
|
-
"listed": true,
|
2157
|
-
"version": "1.0.0"
|
2158
|
-
},
|
2159
|
-
"packageContent": "{{baseUrl}}/download/some.package/1.0.0/some.package.1.0.0.nupkg",
|
2160
|
-
},
|
2161
|
-
{
|
2162
|
-
"catalogEntry": {
|
2163
|
-
"id": "Some.Package",
|
2164
|
-
"listed": true,
|
2165
|
-
"version": "2.0.0"
|
2166
|
-
},
|
2167
|
-
"packageContent": "{{baseUrl}}/download/some.package/2.0.0/some.package.2.0.0.nupkg",
|
2168
|
-
}
|
2169
|
-
]
|
2170
|
-
}
|
2171
|
-
]
|
2172
|
-
}
|
2173
|
-
""")),
|
2174
|
-
"/download/delisted.package/5.0.0/delisted.package.5.0.0.nupkg" =>
|
2175
|
-
(200, MockNuGetPackage.CreateSimplePackage("Delisted.Package", "5.0.0", "net45").GetZipStream().ReadAllBytes()),
|
2176
|
-
"/download/some.package/1.0.0/some.package.1.0.0.nupkg" =>
|
2177
|
-
(200, MockNuGetPackage.CreateSimplePackage("Some.Package", "1.0.0", "net45").GetZipStream().ReadAllBytes()),
|
2178
|
-
"/download/some.package/2.0.0/some.package.2.0.0.nupkg" =>
|
2179
|
-
(200, MockNuGetPackage.CreateSimplePackage("Some.Package", "2.0.0", "net45").GetZipStream().ReadAllBytes()),
|
2180
|
-
_ => (404, Encoding.UTF8.GetBytes("{}")), // everything is missing
|
2181
|
-
};
|
2182
|
-
}
|
2183
|
-
using var cache = new TemporaryDirectory();
|
2184
|
-
using var http = TestHttpServer.CreateTestServer(TestHttpHandler);
|
2185
|
-
await TestUpdateForProject("Some.Package", "1.0.0", "2.0.0",
|
2186
|
-
// existing
|
2187
|
-
projectContents: """
|
2188
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
2189
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
2190
|
-
<PropertyGroup>
|
2191
|
-
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
2192
|
-
</PropertyGroup>
|
2193
|
-
<ItemGroup>
|
2194
|
-
<None Include="packages.config" />
|
2195
|
-
</ItemGroup>
|
2196
|
-
<ItemGroup>
|
2197
|
-
<Reference Include="Delisted.Package">
|
2198
|
-
<HintPath>packages\Delisted.Package.5.0.0\lib\net45\Delisted.Package.dll</HintPath>
|
2199
|
-
<Private>True</Private>
|
2200
|
-
</Reference>
|
2201
|
-
<Reference Include="Some.Package">
|
2202
|
-
<HintPath>packages\Some.Package.1.0.0\lib\net45\Some.Package.dll</HintPath>
|
2203
|
-
<Private>True</Private>
|
2204
|
-
</Reference>
|
2205
|
-
</ItemGroup>
|
2206
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
2207
|
-
</Project>
|
2208
|
-
""",
|
2209
|
-
packagesConfigContents: """
|
2210
|
-
<packages>
|
2211
|
-
<package id="Delisted.Package" version="5.0.0" targetFramework="net462" />
|
2212
|
-
<package id="Some.Package" version="1.0.0" targetFramework="net462" />
|
2213
|
-
</packages>
|
2214
|
-
""",
|
2215
|
-
additionalFiles:
|
2216
|
-
[
|
2217
|
-
("NuGet.Config", $"""
|
2218
|
-
<configuration>
|
2219
|
-
<packageSources>
|
2220
|
-
<clear />
|
2221
|
-
<add key="private_feed" value="{http.BaseUrl.TrimEnd('/')}/index.json" allowInsecureConnections="true" />
|
2222
|
-
</packageSources>
|
2223
|
-
</configuration>
|
2224
|
-
""")
|
2225
|
-
],
|
2226
|
-
// expected
|
2227
|
-
expectedProjectContents: """
|
2228
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
2229
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
2230
|
-
<PropertyGroup>
|
2231
|
-
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
2232
|
-
</PropertyGroup>
|
2233
|
-
<ItemGroup>
|
2234
|
-
<None Include="packages.config" />
|
2235
|
-
</ItemGroup>
|
2236
|
-
<ItemGroup>
|
2237
|
-
<Reference Include="Delisted.Package">
|
2238
|
-
<HintPath>packages\Delisted.Package.5.0.0\lib\net45\Delisted.Package.dll</HintPath>
|
2239
|
-
<Private>True</Private>
|
2240
|
-
</Reference>
|
2241
|
-
<Reference Include="Some.Package">
|
2242
|
-
<HintPath>packages\Some.Package.2.0.0\lib\net45\Some.Package.dll</HintPath>
|
2243
|
-
<Private>True</Private>
|
2244
|
-
</Reference>
|
2245
|
-
</ItemGroup>
|
2246
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
2247
|
-
</Project>
|
2248
|
-
""",
|
2249
|
-
expectedPackagesConfigContents: """
|
2250
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2251
|
-
<packages>
|
2252
|
-
<package id="Delisted.Package" version="5.0.0" targetFramework="net462" />
|
2253
|
-
<package id="Some.Package" version="2.0.0" targetFramework="net462" />
|
2254
|
-
</packages>
|
2255
|
-
"""
|
2256
|
-
);
|
2257
|
-
}
|
2258
|
-
|
2259
|
-
[Fact]
|
2260
|
-
public async Task MissingTargetsAreReported()
|
2261
|
-
{
|
2262
|
-
using var temporaryDirectory = await TemporaryDirectory.CreateWithContentsAsync(
|
2263
|
-
[
|
2264
|
-
("project.csproj", """
|
2265
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
2266
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
2267
|
-
<Import Project="this.file.does.not.exist.targets" />
|
2268
|
-
<PropertyGroup>
|
2269
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
2270
|
-
</PropertyGroup>
|
2271
|
-
<ItemGroup>
|
2272
|
-
<None Include="packages.config" />
|
2273
|
-
</ItemGroup>
|
2274
|
-
<ItemGroup>
|
2275
|
-
<Reference Include="Some.Package, Version=1.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
2276
|
-
<HintPath>packages\Some.Package.1.0.0\lib\net45\Some.Package.dll</HintPath>
|
2277
|
-
<Private>True</Private>
|
2278
|
-
</Reference>
|
2279
|
-
</ItemGroup>
|
2280
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
2281
|
-
</Project>
|
2282
|
-
"""),
|
2283
|
-
("packages.config", """
|
2284
|
-
<packages>
|
2285
|
-
<package id="Some.Package" version="1.0.0" targetFramework="net45" />
|
2286
|
-
</packages>
|
2287
|
-
"""),
|
2288
|
-
("NuGet.Config", """
|
2289
|
-
<configuration>
|
2290
|
-
<packageSources>
|
2291
|
-
<clear />
|
2292
|
-
<add key="private_feed" value="packages" />
|
2293
|
-
</packageSources>
|
2294
|
-
</configuration>
|
2295
|
-
""")
|
2296
|
-
]
|
2297
|
-
);
|
2298
|
-
MockNuGetPackage[] packages =
|
2299
|
-
[
|
2300
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "1.0.0", "net45"),
|
2301
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "1.1.0", "net45"),
|
2302
|
-
];
|
2303
|
-
await MockNuGetPackagesInDirectory(packages, Path.Combine(temporaryDirectory.DirectoryPath, "packages"));
|
2304
|
-
var resultOutputPath = Path.Combine(temporaryDirectory.DirectoryPath, "result.json");
|
2305
|
-
|
2306
|
-
var worker = new UpdaterWorker("TEST-JOB-ID", new ExperimentsManager(), new TestLogger());
|
2307
|
-
await worker.RunAsync(temporaryDirectory.DirectoryPath, "project.csproj", "Some.Package", "1.0.0", "1.1.0", isTransitive: false, resultOutputPath: resultOutputPath);
|
2308
|
-
|
2309
|
-
var resultContents = await File.ReadAllTextAsync(resultOutputPath);
|
2310
|
-
var rawResult = JsonDocument.Parse(resultContents);
|
2311
|
-
Assert.Equal("dependency_file_not_found", rawResult.RootElement.GetProperty("Error").GetProperty("error-type").GetString());
|
2312
|
-
Assert.Equal(Path.Combine(temporaryDirectory.DirectoryPath, "this.file.does.not.exist.targets").NormalizePathToUnix(), rawResult.RootElement.GetProperty("Error").GetProperty("error-details").GetProperty("file-path").GetString());
|
2313
|
-
}
|
2314
|
-
|
2315
|
-
[Fact]
|
2316
|
-
public async Task MissingVisualStudioComponentTargetsAreReportedAsMissingFiles()
|
2317
|
-
{
|
2318
|
-
using var temporaryDirectory = await TemporaryDirectory.CreateWithContentsAsync(
|
2319
|
-
[
|
2320
|
-
("project.csproj", """
|
2321
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
2322
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
2323
|
-
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Some.Visual.Studio.Component.props" />
|
2324
|
-
<PropertyGroup>
|
2325
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
2326
|
-
</PropertyGroup>
|
2327
|
-
<ItemGroup>
|
2328
|
-
<None Include="packages.config" />
|
2329
|
-
</ItemGroup>
|
2330
|
-
<ItemGroup>
|
2331
|
-
<Reference Include="Some.Package, Version=1.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
2332
|
-
<HintPath>packages\Some.Package.1.0.0\lib\net45\Some.Package.dll</HintPath>
|
2333
|
-
<Private>True</Private>
|
2334
|
-
</Reference>
|
2335
|
-
</ItemGroup>
|
2336
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
2337
|
-
</Project>
|
2338
|
-
"""),
|
2339
|
-
("packages.config", """
|
2340
|
-
<packages>
|
2341
|
-
<package id="Some.Package" version="1.0.0" targetFramework="net45" />
|
2342
|
-
</packages>
|
2343
|
-
"""),
|
2344
|
-
("NuGet.Config", """
|
2345
|
-
<configuration>
|
2346
|
-
<packageSources>
|
2347
|
-
<clear />
|
2348
|
-
<add key="private_feed" value="packages" />
|
2349
|
-
</packageSources>
|
2350
|
-
</configuration>
|
2351
|
-
""")
|
2352
|
-
]
|
2353
|
-
);
|
2354
|
-
MockNuGetPackage[] packages =
|
2355
|
-
[
|
2356
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "1.0.0", "net45"),
|
2357
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "1.1.0", "net45"),
|
2358
|
-
];
|
2359
|
-
await MockNuGetPackagesInDirectory(packages, Path.Combine(temporaryDirectory.DirectoryPath, "packages"));
|
2360
|
-
var resultOutputPath = Path.Combine(temporaryDirectory.DirectoryPath, "result.json");
|
2361
|
-
|
2362
|
-
var worker = new UpdaterWorker("TEST-JOB-ID", new ExperimentsManager(), new TestLogger());
|
2363
|
-
await worker.RunAsync(temporaryDirectory.DirectoryPath, "project.csproj", "Some.Package", "1.0.0", "1.1.0", isTransitive: false, resultOutputPath: resultOutputPath);
|
2364
|
-
|
2365
|
-
var resultContents = await File.ReadAllTextAsync(resultOutputPath);
|
2366
|
-
var rawResult = JsonDocument.Parse(resultContents);
|
2367
|
-
Assert.Equal("dependency_file_not_found", rawResult.RootElement.GetProperty("Error").GetProperty("error-type").GetString());
|
2368
|
-
Assert.Equal("$(MSBuildExtensionsPath32)/Microsoft/VisualStudio/v$(VisualStudioVersion)/Some.Visual.Studio.Component.props", rawResult.RootElement.GetProperty("Error").GetProperty("error-details").GetProperty("file-path").GetString());
|
2369
|
-
}
|
2370
|
-
|
2371
|
-
[Theory]
|
2372
|
-
[InlineData(401)]
|
2373
|
-
[InlineData(403)]
|
2374
|
-
public async Task ReportsPrivateSourceAuthenticationFailure(int httpStatusCode)
|
2375
|
-
{
|
2376
|
-
(int, string) TestHttpHandler(string uriString)
|
2377
|
-
{
|
2378
|
-
var uri = new Uri(uriString, UriKind.Absolute);
|
2379
|
-
var baseUrl = $"{uri.Scheme}://{uri.Host}:{uri.Port}";
|
2380
|
-
return uri.PathAndQuery switch
|
2381
|
-
{
|
2382
|
-
_ => (httpStatusCode, "{}"), // everything is unauthorized
|
2383
|
-
};
|
2384
|
-
}
|
2385
|
-
using var http = TestHttpServer.CreateTestStringServer(TestHttpHandler);
|
2386
|
-
await TestUpdateForProject("Some.Package", "1.0.0", "1.1.0",
|
2387
|
-
// existing
|
2388
|
-
projectContents: """
|
2389
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
2390
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
2391
|
-
<PropertyGroup>
|
2392
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
2393
|
-
</PropertyGroup>
|
2394
|
-
<ItemGroup>
|
2395
|
-
<None Include="packages.config" />
|
2396
|
-
</ItemGroup>
|
2397
|
-
<ItemGroup>
|
2398
|
-
<Reference Include="Some.Package, Version=1.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
2399
|
-
<HintPath>packages\Some.Package.1.0.0\lib\net45\Some.Package.dll</HintPath>
|
2400
|
-
<Private>True</Private>
|
2401
|
-
</Reference>
|
2402
|
-
</ItemGroup>
|
2403
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
2404
|
-
</Project>
|
2405
|
-
""",
|
2406
|
-
packagesConfigContents: """
|
2407
|
-
<packages>
|
2408
|
-
<package id="Some.Package" version="1.0.0" targetFramework="net45" />
|
2409
|
-
</packages>
|
2410
|
-
""",
|
2411
|
-
additionalFiles:
|
2412
|
-
[
|
2413
|
-
("NuGet.Config", $"""
|
2414
|
-
<configuration>
|
2415
|
-
<packageSources>
|
2416
|
-
<clear />
|
2417
|
-
<add key="private_feed" value="{http.BaseUrl.TrimEnd('/')}/index.json" allowInsecureConnections="true" />
|
2418
|
-
</packageSources>
|
2419
|
-
</configuration>
|
2420
|
-
""")
|
2421
|
-
],
|
2422
|
-
// expected
|
2423
|
-
expectedProjectContents: """
|
2424
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
2425
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
2426
|
-
<PropertyGroup>
|
2427
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
2428
|
-
</PropertyGroup>
|
2429
|
-
<ItemGroup>
|
2430
|
-
<None Include="packages.config" />
|
2431
|
-
</ItemGroup>
|
2432
|
-
<ItemGroup>
|
2433
|
-
<Reference Include="Some.Package, Version=1.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
2434
|
-
<HintPath>packages\Some.Package.1.0.0\lib\net45\Some.Package.dll</HintPath>
|
2435
|
-
<Private>True</Private>
|
2436
|
-
</Reference>
|
2437
|
-
</ItemGroup>
|
2438
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
2439
|
-
</Project>
|
2440
|
-
""",
|
2441
|
-
expectedPackagesConfigContents: """
|
2442
|
-
<packages>
|
2443
|
-
<package id="Some.Package" version="1.0.0" targetFramework="net45" />
|
2444
|
-
</packages>
|
2445
|
-
""",
|
2446
|
-
expectedResult: new()
|
2447
|
-
{
|
2448
|
-
Error = new PrivateSourceAuthenticationFailure([$"{http.BaseUrl.TrimEnd('/')}/index.json"]),
|
2449
|
-
UpdateOperations = [],
|
2450
|
-
}
|
2451
|
-
);
|
2452
|
-
}
|
2453
|
-
|
2454
|
-
[Fact]
|
2455
|
-
public async Task ReportsUnexpectedResponseFromNuGetServer()
|
2456
|
-
{
|
2457
|
-
static (int, string) TestHttpHandler(string uriString)
|
2458
|
-
{
|
2459
|
-
var uri = new Uri(uriString, UriKind.Absolute);
|
2460
|
-
var baseUrl = $"{uri.Scheme}://{uri.Host}:{uri.Port}";
|
2461
|
-
return uri.PathAndQuery switch
|
2462
|
-
{
|
2463
|
-
// initial and search query are good, update should be possible...
|
2464
|
-
"/index.json" => (200, $$"""
|
2465
|
-
{
|
2466
|
-
"version": "3.0.0",
|
2467
|
-
"resources": [
|
2468
|
-
{
|
2469
|
-
"@id": "{{baseUrl}}/download",
|
2470
|
-
"@type": "PackageBaseAddress/3.0.0"
|
2471
|
-
},
|
2472
|
-
{
|
2473
|
-
"@id": "{{baseUrl}}/query",
|
2474
|
-
"@type": "SearchQueryService"
|
2475
|
-
},
|
2476
|
-
{
|
2477
|
-
"@id": "{{baseUrl}}/registrations",
|
2478
|
-
"@type": "RegistrationsBaseUrl"
|
2479
|
-
}
|
2480
|
-
]
|
2481
|
-
}
|
2482
|
-
"""),
|
2483
|
-
"/registrations/some.package/index.json" => (200, $$"""
|
2484
|
-
{
|
2485
|
-
"count": 1,
|
2486
|
-
"items": [
|
2487
|
-
{
|
2488
|
-
"lower": "1.0.0",
|
2489
|
-
"upper": "1.1.0",
|
2490
|
-
"items": [
|
2491
|
-
{
|
2492
|
-
"catalogEntry": {
|
2493
|
-
"id": "Some.Package",
|
2494
|
-
"listed": true,
|
2495
|
-
"version": "1.0.0"
|
2496
|
-
},
|
2497
|
-
"packageContent": "{{baseUrl}}/download/some.package/1.0.0/some.package.1.0.0.nupkg",
|
2498
|
-
},
|
2499
|
-
{
|
2500
|
-
"catalogEntry": {
|
2501
|
-
"id": "Some.Package",
|
2502
|
-
"listed": true,
|
2503
|
-
"version": "1.1.0"
|
2504
|
-
},
|
2505
|
-
"packageContent": "{{baseUrl}}/download/some.package/1.1.0/some.package.1.1.0.nupkg",
|
2506
|
-
}
|
2507
|
-
]
|
2508
|
-
}
|
2509
|
-
]
|
2510
|
-
}
|
2511
|
-
"""),
|
2512
|
-
// ...but all other calls to the server fail
|
2513
|
-
_ => (500, "{}"),
|
2514
|
-
};
|
2515
|
-
}
|
2516
|
-
using var http = TestHttpServer.CreateTestStringServer(TestHttpHandler);
|
2517
|
-
await TestUpdateForProject("Some.Package", "1.0.0", "1.1.0",
|
2518
|
-
// existing
|
2519
|
-
projectContents: """
|
2520
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
2521
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
2522
|
-
<PropertyGroup>
|
2523
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
2524
|
-
</PropertyGroup>
|
2525
|
-
<ItemGroup>
|
2526
|
-
<None Include="packages.config" />
|
2527
|
-
</ItemGroup>
|
2528
|
-
<ItemGroup>
|
2529
|
-
<Reference Include="Some.Package, Version=1.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
2530
|
-
<HintPath>packages\Some.Package.1.0.0\lib\net45\Some.Package.dll</HintPath>
|
2531
|
-
<Private>True</Private>
|
2532
|
-
</Reference>
|
2533
|
-
</ItemGroup>
|
2534
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
2535
|
-
</Project>
|
2536
|
-
""",
|
2537
|
-
packagesConfigContents: """
|
2538
|
-
<packages>
|
2539
|
-
<package id="Some.Package" version="1.0.0" targetFramework="net45" />
|
2540
|
-
</packages>
|
2541
|
-
""",
|
2542
|
-
additionalFiles:
|
2543
|
-
[
|
2544
|
-
("NuGet.Config", $"""
|
2545
|
-
<configuration>
|
2546
|
-
<packageSources>
|
2547
|
-
<clear />
|
2548
|
-
<add key="private_feed" value="{http.BaseUrl.TrimEnd('/')}/index.json" allowInsecureConnections="true" />
|
2549
|
-
</packageSources>
|
2550
|
-
</configuration>
|
2551
|
-
""")
|
2552
|
-
],
|
2553
|
-
// expected
|
2554
|
-
expectedProjectContents: """
|
2555
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
2556
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
2557
|
-
<PropertyGroup>
|
2558
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
2559
|
-
</PropertyGroup>
|
2560
|
-
<ItemGroup>
|
2561
|
-
<None Include="packages.config" />
|
2562
|
-
</ItemGroup>
|
2563
|
-
<ItemGroup>
|
2564
|
-
<Reference Include="Some.Package, Version=1.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
2565
|
-
<HintPath>packages\Some.Package.1.0.0\lib\net45\Some.Package.dll</HintPath>
|
2566
|
-
<Private>True</Private>
|
2567
|
-
</Reference>
|
2568
|
-
</ItemGroup>
|
2569
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
2570
|
-
</Project>
|
2571
|
-
""",
|
2572
|
-
expectedPackagesConfigContents: """
|
2573
|
-
<packages>
|
2574
|
-
<package id="Some.Package" version="1.0.0" targetFramework="net45" />
|
2575
|
-
</packages>
|
2576
|
-
""",
|
2577
|
-
expectedResult: new()
|
2578
|
-
{
|
2579
|
-
Error = new PrivateSourceBadResponse([$"{http.BaseUrl.TrimEnd('/')}/index.json"]),
|
2580
|
-
UpdateOperations = [],
|
2581
|
-
}
|
2582
|
-
);
|
2583
|
-
}
|
2584
|
-
|
2585
|
-
[Fact]
|
2586
|
-
public async Task MissingDependencyErrorIsReported()
|
2587
|
-
{
|
2588
|
-
// trying to update Some.Package from 1.0.1 to 1.0.2, but another package isn't available; update fails
|
2589
|
-
await TestUpdateForProject("Some.Package", "1.0.1", "1.0.2",
|
2590
|
-
packages:
|
2591
|
-
[
|
2592
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "1.0.1", "net45"),
|
2593
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "1.0.2", "net45"),
|
2594
|
-
|
2595
|
-
// the package `Unrelated.Package/1.0.0` is missing and will cause the update to fail
|
2596
|
-
],
|
2597
|
-
// existing
|
2598
|
-
projectContents: """
|
2599
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
2600
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
2601
|
-
<PropertyGroup>
|
2602
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
2603
|
-
</PropertyGroup>
|
2604
|
-
<ItemGroup>
|
2605
|
-
<None Include="packages.config" />
|
2606
|
-
</ItemGroup>
|
2607
|
-
<ItemGroup>
|
2608
|
-
<Reference Include="Some.Package, Version=1.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
2609
|
-
<HintPath>packages\Some.Package.1.0.1\lib\net45\Some.Package.dll</HintPath>
|
2610
|
-
<Private>True</Private>
|
2611
|
-
</Reference>
|
2612
|
-
<Reference Include="Unrelated.Package, Version=1.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
2613
|
-
<HintPath>packages\Unrelated.Package.1.0.0\lib\net45\Unrelated.Package.dll</HintPath>
|
2614
|
-
<Private>True</Private>
|
2615
|
-
</Reference>
|
2616
|
-
</ItemGroup>
|
2617
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
2618
|
-
</Project>
|
2619
|
-
""",
|
2620
|
-
packagesConfigContents: """
|
2621
|
-
<packages>
|
2622
|
-
<package id="Some.Package" version="1.0.1" targetFramework="net45" />
|
2623
|
-
<package id="Unrelated.Package" version="1.0.0" targetFramework="net45" />
|
2624
|
-
</packages>
|
2625
|
-
""",
|
2626
|
-
// expected
|
2627
|
-
expectedProjectContents: """
|
2628
|
-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
2629
|
-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
2630
|
-
<PropertyGroup>
|
2631
|
-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
2632
|
-
</PropertyGroup>
|
2633
|
-
<ItemGroup>
|
2634
|
-
<None Include="packages.config" />
|
2635
|
-
</ItemGroup>
|
2636
|
-
<ItemGroup>
|
2637
|
-
<Reference Include="Some.Package, Version=1.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
2638
|
-
<HintPath>packages\Some.Package.1.0.1\lib\net45\Some.Package.dll</HintPath>
|
2639
|
-
<Private>True</Private>
|
2640
|
-
</Reference>
|
2641
|
-
<Reference Include="Unrelated.Package, Version=1.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
2642
|
-
<HintPath>packages\Unrelated.Package.1.0.0\lib\net45\Unrelated.Package.dll</HintPath>
|
2643
|
-
<Private>True</Private>
|
2644
|
-
</Reference>
|
2645
|
-
</ItemGroup>
|
2646
|
-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
2647
|
-
</Project>
|
2648
|
-
""",
|
2649
|
-
expectedPackagesConfigContents: """
|
2650
|
-
<packages>
|
2651
|
-
<package id="Some.Package" version="1.0.1" targetFramework="net45" />
|
2652
|
-
<package id="Unrelated.Package" version="1.0.0" targetFramework="net45" />
|
2653
|
-
</packages>
|
2654
|
-
""",
|
2655
|
-
expectedResult: new()
|
2656
|
-
{
|
2657
|
-
Error = new DependencyNotFound("Unrelated.Package"),
|
2658
|
-
UpdateOperations = [],
|
2659
|
-
}
|
2660
|
-
);
|
2661
|
-
}
|
2662
|
-
|
2663
|
-
protected static Task TestUpdateForProject(
|
2664
|
-
string dependencyName,
|
2665
|
-
string oldVersion,
|
2666
|
-
string newVersion,
|
2667
|
-
string projectContents,
|
2668
|
-
string packagesConfigContents,
|
2669
|
-
string expectedProjectContents,
|
2670
|
-
string expectedPackagesConfigContents,
|
2671
|
-
(string Path, string Content)[]? additionalFiles = null,
|
2672
|
-
(string Path, string Content)[]? additionalFilesExpected = null,
|
2673
|
-
MockNuGetPackage[]? packages = null,
|
2674
|
-
ExpectedUpdateOperationResult? expectedResult = null)
|
2675
|
-
{
|
2676
|
-
var realizedAdditionalFiles = new List<(string Path, string Content)>
|
2677
|
-
{
|
2678
|
-
("packages.config", packagesConfigContents),
|
2679
|
-
};
|
2680
|
-
if (additionalFiles is not null)
|
2681
|
-
{
|
2682
|
-
realizedAdditionalFiles.AddRange(additionalFiles);
|
2683
|
-
}
|
2684
|
-
|
2685
|
-
var realizedAdditionalFilesExpected = new List<(string Path, string Content)>
|
2686
|
-
{
|
2687
|
-
("packages.config", expectedPackagesConfigContents),
|
2688
|
-
};
|
2689
|
-
if (additionalFilesExpected is not null)
|
2690
|
-
{
|
2691
|
-
realizedAdditionalFilesExpected.AddRange(additionalFilesExpected);
|
2692
|
-
}
|
2693
|
-
|
2694
|
-
return TestUpdateForProject(
|
2695
|
-
dependencyName,
|
2696
|
-
oldVersion,
|
2697
|
-
newVersion,
|
2698
|
-
projectContents,
|
2699
|
-
expectedProjectContents,
|
2700
|
-
additionalFiles: realizedAdditionalFiles.ToArray(),
|
2701
|
-
additionalFilesExpected: realizedAdditionalFilesExpected.ToArray(),
|
2702
|
-
packages: packages,
|
2703
|
-
expectedResult: expectedResult);
|
2704
|
-
}
|
2705
|
-
}
|
2706
|
-
}
|