Skip to content

Commit

Permalink
v2.5.0 Enabled including non-project references (e.g. 3rd party libra…
Browse files Browse the repository at this point in the history
…ries 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
  • Loading branch information
dannyvarod_cp authored and dannyvarod_cp committed Oct 28, 2014
1 parent e7ab874 commit 2daec6f
Show file tree
Hide file tree
Showing 13 changed files with 307 additions and 118 deletions.
23 changes: 21 additions & 2 deletions Building.sln
Expand Up @@ -11,6 +11,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ProjectSection(SolutionItems) = preProject
.tfignore = .tfignore
Data.txt = Data.txt
Demo.Readme.txt = Demo.Readme.txt
DemoVersionInfo.cs = DemoVersionInfo.cs
VersionHistory.txt = VersionHistory.txt
VersionInfo.cs = VersionInfo.cs
Expand All @@ -37,9 +38,17 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo.Package2.NuGet", "Demo
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{92F43E67-AED8-4353-B2F9-61138C5AAFC4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo.Binary1", "Demo.Binary1\Demo.Binary1.csproj", "{390AB87B-8AB1-45E7-A444-04EACB7F7F69}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Dependencies", "Dependencies", "{8B8778A0-C4F1-4564-A99D-CFEF3517F45C}"
ProjectSection(SolutionItems) = preProject
Dependencies\PubComp.Building.Demo.Binary1.dll = Dependencies\PubComp.Building.Demo.Binary1.dll
Dependencies\PubComp.Building.Demo.Binary1.pdb = Dependencies\PubComp.Building.Demo.Binary1.pdb
EndProjectSection
EndProject
Global
GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects = 8
SccNumberOfProjects = 9
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
SccTeamFoundationServer = https://tfs.codeplex.com/tfs/tfs27
SccLocalPath0 = .
Expand Down Expand Up @@ -70,6 +79,10 @@ Global
SccProjectTopLevelParentUniqueName7 = Building.sln
SccProjectName7 = Demo.Package2.NuGet
SccLocalPath7 = Demo.Package2.NuGet
SccProjectUniqueName8 = Demo.Binary1\\Demo.Binary1.csproj
SccProjectTopLevelParentUniqueName8 = Building.sln
SccProjectName8 = Demo.Binary1
SccLocalPath8 = Demo.Binary1
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -104,16 +117,22 @@ Global
{86666499-C05D-4B93-B955-08196EFA737D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{86666499-C05D-4B93-B955-08196EFA737D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{86666499-C05D-4B93-B955-08196EFA737D}.Release|Any CPU.Build.0 = Release|Any CPU
{390AB87B-8AB1-45E7-A444-04EACB7F7F69}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{390AB87B-8AB1-45E7-A444-04EACB7F7F69}.Debug|Any CPU.Build.0 = Debug|Any CPU
{390AB87B-8AB1-45E7-A444-04EACB7F7F69}.Release|Any CPU.ActiveCfg = Release|Any CPU
{390AB87B-8AB1-45E7-A444-04EACB7F7F69}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{EBDA70BF-FAAD-4E23-B8D4-79299D049755} = {92F43E67-AED8-4353-B2F9-61138C5AAFC4}
{8B8778A0-C4F1-4564-A99D-CFEF3517F45C} = {47B3A300-8E8D-44FD-8391-657BD15F3E49}
{B0F71956-487C-47BD-84B5-C0CF9F423A12} = {D2BDB301-DA26-4025-ADC2-2AFBD077B93E}
{8E1E32DE-D870-4681-8C43-9E725FC4481A} = {D2BDB301-DA26-4025-ADC2-2AFBD077B93E}
{6B73E931-E155-4F8E-ADEF-83E8E7BB53E4} = {D2BDB301-DA26-4025-ADC2-2AFBD077B93E}
{7812FFE0-3D9D-4B93-89F8-770C7B0E92D8} = {D2BDB301-DA26-4025-ADC2-2AFBD077B93E}
{86666499-C05D-4B93-B955-08196EFA737D} = {D2BDB301-DA26-4025-ADC2-2AFBD077B93E}
{EBDA70BF-FAAD-4E23-B8D4-79299D049755} = {92F43E67-AED8-4353-B2F9-61138C5AAFC4}
{390AB87B-8AB1-45E7-A444-04EACB7F7F69} = {D2BDB301-DA26-4025-ADC2-2AFBD077B93E}
EndGlobalSection
EndGlobal
56 changes: 56 additions & 0 deletions Demo.Binary1/Demo.Binary1.csproj
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{390AB87B-8AB1-45E7-A444-04EACB7F7F69}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PubComp.Building.Demo.Binary1</RootNamespace>
<AssemblyName>PubComp.Building.Demo.Binary1</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
10 changes: 10 additions & 0 deletions Demo.Binary1/Demo.Binary1.csproj.vspscc
@@ -0,0 +1,10 @@
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = ""
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}
36 changes: 36 additions & 0 deletions Demo.Binary1/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Demo.Binary1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Demo.Binary1")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6065e8b8-6ea0-456d-b4ac-0d4af2e2cd50")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
6 changes: 6 additions & 0 deletions Demo.Package1.NuGet/Demo.Package1.NuGet.csproj
Expand Up @@ -52,6 +52,12 @@
<Content Include="..\Data.txt">
<Link>content\Data.txt</Link>
</Content>
<Content Include="..\Dependencies\PubComp.Building.Demo.Binary1.dll">
<Link>lib\PubComp.Building.Demo.Binary1.dll</Link>
</Content>
<Content Include="..\Dependencies\PubComp.Building.Demo.Binary1.pdb">
<Link>lib\PubComp.Building.Demo.Binary1.pdb</Link>
</Content>
<Content Include="content\Info.txt" />
<None Include="content\SubContent\Other.txt" />
</ItemGroup>
Expand Down
27 changes: 27 additions & 0 deletions Demo.Readme.txt
@@ -0,0 +1,27 @@
Demo.Library1, Demo.Library2, Demo.Library3:
* are examples of projects in the solution that we want to include in NuGet packages
* get their version number from DemoVersionInfo.cs which is shared with Demo.Library1, Demo.Library2, Demo.Library3

Demo.Package1.NuGet, Demo.Package2.NuGet:
* are examples of NuGet projects, for creating a NuGet package
* are based on the standard Class Library template
* to create packages automatically during build, add the following post-build event command line to your NuGet projects:
"$(SolutionDir)NuGetPack.exe" "$(ProjectPath)" "$(TargetPath)" $(ConfigurationName)
(Copy NuGetPack.exe to your solution folder and place it under Solution Items to have it added to your source control)

Demo.Package1:
* a NuGet package created by NuGet project Demo.Package1.NuGet
* will include Demo.Library1, Demo.Library2 (via project references) and their external NuGet dependencies (total 6 dependencies)
* gets its version number from DemoVersionInfo.cs which is shared with Demo.Library1, Demo.Library2, Demo.Library3
* gets its metadata from its AssemblyInfo.cs
* includes content via content folder (both files and linked files in example)
* includes a "3rd party" non-NuGet .NET assembly (Demo.Binary1) via lib folder (linked files in example)

Demo.Package2:
* a NuGet package created by NuGet project Demo.Package2.NuGet
* will include Demo.Library3 (via project reference) and its external NuGet dependencies (none)
* includes direct external NuGet dependencies via its own packages.config
* includes an internal NuGet dependency (Demo.Package1) via its own internalPackages.config
* gets its version number from DemoVersionInfo.cs which is shared with Demo.Library1, Demo.Library2, Demo.Library3
* gets its metadata from its NuGetPack.config
* includes framework reference System.Xaml (option is set on via NuGetPack.config)
Binary file not shown.
Binary file added Dependencies/PubComp.Building.Demo.Binary1.pdb
Binary file not shown.
54 changes: 51 additions & 3 deletions NuGetPack.UnitTests/NuGetPackTests.cs
Expand Up @@ -204,8 +204,10 @@ public void TestGetDependenciesViaReferenceOuter2()

#endregion

#region Package content (lib, content, ...)

[TestMethod]
public void TestGetContentFiles()
public void TestGetContentFiles1()
{
var creator = new NuspecCreator();
var results = creator.GetContentFiles(
Expand Down Expand Up @@ -234,10 +236,55 @@ public void TestGetContentFiles()
}

[TestMethod]
public void TestGetBinaryFiles()
public void TestGetContentFiles2()
{
var creator = new NuspecCreator();
var results = creator.GetContentFiles(
Path.GetDirectoryName(nuProj2Dll), @"..\..", nuProj2Csproj);

LinqAssert.Count(results, 0);
}

[TestMethod]
public void TestGetBinaryFiles1()
{
var creator = new NuspecCreator();
var results = creator.GetBinaryFiles(
Path.GetDirectoryName(nuProj1Dll), @"..\..", nuProj1Csproj);

var path = isLocal ? @"..\..\..\Dependencies\" : @"..\..\Dependencies\";

LinqAssert.Count(results, 2);
var elements = results.Select(el => el.Element).ToList();

LinqAssert.Any(elements, el =>
el.Name == "file"
&& el.Attribute("src").Value == path + @"PubComp.Building.Demo.Binary1.dll"
&& el.Attribute("target").Value == @"lib\net45\PubComp.Building.Demo.Binary1.dll",
"Found: " + results.First());

LinqAssert.Any(elements, el =>
el.Name == "file"
&& el.Attribute("src").Value == path + @"PubComp.Building.Demo.Binary1.pdb"
&& el.Attribute("target").Value == @"lib\net45\PubComp.Building.Demo.Binary1.pdb",
"Found: " + results.First());
}

[TestMethod]
public void TestGetBinaryFiles2()
{
var creator = new NuspecCreator();
var results = creator.GetBinaryFiles(
Path.GetDirectoryName(nuProj2Dll), @"..\..", nuProj2Csproj);

LinqAssert.Count(results, 0);
}

[TestMethod]
public void TestGetBinaryReferences()
{
var creator = new NuspecCreator();
var results = creator.GetBinaryReferences(
Path.GetDirectoryName(nuProj1Dll), @"..\..\..\Demo.Library3", proj3Csproj, isDebug, Path.GetDirectoryName(proj3Dll));

var path = isLocal ? @"..\..\..\Demo.Library3\bin\" : @"..\..\Demo.Library3\bin\";
Expand Down Expand Up @@ -332,14 +379,15 @@ public void TestGetFiles()
Assert.AreNotEqual(0, results.Count());
var files = results.Where(el =>
el.ElementType != ElementType.NuGetDependency
&& el.ElementType != ElementType.AssemblyReference
&& el.ElementType != ElementType.FrameworkReference)
.ToList();
var elements = files.Select(el => el.Element).ToList();

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

#endregion

#region Create Ouput Tests

[TestMethod]
Expand Down
1 change: 0 additions & 1 deletion NuGetPack/ElementType.cs
Expand Up @@ -14,7 +14,6 @@ public enum ElementType
ToolsFile,
BuildFile,
FrameworkReference,
AssemblyReference,
NuGetDependency
}
}

0 comments on commit 2daec6f

Please sign in to comment.