Skip to content

Commit 2daec6f

Browse files
dannyvarod_cpdannyvarod_cp
dannyvarod_cp
authored and
dannyvarod_cp
committed
v2.5.0 Enabled including non-project references (e.g. 3rd party libraries under lib), Added Demo.Readme.txt for explaining demo of the various features
git-tfs-id: [https://tfs.codeplex.com/tfs/tfs27]$/pubcomp/Building;C29166
1 parent e7ab874 commit 2daec6f

13 files changed

+307
-118
lines changed

Building.sln

+21-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1111
ProjectSection(SolutionItems) = preProject
1212
.tfignore = .tfignore
1313
Data.txt = Data.txt
14+
Demo.Readme.txt = Demo.Readme.txt
1415
DemoVersionInfo.cs = DemoVersionInfo.cs
1516
VersionHistory.txt = VersionHistory.txt
1617
VersionInfo.cs = VersionInfo.cs
@@ -37,9 +38,17 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo.Package2.NuGet", "Demo
3738
EndProject
3839
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{92F43E67-AED8-4353-B2F9-61138C5AAFC4}"
3940
EndProject
41+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo.Binary1", "Demo.Binary1\Demo.Binary1.csproj", "{390AB87B-8AB1-45E7-A444-04EACB7F7F69}"
42+
EndProject
43+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Dependencies", "Dependencies", "{8B8778A0-C4F1-4564-A99D-CFEF3517F45C}"
44+
ProjectSection(SolutionItems) = preProject
45+
Dependencies\PubComp.Building.Demo.Binary1.dll = Dependencies\PubComp.Building.Demo.Binary1.dll
46+
Dependencies\PubComp.Building.Demo.Binary1.pdb = Dependencies\PubComp.Building.Demo.Binary1.pdb
47+
EndProjectSection
48+
EndProject
4049
Global
4150
GlobalSection(TeamFoundationVersionControl) = preSolution
42-
SccNumberOfProjects = 8
51+
SccNumberOfProjects = 9
4352
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
4453
SccTeamFoundationServer = https://tfs.codeplex.com/tfs/tfs27
4554
SccLocalPath0 = .
@@ -70,6 +79,10 @@ Global
7079
SccProjectTopLevelParentUniqueName7 = Building.sln
7180
SccProjectName7 = Demo.Package2.NuGet
7281
SccLocalPath7 = Demo.Package2.NuGet
82+
SccProjectUniqueName8 = Demo.Binary1\\Demo.Binary1.csproj
83+
SccProjectTopLevelParentUniqueName8 = Building.sln
84+
SccProjectName8 = Demo.Binary1
85+
SccLocalPath8 = Demo.Binary1
7386
EndGlobalSection
7487
GlobalSection(SolutionConfigurationPlatforms) = preSolution
7588
Debug|Any CPU = Debug|Any CPU
@@ -104,16 +117,22 @@ Global
104117
{86666499-C05D-4B93-B955-08196EFA737D}.Debug|Any CPU.Build.0 = Debug|Any CPU
105118
{86666499-C05D-4B93-B955-08196EFA737D}.Release|Any CPU.ActiveCfg = Release|Any CPU
106119
{86666499-C05D-4B93-B955-08196EFA737D}.Release|Any CPU.Build.0 = Release|Any CPU
120+
{390AB87B-8AB1-45E7-A444-04EACB7F7F69}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
121+
{390AB87B-8AB1-45E7-A444-04EACB7F7F69}.Debug|Any CPU.Build.0 = Debug|Any CPU
122+
{390AB87B-8AB1-45E7-A444-04EACB7F7F69}.Release|Any CPU.ActiveCfg = Release|Any CPU
123+
{390AB87B-8AB1-45E7-A444-04EACB7F7F69}.Release|Any CPU.Build.0 = Release|Any CPU
107124
EndGlobalSection
108125
GlobalSection(SolutionProperties) = preSolution
109126
HideSolutionNode = FALSE
110127
EndGlobalSection
111128
GlobalSection(NestedProjects) = preSolution
129+
{EBDA70BF-FAAD-4E23-B8D4-79299D049755} = {92F43E67-AED8-4353-B2F9-61138C5AAFC4}
130+
{8B8778A0-C4F1-4564-A99D-CFEF3517F45C} = {47B3A300-8E8D-44FD-8391-657BD15F3E49}
112131
{B0F71956-487C-47BD-84B5-C0CF9F423A12} = {D2BDB301-DA26-4025-ADC2-2AFBD077B93E}
113132
{8E1E32DE-D870-4681-8C43-9E725FC4481A} = {D2BDB301-DA26-4025-ADC2-2AFBD077B93E}
114133
{6B73E931-E155-4F8E-ADEF-83E8E7BB53E4} = {D2BDB301-DA26-4025-ADC2-2AFBD077B93E}
115134
{7812FFE0-3D9D-4B93-89F8-770C7B0E92D8} = {D2BDB301-DA26-4025-ADC2-2AFBD077B93E}
116135
{86666499-C05D-4B93-B955-08196EFA737D} = {D2BDB301-DA26-4025-ADC2-2AFBD077B93E}
117-
{EBDA70BF-FAAD-4E23-B8D4-79299D049755} = {92F43E67-AED8-4353-B2F9-61138C5AAFC4}
136+
{390AB87B-8AB1-45E7-A444-04EACB7F7F69} = {D2BDB301-DA26-4025-ADC2-2AFBD077B93E}
118137
EndGlobalSection
119138
EndGlobal

Demo.Binary1/Demo.Binary1.csproj

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{390AB87B-8AB1-45E7-A444-04EACB7F7F69}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>PubComp.Building.Demo.Binary1</RootNamespace>
11+
<AssemblyName>PubComp.Building.Demo.Binary1</AssemblyName>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<SccProjectName>SAK</SccProjectName>
15+
<SccLocalPath>SAK</SccLocalPath>
16+
<SccAuxPath>SAK</SccAuxPath>
17+
<SccProvider>SAK</SccProvider>
18+
</PropertyGroup>
19+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
20+
<DebugSymbols>true</DebugSymbols>
21+
<DebugType>full</DebugType>
22+
<Optimize>false</Optimize>
23+
<OutputPath>bin\Debug\</OutputPath>
24+
<DefineConstants>DEBUG;TRACE</DefineConstants>
25+
<ErrorReport>prompt</ErrorReport>
26+
<WarningLevel>4</WarningLevel>
27+
</PropertyGroup>
28+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
29+
<DebugType>pdbonly</DebugType>
30+
<Optimize>true</Optimize>
31+
<OutputPath>bin\Release\</OutputPath>
32+
<DefineConstants>TRACE</DefineConstants>
33+
<ErrorReport>prompt</ErrorReport>
34+
<WarningLevel>4</WarningLevel>
35+
</PropertyGroup>
36+
<ItemGroup>
37+
<Reference Include="System" />
38+
<Reference Include="System.Core" />
39+
<Reference Include="System.Xml.Linq" />
40+
<Reference Include="System.Data.DataSetExtensions" />
41+
<Reference Include="Microsoft.CSharp" />
42+
<Reference Include="System.Data" />
43+
<Reference Include="System.Xml" />
44+
</ItemGroup>
45+
<ItemGroup>
46+
<Compile Include="Properties\AssemblyInfo.cs" />
47+
</ItemGroup>
48+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
49+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
50+
Other similar extension points exist, see Microsoft.Common.targets.
51+
<Target Name="BeforeBuild">
52+
</Target>
53+
<Target Name="AfterBuild">
54+
</Target>
55+
-->
56+
</Project>
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
""
2+
{
3+
"FILE_VERSION" = "9237"
4+
"ENLISTMENT_CHOICE" = "NEVER"
5+
"PROJECT_FILE_RELATIVE_PATH" = ""
6+
"NUMBER_OF_EXCLUDED_FILES" = "0"
7+
"ORIGINAL_PROJECT_FILE_PATH" = ""
8+
"NUMBER_OF_NESTED_PROJECTS" = "0"
9+
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
10+
}
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("Demo.Binary1")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("Demo.Binary1")]
13+
[assembly: AssemblyCopyright("Copyright © 2014")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("6065e8b8-6ea0-456d-b4ac-0d4af2e2cd50")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

Demo.Package1.NuGet/Demo.Package1.NuGet.csproj

+6
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@
5252
<Content Include="..\Data.txt">
5353
<Link>content\Data.txt</Link>
5454
</Content>
55+
<Content Include="..\Dependencies\PubComp.Building.Demo.Binary1.dll">
56+
<Link>lib\PubComp.Building.Demo.Binary1.dll</Link>
57+
</Content>
58+
<Content Include="..\Dependencies\PubComp.Building.Demo.Binary1.pdb">
59+
<Link>lib\PubComp.Building.Demo.Binary1.pdb</Link>
60+
</Content>
5561
<Content Include="content\Info.txt" />
5662
<None Include="content\SubContent\Other.txt" />
5763
</ItemGroup>

Demo.Readme.txt

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Demo.Library1, Demo.Library2, Demo.Library3:
2+
* are examples of projects in the solution that we want to include in NuGet packages
3+
* get their version number from DemoVersionInfo.cs which is shared with Demo.Library1, Demo.Library2, Demo.Library3
4+
5+
Demo.Package1.NuGet, Demo.Package2.NuGet:
6+
* are examples of NuGet projects, for creating a NuGet package
7+
* are based on the standard Class Library template
8+
* to create packages automatically during build, add the following post-build event command line to your NuGet projects:
9+
"$(SolutionDir)NuGetPack.exe" "$(ProjectPath)" "$(TargetPath)" $(ConfigurationName)
10+
(Copy NuGetPack.exe to your solution folder and place it under Solution Items to have it added to your source control)
11+
12+
Demo.Package1:
13+
* a NuGet package created by NuGet project Demo.Package1.NuGet
14+
* will include Demo.Library1, Demo.Library2 (via project references) and their external NuGet dependencies (total 6 dependencies)
15+
* gets its version number from DemoVersionInfo.cs which is shared with Demo.Library1, Demo.Library2, Demo.Library3
16+
* gets its metadata from its AssemblyInfo.cs
17+
* includes content via content folder (both files and linked files in example)
18+
* includes a "3rd party" non-NuGet .NET assembly (Demo.Binary1) via lib folder (linked files in example)
19+
20+
Demo.Package2:
21+
* a NuGet package created by NuGet project Demo.Package2.NuGet
22+
* will include Demo.Library3 (via project reference) and its external NuGet dependencies (none)
23+
* includes direct external NuGet dependencies via its own packages.config
24+
* includes an internal NuGet dependency (Demo.Package1) via its own internalPackages.config
25+
* gets its version number from DemoVersionInfo.cs which is shared with Demo.Library1, Demo.Library2, Demo.Library3
26+
* gets its metadata from its NuGetPack.config
27+
* includes framework reference System.Xaml (option is set on via NuGetPack.config)
Binary file not shown.
7.5 KB
Binary file not shown.

NuGetPack.UnitTests/NuGetPackTests.cs

+51-3
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,10 @@ public void TestGetDependenciesViaReferenceOuter2()
204204

205205
#endregion
206206

207+
#region Package content (lib, content, ...)
208+
207209
[TestMethod]
208-
public void TestGetContentFiles()
210+
public void TestGetContentFiles1()
209211
{
210212
var creator = new NuspecCreator();
211213
var results = creator.GetContentFiles(
@@ -234,10 +236,55 @@ public void TestGetContentFiles()
234236
}
235237

236238
[TestMethod]
237-
public void TestGetBinaryFiles()
239+
public void TestGetContentFiles2()
240+
{
241+
var creator = new NuspecCreator();
242+
var results = creator.GetContentFiles(
243+
Path.GetDirectoryName(nuProj2Dll), @"..\..", nuProj2Csproj);
244+
245+
LinqAssert.Count(results, 0);
246+
}
247+
248+
[TestMethod]
249+
public void TestGetBinaryFiles1()
238250
{
239251
var creator = new NuspecCreator();
240252
var results = creator.GetBinaryFiles(
253+
Path.GetDirectoryName(nuProj1Dll), @"..\..", nuProj1Csproj);
254+
255+
var path = isLocal ? @"..\..\..\Dependencies\" : @"..\..\Dependencies\";
256+
257+
LinqAssert.Count(results, 2);
258+
var elements = results.Select(el => el.Element).ToList();
259+
260+
LinqAssert.Any(elements, el =>
261+
el.Name == "file"
262+
&& el.Attribute("src").Value == path + @"PubComp.Building.Demo.Binary1.dll"
263+
&& el.Attribute("target").Value == @"lib\net45\PubComp.Building.Demo.Binary1.dll",
264+
"Found: " + results.First());
265+
266+
LinqAssert.Any(elements, el =>
267+
el.Name == "file"
268+
&& el.Attribute("src").Value == path + @"PubComp.Building.Demo.Binary1.pdb"
269+
&& el.Attribute("target").Value == @"lib\net45\PubComp.Building.Demo.Binary1.pdb",
270+
"Found: " + results.First());
271+
}
272+
273+
[TestMethod]
274+
public void TestGetBinaryFiles2()
275+
{
276+
var creator = new NuspecCreator();
277+
var results = creator.GetBinaryFiles(
278+
Path.GetDirectoryName(nuProj2Dll), @"..\..", nuProj2Csproj);
279+
280+
LinqAssert.Count(results, 0);
281+
}
282+
283+
[TestMethod]
284+
public void TestGetBinaryReferences()
285+
{
286+
var creator = new NuspecCreator();
287+
var results = creator.GetBinaryReferences(
241288
Path.GetDirectoryName(nuProj1Dll), @"..\..\..\Demo.Library3", proj3Csproj, isDebug, Path.GetDirectoryName(proj3Dll));
242289

243290
var path = isLocal ? @"..\..\..\Demo.Library3\bin\" : @"..\..\Demo.Library3\bin\";
@@ -332,14 +379,15 @@ public void TestGetFiles()
332379
Assert.AreNotEqual(0, results.Count());
333380
var files = results.Where(el =>
334381
el.ElementType != ElementType.NuGetDependency
335-
&& el.ElementType != ElementType.AssemblyReference
336382
&& el.ElementType != ElementType.FrameworkReference)
337383
.ToList();
338384
var elements = files.Select(el => el.Element).ToList();
339385

340386
LinqAssert.All(elements, r => File.Exists(Path.Combine(nuspecFolder, r.Attribute("src").Value)));
341387
}
342388

389+
#endregion
390+
343391
#region Create Ouput Tests
344392

345393
[TestMethod]

NuGetPack/ElementType.cs

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ public enum ElementType
1414
ToolsFile,
1515
BuildFile,
1616
FrameworkReference,
17-
AssemblyReference,
1817
NuGetDependency
1918
}
2019
}

0 commit comments

Comments
 (0)