Skip to content
This repository has been archived by the owner on Feb 17, 2022. It is now read-only.

Commit

Permalink
v2.2.0-a1 (VS2010 and WP7 compatible, not only VS2012 and VS2013)
Browse files Browse the repository at this point in the history
- Supporting .Net451, .Net452, SL40WP70 and SL40WP71 projects
- Default TargetFrameworkVersion is 4.0 to properly support VS2010
- supporting PreBuildEvent and PostBuildEvent brentspell#39 (transform on build is
removed)
- .nuspec templates are UTF-8 brentspell#52

- VSSDK.Shell.10 NuGet package is added to Package.csproj to properly
build for VS2010 under VS2012
- NuGet.Core updated from 2.8.0 to 2.8.1
- Proper handling of OutputPath and OutDir properties in NuBuild.targets
- detailed error messages during build

Issues:
- serialization exception during VS2010 build
- automatic dependency calculation screws up with mixed SL40WP7x project
types
  • Loading branch information
lmagyar committed May 24, 2014
1 parent 9e917f5 commit 4959e96
Show file tree
Hide file tree
Showing 19 changed files with 363 additions and 297 deletions.
2 changes: 1 addition & 1 deletion Install/NuBuild.wxs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- See http://stackoverflow.com/questions/471424/wix-tricks-and-tips -->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?define ProductVersion = "2.1.6"?>
<?define ProductVersion = "2.2.0"?>
<Product Id="*"
UpgradeCode="1948F590-CD4C-4279-9466-5A172FEA8FCE"
Name="NuBuild Project System"
Expand Down
59 changes: 34 additions & 25 deletions MSBuild/Config/NuBuild.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<!-- NuBuild Tasks -->
<Import Project="$(MSBuildThisFileDirectory)\NuBuild.tasks" />
<!-- MSBuild 4.5 Properties -->
<PropertyGroup>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">obj\</BaseIntermediateOutputPath>
<!-- old project files do not include MS.Common.targets, GenerateProjectSpecificOutputFolder has to be handled here only in that case (OutDirWasSpecified=='') -->
<OutputPath Condition="'$(OutDir)' != '' AND ('$(OutDirWasSpecified)' == '' AND '$(GenerateProjectSpecificOutputFolder)' == 'true')">$(OutDir)\$(MSBuildProjectName)</OutputPath>
<OutputPath Condition="'$(OutDir)' != '' AND ('$(OutDirWasSpecified)' != '' OR '$(GenerateProjectSpecificOutputFolder)' != 'true')">$(OutDir)</OutputPath>
</PropertyGroup>
<!-- NuBuild Properties -->
<PropertyGroup>
<OutputPath Condition="'$(OutputPath)' != '' and !HasTrailingSlash('$(OutputPath)')">$(OutputPath)\</OutputPath>
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
<TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == ''">v4.5</TargetFrameworkVersion>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">obj\</BaseIntermediateOutputPath>
<OutputPath Condition=" '$(OutputPath)'=='' ">bin\</OutputPath>
<OutDir Condition=" '$(OutDir)' == '' ">$(OutputPath)</OutDir>
<OutDir Condition=" '$(OutDir)' != '' AND !HasTrailingSlash('$(OutDir)') ">$(OutDir)\</OutDir>
<!-- old project files do not include MS.Common.targets, MSBuild 4.5 GenerateProjectSpecificOutputFolder has to be handled here only in that case (OutDirWasSpecified=='') -->
<OutDir Condition=" '$(OutDir)' != '' AND '$(OutDirWasSpecified)' == '' AND '$(GenerateProjectSpecificOutputFolder)' == 'true' ">$(OutDir)$(MSBuildProjectName)\</OutDir>
<!-- Property: NuBuildVersionSource
. specifies whether/how the package version string is generated
. Manual: manage in .nuspec file by hand
Expand Down Expand Up @@ -45,9 +40,10 @@
. specifies whether to add executables to lib folder instead of tools folder
-->
<NuBuildAddExecutablesToLibFolder Condition="'$(NuBuildAddExecutablesToLibFolder)' == ''">false</NuBuildAddExecutablesToLibFolder>
<TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
<TargetFrameworkMoniker Condition="'$(TargetFrameworkMoniker)' == '' and '$(TargetFrameworkProfile)' != ''">$(TargetFrameworkIdentifier),Version=$(TargetFrameworkVersion),Profile=$(TargetFrameworkProfile)</TargetFrameworkMoniker>
<TargetFrameworkMoniker Condition="'$(TargetFrameworkMoniker)' == ''">$(TargetFrameworkIdentifier),Version=$(TargetFrameworkVersion)</TargetFrameworkMoniker>
<TargetFrameworkIdentifier Condition="'$(TargetFrameworkIdentifier)' == '' ">.NETFramework</TargetFrameworkIdentifier>
<TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == '' ">v4.0</TargetFrameworkVersion>
<TargetFrameworkMoniker Condition="'$(TargetFrameworkMoniker)' == '' and '$(TargetFrameworkProfile)' != '' ">$(TargetFrameworkIdentifier),Version=$(TargetFrameworkVersion),Profile=$(TargetFrameworkProfile)</TargetFrameworkMoniker>
<TargetFrameworkMoniker Condition="'$(TargetFrameworkMoniker)' == '' ">$(TargetFrameworkIdentifier),Version=$(TargetFrameworkVersion)</TargetFrameworkMoniker>
</PropertyGroup>
<!-- Target: GetCopyToOutputDirectoryItems
. determines additional files to output directory
Expand All @@ -58,8 +54,8 @@
<Output TaskParameter="AssignedFiles" ItemName="ContentWithTargetPath" />
</AssignTargetPath>
<ItemGroup>
<_SourceItemsToCopyToOutputDirectoryAlways KeepMetadata="CopyToOutputDirectory;TargetPath" Include="@(ContentWithTargetPath->'%(FullPath)')" Condition="'%(ContentWithTargetPath.CopyToOutputDirectory)'=='Always'"/>
<_SourceItemsToCopyToOutputDirectory KeepMetadata="CopyToOutputDirectory;TargetPath" Include="@(ContentWithTargetPath->'%(FullPath)')" Condition="'%(ContentWithTargetPath.CopyToOutputDirectory)'=='PreserveNewest'"/>
<_SourceItemsToCopyToOutputDirectoryAlways Include="@(ContentWithTargetPath->'%(FullPath)')" Condition="'%(ContentWithTargetPath.CopyToOutputDirectory)'=='Always'"/>
<_SourceItemsToCopyToOutputDirectory Include="@(ContentWithTargetPath->'%(FullPath)')" Condition="'%(ContentWithTargetPath.CopyToOutputDirectory)'=='PreserveNewest'"/>
</ItemGroup>
<ItemGroup>
<CopyToOutputDirectoryItems Include="@(_SourceItemsToCopyToOutputDirectoryAlways->'%(FullPath)');@(_SourceItemsToCopyToOutputDirectory->'%(FullPath)')"/>
Expand All @@ -80,7 +76,7 @@
VersionSource="$(NuBuildVersionSource)"
VersionFileName="$(NuBuildVersionFileName)"
IntermediateOutputPath="$(BaseIntermediateOutputPath)"
OutputPath="$(OutputPath)"
OutputPath="$(OutDir)"
BuildNumber="$(BuildNumber)"
ReferenceLibraries="@(__ReferenceLibraries)">
<Output TaskParameter="Prepared" ItemName="NuPrepared"/>
Expand All @@ -91,7 +87,7 @@
<NuSources Include="$(MSBuildProjectFile);"/>
</ItemGroup>
<ItemGroup>
<NuTargets Include="@(CopyToOutputDirectoryItems->'$(OutputPath)%(TargetPath)');"/>
<NuTargets Include="@(CopyToOutputDirectoryItems->'$(OutDir)%(TargetPath)');"/>
</ItemGroup>
<Message Text="NuSources: @(NuSources)"/>
<Message Text="NuTargets: @(NuTargets)"/>
Expand All @@ -107,7 +103,7 @@
<Output TaskParameter="Targets" ItemName="NuTargets"/>
</NuPrepareClean>
<ItemGroup>
<NuTargets Include="@(CopyToOutputDirectoryItems->'$(OutputPath)%(TargetPath)');"/>
<NuTargets Include="@(CopyToOutputDirectoryItems->'$(OutDir)%(TargetPath)');"/>
</ItemGroup>
<Message Text="NuTargets: @(NuTargets)"/>
</Target>
Expand All @@ -122,14 +118,24 @@
. creates a .nupkg file for each .nuspec file in the project
-->
<Target Name="Build"
DependsOnTargets="__PrepareBuild;BeforeBuild"
DependsOnTargets="__PrepareBuild;BeforeBuild;CoreBuild;AfterBuild" >
</Target>
<Target Name="CoreBuild"
DependsOnTargets="PreBuildEvent;NuPackage;PostBuildEvent" >
<OnError ExecuteTargets="PostBuildEvent" Condition="'$(RunPostBuildEvent)'=='Always' or '$(RunPostBuildEvent)'=='OnOutputUpdated'"/>
</Target>
<Target Name="PreBuildEvent"
Condition="'$(PreBuildEvent)'!=''" >
<Exec WorkingDirectory="$(OutDir)" Command="$(PreBuildEvent)" />
</Target>
<Target Name="NuPackage"
Inputs="@(NuSources)"
Outputs="@(NuTargets)">
<NuPackage ProjectPath="$(MSBuildProjectFullPath)"
TargetFrameworkMoniker="$(TargetFrameworkMoniker)"
NuSpec="@(NuPrepared)"
Embedded="@(EmbeddedResource)"
OutputPath="$(OutputPath)"
OutputPath="$(OutDir)"
ReferenceProjects="@(ProjectReference)"
ReferenceLibraries="@(__ReferenceLibraries)"
AddBinariesToSubfolder="$(NuBuildAddBinariesToSubfolder)"
Expand All @@ -138,7 +144,10 @@
IncludePdbs="$(NuBuildIncludePdbs)"/>
<Message Text="%(NuPrepared.Filename) -> %(NuPrepared.NuPackagePath)" Importance="high"/>
<CallTarget Targets="__CopySourceItemsToOutputDirectory"/>
<CallTarget Targets="AfterBuild"/>
</Target>
<Target Name="PostBuildEvent"
Condition="'$(PostBuildEvent)' != '' and '$(RunPostBuildEvent)' != 'OnOutputUpdated'" >
<Exec WorkingDirectory="$(OutDir)" Command="$(PostBuildEvent)" />
</Target>
<!-- Target: Rebuild
. runs a clean and then a build
Expand All @@ -153,15 +162,15 @@
<Target Name="__CopyOutOfDateSourceItemsToOutputDirectory"
Condition=" '@(_SourceItemsToCopyToOutputDirectory)' != '' "
Inputs="@(_SourceItemsToCopyToOutputDirectory)"
Outputs="@(_SourceItemsToCopyToOutputDirectory->'$(OutputPath)%(TargetPath)')">
Outputs="@(_SourceItemsToCopyToOutputDirectory->'$(OutDir)%(TargetPath)')">
<Copy SourceFiles = "@(_SourceItemsToCopyToOutputDirectory)"
DestinationFiles = "@(_SourceItemsToCopyToOutputDirectory->'$(OutputPath)%(TargetPath)')"
DestinationFiles = "@(_SourceItemsToCopyToOutputDirectory->'$(OutDir)%(TargetPath)')"
OverwriteReadOnlyFiles="true"/>
</Target>
<Target Name="__CopyOutOfDateSourceItemsToOutputDirectoryAlways"
Condition=" '@(_SourceItemsToCopyToOutputDirectoryAlways)' != '' ">
<Copy SourceFiles = "@(_SourceItemsToCopyToOutputDirectoryAlways)"
DestinationFiles = "@(_SourceItemsToCopyToOutputDirectoryAlways->'$(OutputPath)%(TargetPath)')"
DestinationFiles = "@(_SourceItemsToCopyToOutputDirectoryAlways->'$(OutDir)%(TargetPath)')"
OverwriteReadOnlyFiles="true"/>
</Target>
<!-- Dummy targets required for Visual Studio -->
Expand Down
4 changes: 0 additions & 4 deletions MSBuild/Tasks/NuPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,7 @@ public override Boolean Execute ()
}
catch (Exception e)
{
#if DEBUG
Log.LogError("{0} ({1})", e.ToString(), e.GetType().Name);
#else
Log.LogError("{0} ({1})", e.Message, e.GetType().Name);
#endif
return false;
}
return true;
Expand Down
2 changes: 1 addition & 1 deletion MSBuild/Tasks/NuPrepareBuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public override Boolean Execute ()
}
catch (Exception e)
{
Log.LogError("{0} ({1})", e.Message, e.GetType().Name);
Log.LogError("{0} ({1})", e.ToString(), e.GetType().Name);
return false;
}
return true;
Expand Down
2 changes: 1 addition & 1 deletion MSBuild/Tasks/NuPrepareClean.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public override Boolean Execute ()
}
catch (Exception e)
{
Log.LogError("{0} ({1})", e.Message, e.GetType().Name);
Log.LogError("{0} ({1})", e.ToString(), e.GetType().Name);
return false;
}
return true;
Expand Down
9 changes: 5 additions & 4 deletions MSBuild/Tasks/Tasks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@
<Reference Include="Microsoft.Build.Framework" />
<Reference Include="Microsoft.Build.Utilities.v4.0" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.Web.XmlTransform">
<HintPath>..\..\packages\Microsoft.Web.Xdt.1.0.0\lib\net40\Microsoft.Web.XmlTransform.dll</HintPath>
<Reference Include="Microsoft.Web.XmlTransform, Version=2.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.Web.Xdt.2.1.1\lib\net40\Microsoft.Web.XmlTransform.dll</HintPath>
</Reference>
<Reference Include="NuGet.Core, Version=2.8.50126.400, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Reference Include="NuGet.Core, Version=2.8.50320.36, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\NuGet.Core.2.8.0\lib\net40-Client\NuGet.Core.dll</HintPath>
<HintPath>..\..\packages\NuGet.Core.2.8.1\lib\net40-Client\NuGet.Core.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
Expand Down
2 changes: 1 addition & 1 deletion MSBuild/Tasks/Utility/ProjectFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ private IEnumerable<string> GetReferencesIdentity()
.Where(item =>
{
var identity = item.GetMetadataValue("Identity");
if (defaultReferences.Contains(identity))
if (defaultReferences.Any(reference => string.Compare(reference, identity, true) == 0))
return false;
var copyLocal = item.GetMetadataValue("Private");
if (string.IsNullOrEmpty(copyLocal))
Expand Down
3 changes: 3 additions & 0 deletions MSBuild/Tasks/Utility/ProjectHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ public static class ProjectHelper
"System.Data.DataSetExtensions",
"System.Xml",
"System.Xml.Linq",
"System.Net",
"System.Windows",
"mscorlib.extensions",
};

private static readonly List<string> vbDefaultReferences = new List<string> {
Expand Down
4 changes: 2 additions & 2 deletions MSBuild/Tasks/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Web.Xdt" version="1.0.0" targetFramework="net40" />
<package id="NuGet.Core" version="2.8.0" targetFramework="net40" />
<package id="Microsoft.Web.Xdt" version="2.1.1" targetFramework="net40" />
<package id="NuGet.Core" version="2.8.1" targetFramework="net40" />
</packages>
Binary file modified VS/ItemTemplate/NuSpec/NuSpec.nuspec
Binary file not shown.
Loading

0 comments on commit 4959e96

Please sign in to comment.