Skip to content

Commit b473de0

Browse files
committed
CSHARP-2400: Build Nuget packages from .csproj files instead of from .nuspec files.
1 parent d864511 commit b473de0

File tree

11 files changed

+85
-225
lines changed

11 files changed

+85
-225
lines changed

build.cake

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -253,23 +253,24 @@ Task("PackageNugetPackages")
253253
EnsureDirectoryExists(artifactsPackagesDirectory);
254254
CleanDirectory(artifactsPackagesDirectory);
255255

256-
var packageVersion = gitVersion.NuGetVersion;
257-
258-
var nuspecFiles = GetFiles("./Build/*.nuspec");
259-
foreach (var nuspecFile in nuspecFiles)
256+
var projects = new[]
260257
{
261-
var tempNuspecFilename = nuspecFile.GetFilenameWithoutExtension().ToString() + "." + packageVersion + ".nuspec";
262-
var tempNuspecFile = artifactsPackagesDirectory.CombineWithFilePath(tempNuspecFilename);
263-
264-
CopyFile(nuspecFile, tempNuspecFile);
265-
ReplaceTextInFiles(tempNuspecFile.ToString(), "@driverPackageVersion@", packageVersion);
266-
ReplaceTextInFiles(tempNuspecFile.ToString(), "@solutionDirectory@", solutionDirectory.FullPath);
258+
"MongoDB.Bson",
259+
"MongoDB.Driver.Core",
260+
"MongoDB.Driver",
261+
"MongoDB.Driver.GridFS",
262+
"MongoDB.Driver.Legacy"
263+
};
267264

268-
NuGetPack(tempNuspecFile, new NuGetPackSettings
265+
foreach (var project in projects)
266+
{
267+
var projectPath = $"{srcDirectory}\\{project}\\{project}.csproj";
268+
var settings = new DotNetCorePackSettings
269269
{
270-
OutputDirectory = artifactsPackagesDirectory,
271-
Symbols = true
272-
});
270+
Configuration = configuration,
271+
OutputDirectory = artifactsPackagesDirectory
272+
};
273+
DotNetCorePack(projectPath, settings);
273274
}
274275
});
275276

build/MongoDB.Bson.nuspec

Lines changed: 0 additions & 37 deletions
This file was deleted.

build/MongoDB.Driver.Core.nuspec

Lines changed: 0 additions & 45 deletions
This file was deleted.

build/MongoDB.Driver.GridFS.nuspec

Lines changed: 0 additions & 40 deletions
This file was deleted.

build/MongoDB.Driver.nuspec

Lines changed: 0 additions & 40 deletions
This file was deleted.

build/mongocsharpdriver.nuspec

Lines changed: 0 additions & 45 deletions
This file was deleted.

src/MongoDB.Bson/MongoDB.Bson.csproj

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@
1414
<Company>MongoDB Inc.</Company>
1515
<Copyright>Copyright © 2010-present MongoDB Inc.</Copyright>
1616
<Description>Official MongoDB supported BSON library. See http://www.mongodb.org/display/DOCS/CSharp+Language+Center for more details.</Description>
17+
<Authors>rstam;craiggwilson</Authors>
18+
<PackageIconUrl>http://jobs.mongodb.org/files/logos/889002/889002.png</PackageIconUrl>
19+
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
20+
<PackageDescription>MongoDB's Official Bson Library.</PackageDescription>
21+
<PackageProjectUrl>http://www.mongodb.org/display/DOCS/CSharp+Language+Center</PackageProjectUrl>
22+
<PackageLicenseFile>License.txt</PackageLicenseFile>
23+
<PackageTags>mongodb;mongo;nosql;bson</PackageTags>
24+
<PackageLanguage>en-US</PackageLanguage>
25+
<IncludeSymbols>true</IncludeSymbols>
1726
</PropertyGroup>
1827

1928
<PropertyGroup Condition="'$(Version)'==''">
@@ -33,7 +42,7 @@
3342
</PropertyGroup>
3443

3544
<ItemGroup>
36-
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.1" />
45+
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.1" PrivateAssets="All" />
3746
</ItemGroup>
3847

3948
<ItemGroup Condition="'$(TargetFramework)'=='netstandard1.5'">
@@ -47,4 +56,8 @@
4756
<Compile Include="..\MongoDB.Shared\Hasher.cs" Link="Hasher.cs" />
4857
</ItemGroup>
4958

59+
<ItemGroup>
60+
<None Include="..\..\License.txt" Pack="true" PackagePath="$(PackageLicenseFile)" />
61+
</ItemGroup>
62+
5063
</Project>

src/MongoDB.Driver.Core/MongoDB.Driver.Core.csproj

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@
1414
<Company>MongoDB Inc.</Company>
1515
<Copyright>Copyright © 2010-present MongoDB Inc.</Copyright>
1616
<Description>Official MongoDB supported Driver Core library. See http://www.mongodb.org/display/DOCS/CSharp+Language+Center for more details.</Description>
17+
<Authors>rstam;craiggwilson</Authors>
18+
<PackageIconUrl>http://jobs.mongodb.org/files/logos/889002/889002.png</PackageIconUrl>
19+
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
20+
<PackageDescription>Core Component of the Official MongoDB .NET Driver.</PackageDescription>
21+
<PackageProjectUrl>http://www.mongodb.org/display/DOCS/CSharp+Language+Center</PackageProjectUrl>
22+
<PackageLicenseFile>License.txt</PackageLicenseFile>
23+
<PackageTags>mongodb;mongo;nosql</PackageTags>
24+
<PackageLanguage>en-US</PackageLanguage>
25+
<IncludeSymbols>true</IncludeSymbols>
1726
</PropertyGroup>
1827

1928
<PropertyGroup Condition="'$(Version)'==''">
@@ -34,7 +43,7 @@
3443

3544
<ItemGroup>
3645
<PackageReference Include="DnsClient" Version="1.0.7" />
37-
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.1" />
46+
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.1" PrivateAssets="All" />
3847
</ItemGroup>
3948

4049
<ItemGroup Condition="'$(TargetFramework)' == 'net452'">
@@ -60,4 +69,8 @@
6069
<Compile Include="..\MongoDB.Shared\MaxTimeHelper.cs" Link="Core\Operations\MaxTimeHelper.cs" />
6170
</ItemGroup>
6271

72+
<ItemGroup>
73+
<None Include="..\..\License.txt" Pack="true" PackagePath="$(PackageLicenseFile)" />
74+
</ItemGroup>
75+
6376
</Project>

src/MongoDB.Driver.GridFS/MongoDB.Driver.GridFS.csproj

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@
1414
<Company>MongoDB Inc.</Company>
1515
<Copyright>Copyright © 2010-present MongoDB Inc.</Copyright>
1616
<Description>Official MongoDB supported driver for MongoDB GridFS implementation. See http://www.mongodb.org/display/DOCS/CSharp+Language+Center for more details.</Description>
17+
<Authors>rstam;craiggwilson</Authors>
18+
<PackageIconUrl>http://jobs.mongodb.org/files/logos/889002/889002.png</PackageIconUrl>
19+
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
20+
<PackageDescription>GridFS Component of the Official MongoDB .NET Driver.</PackageDescription>
21+
<PackageProjectUrl>http://www.mongodb.org/display/DOCS/CSharp+Language+Center</PackageProjectUrl>
22+
<PackageLicenseFile>License.txt</PackageLicenseFile>
23+
<PackageTags>mongodb;mongo;nosql;gridfs</PackageTags>
24+
<PackageLanguage>en-US</PackageLanguage>
25+
<IncludeSymbols>true</IncludeSymbols>
1726
</PropertyGroup>
1827

1928
<PropertyGroup Condition="'$(Version)'==''">
@@ -33,7 +42,7 @@
3342
</PropertyGroup>
3443

3544
<ItemGroup>
36-
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.1" />
45+
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.1" PrivateAssets="All" />
3746
</ItemGroup>
3847

3948
<ItemGroup>
@@ -46,4 +55,8 @@
4655
<Compile Include="..\MongoDB.Shared\IncrementalMD5.cs" Link="IncrementalMD5.cs" />
4756
</ItemGroup>
4857

58+
<ItemGroup>
59+
<None Include="..\..\License.txt" Pack="true" PackagePath="$(PackageLicenseFile)" />
60+
</ItemGroup>
61+
4962
</Project>

src/MongoDB.Driver.Legacy/MongoDB.Driver.Legacy.csproj

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@
1414
<Company>MongoDB Inc.</Company>
1515
<Copyright>Copyright © 2010-present MongoDB Inc.</Copyright>
1616
<Description>Legacy MongoDB supported driver for MongoDB. See http://www.mongodb.org/display/DOCS/CSharp+Language+Center for more details.</Description>
17+
<Authors>rstam;craiggwilson</Authors>
18+
<PackageId>mongocsharpdriver</PackageId>
19+
<PackageIconUrl>http://jobs.mongodb.org/files/logos/889002/889002.png</PackageIconUrl>
20+
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
21+
<PackageDescription>This package contains the legacy driver. The new driver's package name is MongoDB.Driver</PackageDescription>
22+
<PackageProjectUrl>http://www.mongodb.org/display/DOCS/CSharp+Language+Center</PackageProjectUrl>
23+
<PackageLicenseFile>License.txt</PackageLicenseFile>
24+
<PackageTags></PackageTags>
25+
<PackageLanguage>en-US</PackageLanguage>
26+
<IncludeSymbols>true</IncludeSymbols>
1727
</PropertyGroup>
1828

1929
<PropertyGroup Condition="'$(Version)'==''">
@@ -43,4 +53,8 @@
4353
<Compile Include="..\MongoDB.Shared\MaxTimeHelper.cs" Link="MaxTimeHelper.cs" />
4454
</ItemGroup>
4555

56+
<ItemGroup>
57+
<None Include="..\..\License.txt" Pack="true" PackagePath="$(PackageLicenseFile)" />
58+
</ItemGroup>
59+
4660
</Project>

0 commit comments

Comments
 (0)