diff options
25 files changed, 1049 insertions, 822 deletions
@@ -1,516 +1,45 @@ <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <Import Project="$(MSBuildProjectDirectory)\tools\DotNetOpenAuth.props"/> - <PropertyGroup> - <AutomatedBuild>true</AutomatedBuild> - <SolutionPath>$(ProjectRoot)src\$(ProductName).sln</SolutionPath> - <ILMergeOutputAssemblyDirectory>$(OutputPath)unified\</ILMergeOutputAssemblyDirectory> - <ILMergeOutputAssembly>$(ILMergeOutputAssemblyDirectory)$(ProductName).dll</ILMergeOutputAssembly> - <ProjectTemplatesLayoutPath>$(IntermediatePath)projecttemplates\</ProjectTemplatesLayoutPath> - - <VS2008ProjectTemplatesDirectory>$(IntermediatePath)VS2008projecttemplates\</VS2008ProjectTemplatesDirectory> - <ProjectTemplatesVsiDirectory>$(IntermediatePath)vsi\</ProjectTemplatesVsiDirectory> - - <VS2010ProjectTemplatesDirectory>$(IntermediatePath)VS2010projecttemplates\</VS2010ProjectTemplatesDirectory> - <ExtensionVsixLayoutDirectory>$(IntermediatePath)Vsix\</ExtensionVsixLayoutDirectory> - <ProjectTemplateSubdirectory>$(ExtensionVsixLayoutDirectory)PT\CSharp\Web\</ProjectTemplateSubdirectory> - <ZipLevel>6</ZipLevel> - </PropertyGroup> - - <Import Project="$(ProjectRoot)tools\$(ProductName).Versioning.targets"/> - <Import Project="$(ProjectRoot)tools\Documentation.targets"/> - <Import Project="$(ProjectRoot)tools\Publish.targets"/> + <Import Project="$(MSBuildProjectDirectory)\tools\DotNetOpenAuth.automated.props"/> <Import Project="$(ProjectRoot)tools\Translation.targets"/> - <UsingTask AssemblyFile="$(ProjectRoot)lib\MSBuild.Community.Tasks.dll" TaskName="Zip"/> - <UsingTask AssemblyFile="$(ProjectRoot)lib\MSBuild.Community.Tasks.dll" TaskName="ILMerge"/> - <UsingTask AssemblyFile="$(ProjectRoot)lib\MSBuild.Community.Tasks.dll" TaskName="NUnit" /> <ItemGroup> - <SampleProjects Include="$(ProjectRoot)samples\**\*.csproj;$(ProjectRoot)samples\**\*.vbproj" /> - <SampleSites Include="OAuthConsumer;OAuthServiceProvider;InfoCardRelyingParty" /> - <ProjectTemplates Include="$(ProjectRoot)projecttemplates\**\*.csproj" /> - <ILMergeInputAssemblies Include="$(OutputPath)$(ProductName).dll; - $(ProjectRoot)lib\Microsoft.Contracts.dll; "/> - <DelaySignedAssemblies Include="$(ILMergeOutputAssembly); - $(OutputPath)$(ProductName).dll; - $(OutputPath)$(ProductName).Contracts.dll; - $(OutputPath)$(ProductName).Test.dll; - $(ProjectRoot)samples\OpenIdOfflineProvider\bin\$(Configuration)\OpenIdOfflineProvider.exe" /> - </ItemGroup> - - <Target Name="Clean" DependsOnTargets="CleanDocumentation;UnpublishSamples;UnpublishDocumentation"> - <MSBuild Projects="$(SolutionPath)" Targets="Clean" /> - <ItemGroup> - <DirtyDirectories Include=" + <ProjectsInDrop Include=" + samples\tools.proj; + tools\drop.proj; + " /> + + <ProjectsToClean Include=" + $(SolutionPath); + projecttemplates\projecttemplates.proj; + vsi\vsi.proj; + vsix\vsix.proj; + samples\samples.proj; + doc\doc.proj; + "/> + + <DirectoriesToClean Include=" $(ProjectRoot)bin; $(ProjectRoot)**\obj; $(DropsRoot); $(ProjectRoot)src\PrecompiledWeb; - $(ProjectTemplatesLayoutPath); " /> - <DirtyDirectories Include="@(SampleDirectories->'%(FullPath)\bin')" /> - <DirtyDirectories Include="@(SampleDirectories->'%(FullPath)\obj')" /> - <DirtyFiles Include=" - $(ProjectRoot)**\*~; - $(ProjectRoot)**\*.log*; - $(ProjectRoot)doc\$(ProductName).chm; - " /> - </ItemGroup> - <Delete Files="@(DirtyFiles)" /> - <RemoveDir Directories="@(DirtyDirectories)" /> - </Target> - - <Target Name="SkipVerification" Condition="'$(IsElevated)' == 'true'"> - <SignatureVerification SkipVerification="true" AssemblyName="*" PublicKeyToken="$(PublicKeyToken)" /> - </Target> - - <Target Name="BuildProduct" DependsOnTargets="SkipVerification"> - <MSBuild Projects="$(ProjectRoot)src\$(ProductName)\$(ProductName).csproj" /> - </Target> + <FilesToClean Include=" + $(ProjectRoot)**\*~; + $(ProjectRoot)**\*.log*; + $(ProjectRoot)doc\$(ProductName).chm; + " /> + </ItemGroup> <Target Name="BuildTests" DependsOnTargets="SkipVerification"> - <MSBuild Projects="$(SolutionPath)" Targets="DotNetOpenAuth_Test;DotNetOpenAuth_TestWeb" /> - </Target> - - <Target Name="BuildSamples" DependsOnTargets="SkipVerification"> - <MSBuild Projects="@(SampleProjects)" /> - <MSBuild Projects="$(SolutionPath)" Targets="@(SampleSites)" /> + <MSBuild Projects="$(SolutionPath)" Targets="DotNetOpenAuth_Test;DotNetOpenAuth_TestWeb" BuildInParallel="$(BuildInParallel)" /> </Target> <Target Name="Build" DependsOnTargets="SkipVerification"> - <MSBuild Projects="$(SolutionPath)" /> + <MSBuild Projects="$(SolutionPath)" BuildInParallel="$(BuildInParallel)" /> </Target> <Target Name="Rebuild" DependsOnTargets="SkipVerification"> - <MSBuild Projects="$(SolutionPath)" Targets="Rebuild" /> - </Target> - - <Target Name="BuildUnifiedProduct" - DependsOnTargets="BuildProduct" - Inputs="@(ILMergeInputAssemblies)" - Outputs="$(ILMergeOutputAssembly)"> - <MakeDir Directories="$(ILMergeOutputAssemblyDirectory)" /> - <ILMerge ExcludeFile="$(ProjectRoot)ILMergeInternalizeExceptions.txt" - InputAssemblies="@(ILMergeInputAssemblies)" - OutputFile="$(ILMergeOutputAssembly)" - KeyFile="$(PublicKeyFile)" - DelaySign="true" - /> - </Target> - - <Target Name="ReSignDelaySignedAssemblies" DependsOnTargets="BuildProduct"> - <ItemGroup> - <!-- Add the resource assemblies that only just now are known to exist. --> - <DelaySignedAssemblies Include="$(OutputPath)**\$(ProductName).resources.dll" /> - </ItemGroup> - <Message Text="Signing delay-signed assemblies using key pair container $(KeyPairContainer)." /> - <ReSignDelaySignedAssemblies - KeyContainer="$(KeyPairContainer)" - Assemblies="@(DelaySignedAssemblies)" - Condition="Exists(%(Identity))" /> - </Target> - - <Target Name="ToolsLayout" DependsOnTargets="GetBuildVersion;_SetDropProperties;BuildUnifiedProduct"> - <PropertyGroup> - <ToolsDirectoryNoSlash>$(DropsRoot)$(ProductName)-Tools-$(BuildVersion)</ToolsDirectoryNoSlash> - <ToolsDirectory>$(ToolsDirectoryNoSlash)\</ToolsDirectory> - </PropertyGroup> - - <ItemGroup> - <ToolProjects Include="$(ProjectRoot)Samples\OpenIdOfflineProvider\OpenIdOfflineProvider.csproj" /> - </ItemGroup> - - <MSBuild Projects="@(ToolProjects)" /> - - <ItemGroup> - <OfflineProvider Include=" - $(OutputPath)**\*.dll; - $(OutputPath)OpenIdOfflineProvider.exe" - Exclude=" - $(OutputPath)$(ProductName).*; - $(ILMergeOutputAssembly); - "/> - <OfflineProviderTargets Include=" - @(OfflineProvider->'$(ToolsDirectory)%(RecursiveDir)%(FileName)%(Extension)')"/> - <OfflineProvider Include="$(ILMergeOutputAssembly)" /> - <OfflineProviderTargets Include="$(ToolsDirectory)$(ProductName).dll" /> - - <AllToolSources Include="@(OfflineProvider)" /> - <AllToolTargets Include="@(OfflineProviderTargets)" /> - </ItemGroup> - - <MakeDir Directories="@(ToolsDirectory)" /> - <Copy SourceFiles="@(AllToolSources)" DestinationFiles="@(AllToolTargets)" SkipUnchangedFiles="true" /> - - <!-- remove files that shouldn't be in the directory (perhaps from a previous version). --> - <Purge Directories="$(ToolsDirectory)" IntendedFiles="@(AllToolTargets)" /> - </Target> - - <Target Name="Tools" DependsOnTargets="ToolsLayout"> - <PropertyGroup> - <ToolsZip>$(ToolsDirectoryNoSlash).zip</ToolsZip> - </PropertyGroup> - - <Zip ZipFileName="$(ToolsZip)" - Files="@(AllToolTargets)" - WorkingDirectory="$(ToolsDirectory)" - ZipLevel="$(ZipLevel)" /> - </Target> - - <Target Name="BuildProjectTemplates"> - <!-- Deploy the latest SQL script first, so that the class library can embed the latest version. --> - <MSBuild Projects="$(ProjectRoot)projecttemplates\RelyingPartyDatabase\RelyingPartyDatabase.dbproj" Targets="Build;Deploy" /> - - <MSBuild Projects="@(ProjectTemplates)" /> - </Target> - - <Target Name="ProjectTemplatesLayout" DependsOnTargets="GetBuildVersion;BuildUnifiedProduct;ReSignDelaySignedAssemblies;BuildProjectTemplates;VsixManifestLayout"> - <ItemGroup> - <ProjectTemplatesSource Include="$(ProjectRoot)projecttemplates\**\*" - Exclude=" - $(ProjectRoot)projecttemplates\**\*.sln.cache; - $(ProjectRoot)projecttemplates\**\*.suo; - $(ProjectRoot)projecttemplates\**\*.gitignore; - $(ProjectRoot)projecttemplates\**\*.log*; - $(ProjectRoot)projecttemplates\**\*~; - $(ProjectRoot)projecttemplates\**\Settings.StyleCop; - $(ProjectRoot)projecttemplates\**\StyleCop.Cache; - $(ProjectRoot)projecttemplates\**\*.user; - $(ProjectRoot)projecttemplates\**\obj\**; - $(ProjectRoot)projecttemplates\**\bin\**; - $(ProjectRoot)projecttemplates\**\*.ldf; - $(ProjectRoot)projecttemplates\**\*.mdf; - "/> - <_ProjectTemplatesTransformSource Include="@(ProjectTemplatesSource)" Condition=" - '%(Extension)' == '.cs' - or '%(Extension)' == '.csproj' - or '%(Extension)' == '.sql' - or '%(Extension)' == '.config' - or '%(Extension)' == '.Master' - or '%(Extension)' == '.aspx' - or '%(Extension)' == '.ascx' - or '%(Extension)' == '.asax' - or '%(Extension)' == '.ashx' - "> - <BeforeTokens>%(RecursiveDir)</BeforeTokens> - <AfterTokens>$safeprojectname$</AfterTokens> - <!-- Projects can get changed after the transform+copy operation, so don't skip copying them. --> - <SkipUnchangedFiles Condition="'%(Extension)' != '.csproj'">true</SkipUnchangedFiles> - <SkipUnchangedFiles Condition="'%(Extension)' == '.csproj'">false</SkipUnchangedFiles> - </_ProjectTemplatesTransformSource> - <ProjectTemplatesSource Remove="@(_ProjectTemplatesTransformSource)" /> - - <ProjectTemplatesLayout Include="@(ProjectTemplatesSource->'$(ProjectTemplatesLayoutPath)%(RecursiveDir)%(FileName)%(Extension)')"/> - <ProjectTemplatesTransformLayout Include="@(_ProjectTemplatesTransformSource->'$(ProjectTemplatesLayoutPath)%(RecursiveDir)%(FileName)%(Extension)')"/> - - <!-- Include the template icon --> - <ProjectTemplatesSource Include="$(ProjectRoot)doc\logo\favicon.ico" /> - <ProjectTemplatesLayout Include="$(ProjectTemplatesLayoutPath)__TemplateIcon.ico" /> - - <!-- Add external libraries --> - <!-- Include the unified, signed version of the library --> - <ProjectTemplateLibraries Include="$(ILMergeOutputAssembly)" /> - <ProjectTemplateLibraries Include="$(ILMergeOutputAssemblyDirectory)$(ProductName).pdb" /> - <ProjectTemplateLibraries Include="$(OutputPath)$(ProductName).xml" /> - <ProjectTemplateLibraries Include="$(OutputPath)$(ProductName).Contracts.dll" /> - <!-- ... and log4net --> - <ProjectTemplateLibraries Include="$(ProjectRoot)lib\log4net.dll" /> - <ProjectTemplateLibraries Include="$(ProjectRoot)lib\log4net.xml" /> - <ProjectTemplateLibrariesTargets Include="@(ProjectTemplateLibraries->'$(ProjectTemplatesLayoutPath)RelyingPartyLogic\lib\%(FileName)%(Extension)')" /> - - <ProjectTemplatesSource Include="@(ProjectTemplateLibraries)" /> - <ProjectTemplatesLayout Include="@(ProjectTemplateLibrariesTargets)" /> - <FixupReferenceAssemblies Include="@(ProjectTemplateLibrariesTargets)" Condition="'%(Extension)' == '.dll'" /> - - <InjectedLibraryItems Include="@(ProjectTemplateLibrariesTargets->'lib\%(FileName)%(Extension)')" /> - <VSProjectTemplates Include="@(ProjectTemplatesLayout)" Condition="'%(Extension)' == '.vstemplate'" /> - </ItemGroup> - - <Trim Inputs="@(_ProjectTemplatesTransformSource)" MetadataName="BeforeTokens" AllAfter="\"> - <Output TaskParameter="Outputs" ItemName="ProjectTemplatesTransformSource" /> - </Trim> - <!--<MSBuild Projects="@(ProjectTemplates)" />--> - <Copy SourceFiles="@(ProjectTemplatesSource)" DestinationFiles="@(ProjectTemplatesLayout)" SkipUnchangedFiles="true" /> - <CopyWithTokenSubstitution SourceFiles="@(ProjectTemplatesTransformSource)" DestinationFiles="@(ProjectTemplatesTransformLayout)"> - <Output TaskParameter="CopiedFiles" ItemName="CopiedProjectTemplateFiles" /> - </CopyWithTokenSubstitution> - <ChangeProjectReferenceToAssemblyReference - Projects="@(CopiedProjectTemplateFiles)" - Condition="'%(Extension)' == '.csproj'" - ProjectReference="..\..\src\$(ProductName)\$(ProductName).csproj" - Reference="Lib\$(ProductName).dll" /> - <FixupReferenceHintPaths - Projects="@(CopiedProjectTemplateFiles)" - Condition="'%(CopiedProjectTemplateFiles.Extension)' == '.csproj'" - References="@(FixupReferenceAssemblies)" - /> - <AddProjectItems - Projects="@(CopiedProjectTemplateFiles)" - Condition="'%(CopiedProjectTemplateFiles.FileName)%(CopiedProjectTemplateFiles.Extension)' == 'RelyingPartyLogic.csproj'" - Items="@(InjectedLibraryItems)" - /> - <MergeProjectWithVSTemplate - ProjectItemTypes="@(VsTemplateProjectItemTypes)" - ReplaceParametersExtensions="@(VsTemplateParameterReplaceExtensions)" - Templates="@(VSProjectTemplates)" - VsixManifest="@(ProjectTemplates2010TransformLayout)" - EnsureMaxPath="235" - Condition=" '%(ProjectTemplates2010TransformLayout.Extension)' == '.vsixmanifest' " - > - <Output TaskParameter="MaxPathAdjustedPaths" ItemName="ProjectItemShortPathAdjustments"/> - </MergeProjectWithVSTemplate> - - <ItemGroup> - <ProjectTemplateIntendedFiles Include=" - @(ProjectTemplatesLayout); - @(ProjectTemplatesTransformLayout); - %(ProjectItemShortPathAdjustments.ShortPath); - " /> - <ProjectTemplateIntendedFiles Remove="@(ProjectItemShortPathAdjustments)" /> - </ItemGroup> - <Purge Directories="$(ProjectTemplatesLayoutPath)" - IntendedFiles="@(ProjectTemplateIntendedFiles)" /> - </Target> - - <Target Name="ProjectTemplates2008" DependsOnTargets="ProjectTemplatesLayout"> - <ItemGroup> - <ProjectTemplates2008Source Include="$(ProjectTemplatesLayoutPath)**" /> - <ProjectTemplates2008Layout Include="@(ProjectTemplates2008Source->'$(VS2008ProjectTemplatesDirectory)%(RecursiveDir)%(FileName)%(Extension)')" /> - <ProjectTemplates2008Layout> - <HardLink Condition=" '%(Extension)' != '.csproj' ">true</HardLink> - </ProjectTemplates2008Layout> - - <VS2008ProjectTemplates Include="@(ProjectTemplates2008Layout)" Condition="'%(Extension)' == '.vstemplate'" /> - <TopLevelVS2008ProjectTemplates Include="@(VS2008ProjectTemplates)" Condition="'%(RootDir)%(Directory)' == '$(VS2008ProjectTemplatesDirectory)'" /> - <VS2008ProjectTemplateZipFiles Include="@(TopLevelVS2008ProjectTemplates->'%(RootDir)%(Directory)%(FileName).zip')" /> - </ItemGroup> - - <HardLinkCopy SourceFiles="@(ProjectTemplates2008Source)" DestinationFiles="@(ProjectTemplates2008Layout)" /> - - <DowngradeProjects - Projects="@(ProjectTemplates2008Layout)" - Condition="'%(Extension)' == '.csproj'" - DowngradeMvc2ToMvc1="true" - /> - - <Purge Directories="$(VS2008ProjectTemplatesDirectory)" IntendedFiles="@(ProjectTemplates2008Layout)" /> - - <DiscoverProjectTemplates TopLevelTemplates="@(TopLevelVS2008ProjectTemplates)"> - <Output TaskParameter="ProjectTemplates" ItemName="SubVS2008Templates" /> - <Output TaskParameter="ProjectTemplateContents" ItemName="VS2008TemplateItemContents" /> - </DiscoverProjectTemplates> - - <ItemGroup> - <!-- Include in each template .zip file the top-level .vstemplate file itself. --> - <VS2008ProjectTemplateContents Include="@(TopLevelVS2008ProjectTemplates)"> - <ZipFile>$(ProjectTemplatesVsiDirectory)%(FileName).zip</ZipFile> - <WorkingDirectory>$(VS2008ProjectTemplatesDirectory)</WorkingDirectory> - </VS2008ProjectTemplateContents> - - <!-- Now throw in all the files in each of the project-level template's directories and their children. --> - <VS2008ProjectTemplateContents Include="@(VS2008TemplateItemContents)"> - <ZipFile>$(ProjectTemplatesVsiDirectory)%(VS2008TemplateItemContents.TopLevelTemplateFileName).zip</ZipFile> - <WorkingDirectory>$(VS2008ProjectTemplatesDirectory)</WorkingDirectory> - </VS2008ProjectTemplateContents> - - <!-- Include the template icon for each .zip file. --> - <VS2008ProjectTemplateContents Include="@(TopLevelVS2008ProjectTemplates->'$(VS2008ProjectTemplatesDirectory)__TemplateIcon.ico')"> - <ZipFile>$(ProjectTemplatesVsiDirectory)%(TopLevelVS2008ProjectTemplates.FileName).zip</ZipFile> - <WorkingDirectory>$(VS2008ProjectTemplatesDirectory)</WorkingDirectory> - </VS2008ProjectTemplateContents> - </ItemGroup> - - <Zip - Files="@(VS2008ProjectTemplateContents)" - ZipFileName="%(VS2008ProjectTemplateContents.ZipFile)" - WorkingDirectory="%(VS2008ProjectTemplateContents.WorkingDirectory)" - ZipLevel="$(ZipLevel)" - /> - </Target> - - <Target Name="ProjectTemplates2010" DependsOnTargets="ProjectTemplatesLayout"> - <ItemGroup> - <ProjectTemplates2010Source Include="$(ProjectTemplatesLayoutPath)**" /> - <ProjectTemplates2010Layout Include="@(ProjectTemplates2010Source->'$(VS2010ProjectTemplatesDirectory)%(RecursiveDir)%(FileName)%(Extension)')" /> - <ProjectTemplates2010Layout> - <HardLink Condition=" '%(Extension)' != '.csproj' ">true</HardLink> - </ProjectTemplates2010Layout> - - <VS2010ProjectTemplates Include="@(ProjectTemplates2010Layout)" Condition="'%(Extension)' == '.vstemplate'" /> - <TopLevelVS2010ProjectTemplates Include="@(VS2010ProjectTemplates)" Condition="'%(RootDir)%(Directory)' == '$(VS2010ProjectTemplatesDirectory)'" /> - <VS2010ProjectTemplateZipFiles Include="@(TopLevelVS2010ProjectTemplates->'%(RootDir)%(Directory)%(FileName).zip')" /> - </ItemGroup> - - <HardLinkCopy SourceFiles="@(ProjectTemplates2010Source)" DestinationFiles="@(ProjectTemplates2010Layout)" /> - - <Purge Directories="$(VS2010ProjectTemplatesDirectory)" IntendedFiles="@(ProjectTemplates2010Layout)" /> - - <DiscoverProjectTemplates TopLevelTemplates="@(TopLevelVS2010ProjectTemplates)"> - <Output TaskParameter="ProjectTemplates" ItemName="SubVS2010Templates" /> - <Output TaskParameter="ProjectTemplateContents" ItemName="VS2010TemplateItemContents" /> - </DiscoverProjectTemplates> - - <ItemGroup> - <!-- Include in each template .zip file the top-level .vstemplate file itself. --> - <VS2010ProjectTemplateContents Include="@(TopLevelVS2010ProjectTemplates)"> - <ZipFile>$(ProjectTemplateSubdirectory)%(FileName).zip</ZipFile> - <WorkingDirectory>$(VS2010ProjectTemplatesDirectory)</WorkingDirectory> - </VS2010ProjectTemplateContents> - - <!-- Now throw in all the files in each of the project-level template's directories and their children. --> - <VS2010ProjectTemplateContents Include="@(VS2010TemplateItemContents)"> - <ZipFile>$(ProjectTemplateSubdirectory)%(VS2010TemplateItemContents.TopLevelTemplateFileName).zip</ZipFile> - <WorkingDirectory>$(VS2010ProjectTemplatesDirectory)</WorkingDirectory> - </VS2010ProjectTemplateContents> - - <!-- Include the template icon for each .zip file. --> - <VS2010ProjectTemplateContents Include="@(TopLevelVS2010ProjectTemplates->'$(VS2010ProjectTemplatesDirectory)__TemplateIcon.ico')"> - <ZipFile>$(ProjectTemplateSubdirectory)%(TopLevelVS2010ProjectTemplates.FileName).zip</ZipFile> - <WorkingDirectory>$(VS2010ProjectTemplatesDirectory)</WorkingDirectory> - </VS2010ProjectTemplateContents> - - <ExtensionVsixContents Include="%(VS2010ProjectTemplateContents.ZipFile)" /> - </ItemGroup> - - <Zip - Files="@(VS2010ProjectTemplateContents)" - ZipFileName="%(VS2010ProjectTemplateContents.ZipFile)" - WorkingDirectory="%(VS2010ProjectTemplateContents.WorkingDirectory)" - ZipLevel="$(ZipLevel)" - /> - </Target> - - <Target Name="vsi" DependsOnTargets="ProjectTemplates2008;_SetDropProperties"> - <PropertyGroup> - <ProjectTemplatesVsi>$(DropDirectoryNoSlash).vsi</ProjectTemplatesVsi> - </PropertyGroup> - <ItemGroup> - <VsiTransformSource Include="$(ProjectRoot)vsi\*.vscontent"> - <BeforeTokens>$version$</BeforeTokens> - <AfterTokens>$(BuildVersion)</AfterTokens> - <SkipUnchangedFiles>false</SkipUnchangedFiles> - </VsiTransformSource> - <VsiTransformLayout Include="@(VsiTransformSource->'$(ProjectTemplatesVsiDirectory)%(RecursiveDir)%(FileName)%(Extension)')" /> - - <ProjectTemplateVsiContents Include=" - $(ProjectTemplatesVsiDirectory)*.zip; - @(VsiTransformLayout); - " /> - </ItemGroup> - - <CopyWithTokenSubstitution SourceFiles="@(VsiTransformSource)" DestinationFiles="@(VsiTransformLayout)" /> - - <Zip - Files="@(ProjectTemplateVsiContents)" - ZipFileName="$(ProjectTemplatesVsi)" - WorkingDirectory="$(ProjectTemplatesVsiDirectory)" - ZipLevel="$(ZipLevel)" - /> - </Target> - - <Target Name="VsixManifestLayout"> - <ItemGroup> - <ProjectTemplates2010TransformSource Include=" - $(ProjectRoot)vsix\extension.vsixmanifest; - $(ProjectRoot)LICENSE.txt; - "> - <BeforeTokens>$version$</BeforeTokens> - <AfterTokens>$(BuildVersion)</AfterTokens> - <SkipUnchangedFiles>false</SkipUnchangedFiles> - </ProjectTemplates2010TransformSource> - <ProjectTemplates2010TransformLayout Include="@(ProjectTemplates2010TransformSource->'$(ExtensionVsixLayoutDirectory)%(RecursiveDir)%(FileName)%(Extension)')" /> - </ItemGroup> - <CopyWithTokenSubstitution SourceFiles="@(ProjectTemplates2010TransformSource)" DestinationFiles="@(ProjectTemplates2010TransformLayout)" /> - </Target> - - <Target Name="VsixLayout" DependsOnTargets="ProjectTemplates2010;VsixManifestLayout"> - <ItemGroup> - <ExtensionVsixSources Include=" - $(ProjectRoot)vsix\*; - " Exclude=" - $(ProjectRoot)vsix\extension.vsixmanifest; - "> - <SkipUnchangedFiles>true</SkipUnchangedFiles> - </ExtensionVsixSources> - - <ExtensionVsixTargets Include="@(ExtensionVsixSources->'$(ExtensionVsixLayoutDirectory)%(FileName)%(Extension)')" /> - - <ExtensionVsixContents Include=" - @(ExtensionVsixTargets); - @(ProjectTemplates2010TransformLayout); - "/> - </ItemGroup> - - <Copy SourceFiles="@(ExtensionVsixSources)" DestinationFiles="@(ExtensionVsixTargets)" SkipUnchangedFiles="true" /> - <Purge Directories="$(ExtensionVsixLayoutDirectory)" IntendedFiles="@(ExtensionVsixContents)" /> - - <!-- Build individual VSIX files for each project template for the Visual Studio Gallery, - which only allows one project template per VSIX. --> - <ItemGroup> - <VSGalleryProjectTemplates Include="$(ProjectTemplateSubdirectory)*.zip" /> - <VSGalleryVsixRawSources Include="$(ExtensionVsixLayoutDirectory)**" - Exclude="$(ProjectTemplateSubdirectory)*.zip;$(ExtensionVsixLayoutDirectory)*.vsixmanifest"> - <VSGalleryVsix>$(DropsRoot)$(ProductName) %(VSGalleryProjectTemplates.FileName)-$(BuildVersion).vsix</VSGalleryVsix> - <TopLevelTemplate>%(VSGalleryProjectTemplates.FileName)</TopLevelTemplate> - </VSGalleryVsixRawSources> - <VSGalleryVsixSources Include="@(VSGalleryVsixRawSources)"> - <TargetPath>$(IntermediatePath)%(TopLevelTemplate).vsix\%(FileName)%(Extension)</TargetPath> - </VSGalleryVsixSources> - - <VSGalleryVsixZipSources Include="$(ExtensionVsixLayoutDirectory)**\*.zip"/> - <VSGalleryVsixSources Include="@(VSGalleryVsixZipSources)"> - <TopLevelTemplate>%(FileName)</TopLevelTemplate> - <VSGalleryVsix>$(DropsRoot)$(ProductName) %(FileName)-$(BuildVersion).vsix</VSGalleryVsix> - <TargetPath>$(IntermediatePath)%(FileName).vsix\%(RecursiveDir)%(FileName)%(Extension)</TargetPath> - </VSGalleryVsixSources> - - <VSGalleryVsixSources Include="@(VSGalleryProjectTemplates->'$(ProjectRoot)projecttemplates\%(FileName).vsixmanifest')"> - <VSGalleryVsix>$(DropsRoot)$(ProductName) %(VSGalleryProjectTemplates.FileName)-$(BuildVersion).vsix</VSGalleryVsix> - <TopLevelTemplate>%(VSGalleryProjectTemplates.FileName)</TopLevelTemplate> - <TargetPath>$(IntermediatePath)%(VSGalleryProjectTemplates.FileName).vsix\extension.vsixmanifest</TargetPath> - <Transform>true</Transform> - <BeforeTokens>$version$</BeforeTokens> - <AfterTokens>$(BuildVersion)</AfterTokens> - <SkipUnchangedFiles>false</SkipUnchangedFiles> - </VSGalleryVsixSources> - - <VSGalleryVsixTargets Include="@(VSGalleryVsixSources->'%(TargetPath)')"> - <WorkingDirectory>$(IntermediatePath)%(TopLevelTemplate).vsix</WorkingDirectory> - </VSGalleryVsixTargets> - <VSGalleryVsixPathsToPurge Include="@(VSGalleryProjectTemplates->'$(IntermediatePath)%(FileName).vsix')"/> - </ItemGroup> - <HardLinkCopy - SourceFiles="@(VSGalleryVsixSources)" - DestinationFiles="%(VSGalleryVsixSources.TargetPath)" - Condition=" '%(VSGalleryVsixSources.Transform)' != 'true' "/> - <CopyWithTokenSubstitution - SourceFiles="@(VSGalleryVsixSources)" - DestinationFiles="%(VSGalleryVsixSources.TargetPath)" - Condition=" '%(VSGalleryVsixSources.Transform)' == 'true' "/> - <Purge - Directories="@(VSGalleryVsixPathsToPurge)" - IntendedFiles="@(VSGalleryVsixTargets)" /> - </Target> - - <Target Name="vsix" DependsOnTargets="VsixLayout;_SetDropProperties"> - <PropertyGroup> - <ExtensionVsix>$(DropsRoot)$(ProductName) SDK-$(BuildVersion).vsix</ExtensionVsix> - </PropertyGroup> - <Zip - Files="@(ExtensionVsixContents)" - ZipFileName="$(ExtensionVsix)" - WorkingDirectory="$(ExtensionVsixLayoutDirectory)" - ZipLevel="$(ZipLevel)" - /> - - <Zip - Files="@(VSGalleryVsixTargets)" - ZipFileName="%(VSGalleryVsixTargets.VSGalleryVsix)" - WorkingDirectory="%(VSGalleryVsixTargets.WorkingDirectory)" - ZipLevel="$(ZipLevel)" - /> - </Target> - - <Target Name="Documentation" DependsOnTargets="BuildProduct;Chm" Condition="'$(NoDocumentation)' != 'true'"> + <MSBuild Projects="$(SolutionPath)" Targets="Rebuild" BuildInParallel="$(BuildInParallel)" /> </Target> <Target Name="Test" DependsOnTargets="BuildTests" @@ -526,138 +55,9 @@ ExcludeCategory="$(NUnitExcludeCategories)"/> </Target> - <Target Name="_SetDropProperties" DependsOnTargets="GetBuildVersion"> - <!-- This target is necessary because PropertyGroups within the same Target as - where CallTarget is fired do NOT affect those called targets. --> - <!-- The rest of these are here so that other DependsOn targets have access to these properties. --> - <PropertyGroup> - <DropDirectoryNoSlash>$(DropsRoot)$(ProductName)-$(BuildVersion)</DropDirectoryNoSlash> - <DropDirectory>$(DropDirectoryNoSlash)\</DropDirectory> - </PropertyGroup> - </Target> - - <Target Name="DropLayout" DependsOnTargets="GetBuildVersion;_SetDropProperties;BuildUnifiedProduct;ReSignDelaySignedAssemblies;BuildSamples;vsi;vsix;Documentation"> - <PropertyGroup> - <DropBinDirectory>$(DropDirectory)Bin\</DropBinDirectory> - <DropLibDirectory>$(DropDirectory)Lib\</DropLibDirectory> - <DropProjectTemplatesDirectory>$(DropDirectory)Project Templates\</DropProjectTemplatesDirectory> - <DropSamplesDirectory>$(DropDirectory)Samples\</DropSamplesDirectory> - <DropSpecsDirectory>$(DropDirectory)Specs\</DropSpecsDirectory> - </PropertyGroup> - <ItemGroup> - <DropDirectories Include=" - $(DropDirectory); - $(DropBinDirectory); - $(DropLibDirectory); - $(DropProjectTemplatesDirectory); - $(DropSamplesDirectory); - $(DropSpecsDirectory); - " /> - - <DropSourceFiles Include=" - $(ProjectRoot)Doc\$(ProductName).chm; - $(ProjectRoot)Doc\*.htm*; - $(ProjectRoot)LICENSE.txt; - $(ProjectRoot)CONTRIB.txt; - " - Exclude="$(ProjectRoot)Doc\README.*.html;" /> - <DropBinSourceFiles Include=" - $(ILMergeOutputAssemblyDirectory)$(ProductName).???; - $(OutputPath)**\$(ProductName).resources.dll; - $(OutputPath)$(ProductName).xml; - $(OutputPath)$(ProductName).Contracts.???; - $(ProjectRoot)Doc\README.Bin.html; - $(ProjectRoot)src\$(ProductName)\Configuration\$(ProductName).xsd; - " /> - <DropLibSourceFiles Include=" - $(ProjectRoot)Lib\log4net.*; - " /> - <DropProjectTemplatesSourceFiles Include="$(ProjectTemplatesVsi)" /> - <DropVsixSourceFiles Include="$(ExtensionVsix)" /> - <DropSamplesSourceFiles Include="$(ProjectRoot)Samples\**" Exclude=" - $(ProjectRoot)**\obj\**; - $(ProjectRoot)**\*.sln.cache; - $(ProjectRoot)**\*.suo; - $(ProjectRoot)**\*.user; - $(ProjectRoot)**\*.gitignore; - $(ProjectRoot)**\*.ldf; - $(ProjectRoot)**\*.log*; - $(ProjectRoot)**\*~; - $(ProjectRoot)**\Debug\**; - $(ProjectRoot)**\Settings.StyleCop; - $(ProjectRoot)**\StyleCop.Cache; - $(ProjectRoot)Samples\**\DotNetOpenAuth.???; - $(ProjectRoot)Samples\**\log4net.???; - $(ProjectRoot)Samples\**\PresentationCore.dll; - $(ProjectRoot)Samples\**\System.Printing.dll; - $(ProjectRoot)Samples\**\*.refresh_; - " /> - <!-- Some .refresh files are only applicable to drop builds, so we rename them from *.refresh_ --> - <DropSamplesRefreshSourceFiles Include="$(ProjectRoot)Samples\**\*.refresh_" /> - <DropSpecsSourceFiles Include="$(ProjectRoot)Doc\specs\*.htm*" /> - - <DropFiles Include="@(DropSourceFiles->'$(DropDirectory)%(RecursiveDir)%(FileName)%(Extension)')"/> - <DropBinFiles Include="@(DropBinSourceFiles->'$(DropBinDirectory)%(RecursiveDir)%(FileName)%(Extension)')"/> - <DropLibFiles Include="@(DropLibSourceFiles->'$(DropLibDirectory)%(RecursiveDir)%(FileName)%(Extension)')"/> - <DropProjectTemplatesFiles Include="@(DropProjectTemplatesSourceFiles->'$(DropProjectTemplatesDirectory)%(FileName)%(Extension)')" /> - <DropVsixFiles Include="@(DropVsixSourceFiles->'$(DropProjectTemplatesDirectory)%(FileName)%(Extension)')" /> - <DropSamplesFiles Include="@(DropSamplesSourceFiles->'$(DropSamplesDirectory)%(RecursiveDir)%(FileName)%(Extension)')"/> - <DropSamplesRefreshFiles Include="@(DropSamplesRefreshSourceFiles->'$(DropSamplesDirectory)%(RecursiveDir)%(FileName).refresh')"/> - <DropSamplesToolsProjects Include="$(DropSamplesDirectory)OpenIdOfflineProvider\OpenIdOfflineProvider.csproj" /> - <DropSpecsFiles Include="@(DropSpecsSourceFiles->'$(DropSpecsDirectory)%(RecursiveDir)%(FileName)%(Extension)')"/> - - <AllDropSources Include=" - @(DropSourceFiles); - @(DropBinSourceFiles); - @(DropLibSourceFiles); - @(DropProjectTemplatesSourceFiles); - @(DropVsixSourceFiles); - @(DropSamplesSourceFiles); - @(DropSamplesRefreshSourceFiles); - @(DropDocSourceFiles); - @(DropSpecsSourceFiles); - " /> - - <AllDropTargets Include=" - @(DropFiles); - @(DropBinFiles); - @(DropLibFiles); - @(DropProjectTemplatesFiles); - @(DropVsixFiles); - @(DropSamplesFiles); - @(DropSamplesRefreshFiles); - @(DropDocFiles); - @(DropSpecsFiles) - " /> - </ItemGroup> - - <!-- clean up any previous drop with the same name so we don't aggregate files. --> - <MakeDir Directories="@(DropDirectories)" /> - <Copy SourceFiles="@(AllDropSources)" DestinationFiles="@(AllDropTargets)" SkipUnchangedFiles="true" /> - <Purge Directories="$(DropDirectory)" IntendedFiles="@(AllDropTargets)" /> - <!-- fix up the samples so that they will compile right out of the drop --> - <ItemGroup> - <SampleProjectTargets Include="$(DropSamplesDirectory)**\*.*proj" /> - <SampleSolutionTargets Include="$(DropSamplesDirectory)**\*.sln" /> - </ItemGroup> - <FixupShippingToolSamples Projects="@(DropSamplesToolsProjects)" - RemoveImportsStartingWith="%24(ProjectRoot)tools\" - AddReferences="Microsoft.Contracts"/> - <ChangeProjectReferenceToAssemblyReference Projects="@(SampleProjectTargets)" - ProjectReference="..\..\src\$(ProductName)\$(ProductName).csproj" Reference="..\..\Bin\$(ProductName).dll" /> - <DowngradeProjects Projects="@(SampleProjectTargets);@(SampleSolutionTargets)" DowngradeMvc2ToMvc1="true" /> - </Target> - - <Target Name="Drop" DependsOnTargets="DropLayout"> - <PropertyGroup> - <DropZip>$(DropDirectoryNoSlash).zip</DropZip> - </PropertyGroup> - <Zip Files="@(AllDropTargets)" ZipFileName="$(DropZip)" WorkingDirectory="$(DropsRoot)" ZipLevel="$(ZipLevel)" /> + <Target Name="Nightly"> + <MSBuild Projects="@(ProjectsInDrop)" Targets="%(ProjectsInDrop.Targets)" BuildInParallel="$(BuildInParallel)" /> </Target> - <!-- Although Nightly includes publishing samples and docs, those targets are conditioned for - running only when the SampleWebRoot and DocWebRoot properties are set, respectively. --> - <Target Name="Nightly" DependsOnTargets="Drop;Tools;PublishSamples;PublishDocumentation"> - - </Target> + <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.automated.targets"/> </Project> diff --git a/doc/doc.proj b/doc/doc.proj new file mode 100644 index 0000000..75f3cdc --- /dev/null +++ b/doc/doc.proj @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <!-- Properties that must be set for these targets to function: + $(BranchName): The name of the branch being built. Used to determine the web subdirectory for publishing. + + For creating web sites: + $(PublishDocsWebSiteName): The name of the web site under which the documentation web applications will be created/deleted. + + For creating or publishing to web sites: + $(DocWebRoot): the full physical path to where documentation should be copied to, excluding $(BranchName) + --> + + <Import Project="$(MSBuildProjectDirectory)\..\tools\DotNetOpenAuth.automated.props"/> + + <Target Name="Build" DependsOnTargets="BuildProduct;Chm" Condition=" '$(NoDocumentation)' != 'true' " /> + + <Target Name="Prepare"> + <Error Text="The BranchName property must be set." Condition=" '$(BranchName)' == '' " /> + <Error Text="The DocWebRoot property must be set." Condition=" '$(DocWebRoot)' == '' " /> + <PropertyGroup> + <PublishDocsWebSiteVirtualPath>/$(BranchName)</PublishDocsWebSiteVirtualPath> + </PropertyGroup> + </Target> + + <Target Name="PrepareForPublish" DependsOnTargets="Prepare;BuildProduct;Html"> + <ItemGroup> + <DocSources Include="$(ProjectRoot)doc\api\**\*" /> + <DocTargets Include="@(DocSources->'$(DocWebRoot)\$(BranchName)\%(RecursiveDir)%(Filename)%(Extension)')" /> + </ItemGroup> + </Target> + + <Target Name="Publish" + DependsOnTargets="PrepareForPublish" + Inputs="@(DocSources)" + Outputs="@(DocTargets)"> + <RemoveDir Directories="$(DocWebRoot)\$(BranchName)" /> + <MakeDir Directories="$(DocWebRoot)\$(BranchName)" /> + <Copy SourceFiles="@(DocSources)" DestinationFiles="@(DocTargets)" SkipUnchangedFiles="true" /> + </Target> + + <Target Name="Unpublish" + DependsOnTargets="DeleteSiteOnIis" + Condition=" '$(DocWebRoot)' != '' "> + </Target> + + <Target Name="CreateSiteOnIis" DependsOnTargets="Prepare"> + <Error Text="The PublishDocsWebSiteName property must be set." Condition=" '$(PublishDocsWebSiteName)' == '' "/> + <CreateWebApplication + WebSiteName="$(PublishDocsWebSiteName)" + PhysicalPaths="$(DocWebRoot)\$(BranchName)" + VirtualPaths="$(PublishDocsWebSiteVirtualPath)" + /> + </Target> + + <Target Name="DeleteSiteOnIis" DependsOnTargets="Prepare"> + <Error Text="The PublishDocsWebSiteName property must be set." Condition=" '$(PublishDocsWebSiteName)' == '' "/> + <DeleteWebApplication + WebSiteName="$(PublishDocsWebSiteName)" + VirtualPaths="$(PublishDocsWebSiteVirtualPath)" + /> + </Target> + + <Import Project="$(ProjectRoot)tools\Documentation.targets"/> + <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.automated.targets"/> +</Project>
\ No newline at end of file diff --git a/lib/DotNetOpenAuth.BuildTasks.dll b/lib/DotNetOpenAuth.BuildTasks.dll Binary files differindex 260289d..d26f276 100644 --- a/lib/DotNetOpenAuth.BuildTasks.dll +++ b/lib/DotNetOpenAuth.BuildTasks.dll diff --git a/lib/DotNetOpenAuth.BuildTasks.pdb b/lib/DotNetOpenAuth.BuildTasks.pdb Binary files differindex e2ba8d2..0169338 100644 --- a/lib/DotNetOpenAuth.BuildTasks.pdb +++ b/lib/DotNetOpenAuth.BuildTasks.pdb diff --git a/projecttemplates/MvcRelyingParty.vsixmanifest b/projecttemplates/MvcRelyingParty.vsixmanifest index 023e42a..f401277 100644 --- a/projecttemplates/MvcRelyingParty.vsixmanifest +++ b/projecttemplates/MvcRelyingParty.vsixmanifest @@ -1,7 +1,7 @@ <?xml version="1.0"?> <Vsix xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="1.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2010"> <Identifier Id="DotNetOpenAuth.MvcRelyingParty.15E8EC96-BDC3-47E2-8BB1-0483E9D16705"> - <Name>MvcRelyingParty</Name> + <Name>ASP.NET MVC OpenID web site (C#)</Name> <Author>DotNetOpenAuth</Author> <Version>$version$</Version> <Description>Resources for developing applications that use OpenID, OAuth, and InfoCard.</Description> diff --git a/projecttemplates/RelyingPartyLogic/RelyingPartyLogic.csproj b/projecttemplates/RelyingPartyLogic/RelyingPartyLogic.csproj index 9f58bfa..07f267d 100644 --- a/projecttemplates/RelyingPartyLogic/RelyingPartyLogic.csproj +++ b/projecttemplates/RelyingPartyLogic/RelyingPartyLogic.csproj @@ -143,6 +143,12 @@ <Project>{3191B653-F76D-4C1A-9A5A-347BC3AAAAB7}</Project> <Name>DotNetOpenAuth</Name> </ProjectReference> + <ProjectReference Include="..\RelyingPartyDatabase\RelyingPartyDatabase.dbproj"> + <Name>RelyingPartyDatabase</Name> + <!-- Deploy the latest SQL script first, so that this project can embed the latest version. --> + <Targets>Build;Deploy</Targets> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> </ItemGroup> <ItemGroup> <EmbeddedResource Include="CreateDatabase.sql" /> diff --git a/projecttemplates/WebFormsRelyingParty.vsixmanifest b/projecttemplates/WebFormsRelyingParty.vsixmanifest index bd8eb13..75a3646 100644 --- a/projecttemplates/WebFormsRelyingParty.vsixmanifest +++ b/projecttemplates/WebFormsRelyingParty.vsixmanifest @@ -1,7 +1,7 @@ <?xml version="1.0"?> <Vsix xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="1.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2010"> <Identifier Id="DotNetOpenAuth.WebFormsRelyingParty.FB0AB0B2-B447-4F10-A03E-F488DDAF024A"> - <Name>WebFormsRelyingParty</Name> + <Name>ASP.NET OpenID web site (C#)</Name> <Author>DotNetOpenAuth</Author> <Version>$version$</Version> <Description>Resources for developing applications that use OpenID, OAuth, and InfoCard.</Description> diff --git a/projecttemplates/projecttemplates.proj b/projecttemplates/projecttemplates.proj new file mode 100644 index 0000000..d4d3a56 --- /dev/null +++ b/projecttemplates/projecttemplates.proj @@ -0,0 +1,257 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildProjectDirectory)\..\tools\DotNetOpenAuth.automated.props"/> + <Import Project="ProjectTemplates.props"/> + + <PropertyGroup> + <ProjectTemplateMaxPath Condition=" '$(ProjectTemplateMaxPath)' == '' ">50</ProjectTemplateMaxPath> + + <LayoutDependsOn> + BuildUnifiedProduct; + ReSignDelaySignedAssemblies; + DeploySql; + LayoutProjects; + </LayoutDependsOn> + + <!-- We don't need to build the project templates, but to make sure we're not shipping junk, + we default to building them as a validation step. --> + <LayoutDependsOn Condition=" '$(Validation)' == 'Full' "> + Validate; + $(LayoutDependsOn); + </LayoutDependsOn> + </PropertyGroup> + + <ItemGroup> + <ProjectTemplates Include="**\*.*proj" Exclude="$(MSBuildThisFile)" /> + </ItemGroup> + + <Target Name="Validate"> + <MSBuild Projects="@(ProjectTemplates)" BuildInParallel="$(BuildInParallel)" /> + </Target> + + <Target Name="DeploySql"> + <!-- This causes the SQL script that generates the database to be deployed to the RelyingPartyLogic class library. --> + <MSBuild Projects="RelyingPartyDatabase\RelyingPartyDatabase.dbproj" Targets="Build;Deploy" BuildInParallel="$(BuildInParallel)" /> + </Target> + + <Target Name="LayoutProjects"> + <ItemGroup> + <TemplateProjects Include="**\*.csproj" Exclude="$(MSBuildThisFile)"> + <AfterTokens>$safeprojectname$</AfterTokens> + <!-- Projects can get changed after the transform+copy operation, so don't skip copying them. --> + <SkipUnchangedFiles>false</SkipUnchangedFiles> + </TemplateProjects> + <TemplateProjects> + <BeforeTokens>%(RecursiveDir)</BeforeTokens> + </TemplateProjects> + <TemplateProjectsLayout Include="@(TemplateProjects->'$(ProjectTemplatesLayoutPath)%(RecursiveDir)%(FileName)%(Extension)')"/> + + <!-- Add external libraries --> + <!-- Include the unified, signed version of the library --> + <ProjectTemplateLibraries Include="$(ILMergeOutputAssembly)" /> + <ProjectTemplateLibraries Include="$(ILMergeOutputAssemblyDirectory)$(ProductName).pdb" /> + <ProjectTemplateLibraries Include="$(OutputPath)$(ProductName).xml" /> + <ProjectTemplateLibraries Include="$(OutputPath)$(ProductName).Contracts.dll" /> + <!-- ... and log4net --> + <ProjectTemplateLibraries Include="$(ProjectRoot)lib\log4net.dll" /> + <ProjectTemplateLibraries Include="$(ProjectRoot)lib\log4net.xml" /> + <ProjectTemplateLibrariesTargets Include="@(ProjectTemplateLibraries->'$(ProjectTemplatesLayoutPath)RelyingPartyLogic\lib\%(FileName)%(Extension)')" /> + + <FixupReferenceAssemblies Include="@(ProjectTemplateLibrariesTargets)" Condition="'%(Extension)' == '.dll'" /> + <InjectedLibraryItems Include="@(ProjectTemplateLibrariesTargets->'lib\%(FileName)%(Extension)')" /> + + <VSProjectTemplates Include="**\*.vstemplate" Exclude="*.vstemplate" /> + <VSProjectTemplatesLayout Include="@(VSProjectTemplates->'$(ProjectTemplatesLayoutPath)%(RecursiveDir)%(FileName)%(Extension)')" /> + </ItemGroup> + + <Trim Inputs="@(TemplateProjects)" MetadataName="BeforeTokens" AllAfter="\"> + <Output TaskParameter="Outputs" ItemName="TemplateProjectsTransformSource" /> + </Trim> + <CopyWithTokenSubstitution SourceFiles="@(TemplateProjectsTransformSource)" DestinationFiles="@(TemplateProjectsLayout)"> + <Output TaskParameter="CopiedFiles" ItemName="CopiedProjectFiles" /> + </CopyWithTokenSubstitution> + <ChangeProjectReferenceToAssemblyReference + Projects="@(CopiedProjectFiles)" + Condition=" '%(Extension)' == '.csproj' " + ProjectReferences="..\..\src\$(ProductName)\$(ProductName).csproj;..\RelyingPartyDatabase\RelyingPartyDatabase.dbproj" + References="Lib\$(ProductName).dll;REMOVE" /> + <FixupReferenceHintPaths + Projects="@(CopiedProjectFiles)" + References="@(FixupReferenceAssemblies)" + /> + <AddProjectItems + Projects="@(CopiedProjectFiles)" + Condition="'%(CopiedProjectFiles.FileName)%(CopiedProjectFiles.Extension)' == 'RelyingPartyLogic.csproj'" + Items="@(InjectedLibraryItems)" + /> + <MergeProjectWithVSTemplate + ProjectItemTypes="@(VsTemplateProjectItemTypes)" + ReplaceParametersExtensions="@(VsTemplateParameterReplaceExtensions)" + SourceTemplates="@(VSProjectTemplates)" + SourceProjects="@(TemplateProjectsLayout)" + DestinationTemplates="@(VSProjectTemplatesLayout)" + MaximumRelativePathLength="$(ProjectTemplateMaxPath)" + > + <Output TaskParameter="ProjectItems" ItemName="TemplateProjectItems"/> + </MergeProjectWithVSTemplate> + </Target> + + <Target Name="Layout" DependsOnTargets="$(LayoutDependsOn)"> + <ItemGroup> + <TemplateProjectItems Condition=" + '%(Extension)' == '.cs' + or '%(Extension)' == '.csproj' + or '%(Extension)' == '.sql' + or '%(Extension)' == '.config' + or '%(Extension)' == '.Master' + or '%(Extension)' == '.aspx' + or '%(Extension)' == '.ascx' + or '%(Extension)' == '.asax' + or '%(Extension)' == '.ashx' + "> + <BeforeTokens>%(RecursiveDir)</BeforeTokens> + <AfterTokens>$safeprojectname$</AfterTokens> + </TemplateProjectItems> + <TemplateProjectItems> + <SkipUnchangedFiles>true</SkipUnchangedFiles> + </TemplateProjectItems> + <TemplateProjectItemsForTransformSource Include="@(TemplateProjectItems->'%(SourceFullPath)')" + Condition=" '%(TemplateProjectItems.RelativeDir)' != 'RelyingPartyLogic\lib\' "/> + <TemplateProjectItemsForTransformLayout Include="@(TemplateProjectItems->'%(DestinationFullPath)')" + Condition=" '%(TemplateProjectItems.RelativeDir)' != 'RelyingPartyLogic\lib\' "/> + <RootVsTemplateSource Include="*.vstemplate" /> + <ProjectTemplatesSource Include="@(RootVsTemplateSource)" /> + <ProjectTemplatesLayout Include="@(RootVsTemplateSource->'$(ProjectTemplatesLayoutPath)%(FileName)%(Extension)')" /> + + <ProjectTemplatesSource Include="@(ProjectTemplateLibraries)" /> + <ProjectTemplatesLayout Include="@(ProjectTemplateLibrariesTargets)" /> + + <!-- Include the template icon --> + <ProjectTemplatesSource Include="$(ProjectRoot)doc\logo\favicon.ico" /> + <ProjectTemplatesLayout Include="$(ProjectTemplatesLayoutPath)__TemplateIcon.ico" /> + + <TopLevelVS2010ProjectTemplates Include="@(ProjectTemplatesLayout)" Condition=" '%(Extension)' == '.vstemplate' and '%(RootDir)%(Directory)' == '$(ProjectTemplatesLayoutPath)' " /> + <VS2010ProjectTemplateZipFiles Include="@(TopLevelVS2010ProjectTemplates->'%(RootDir)%(Directory)%(FileName).zip')" /> + </ItemGroup> + + <Copy + SourceFiles="@(ProjectTemplatesSource)" + DestinationFiles="@(ProjectTemplatesLayout)" + SkipUnchangedFiles="true" /> + <CopyWithTokenSubstitution + SourceFiles="@(TemplateProjectItemsForTransformSource)" + DestinationFiles="@(TemplateProjectItemsForTransformLayout)" /> + + <ItemGroup> + <ProjectTemplateIntendedFiles Include=" + @(ProjectTemplatesLayout); + @(TemplateProjectItemsForTransformLayout); + @(VSProjectTemplatesLayout); + @(TemplateProjectsLayout); + @(VS2010ProjectTemplateZipFiles); + " /> + <ProjectTemplateIntendedFiles Remove="@(ProjectItemShortPathAdjustments)" /> + </ItemGroup> + <Purge Directories="$(ProjectTemplatesLayoutPath)" + IntendedFiles="@(ProjectTemplateIntendedFiles)" /> + </Target> + + <Target Name="Zip" DependsOnTargets="Layout" Returns="%(VS2010ProjectTemplateContents.ZipFile)"> + <DiscoverProjectTemplates TopLevelTemplates="@(TopLevelVS2010ProjectTemplates)"> + <Output TaskParameter="ProjectTemplates" ItemName="SubVS2010Templates" /> + <Output TaskParameter="ProjectTemplateContents" ItemName="VS2010TemplateItemContents" /> + </DiscoverProjectTemplates> + + <ItemGroup> + <!-- Include in each template .zip file the top-level .vstemplate file itself. --> + <VS2010ProjectTemplateContents Include="@(TopLevelVS2010ProjectTemplates)"> + <ZipFile>$(ProjectTemplatesLayoutPath)%(FileName).zip</ZipFile> + <WorkingDirectory>$(ProjectTemplatesLayoutPath)</WorkingDirectory> + </VS2010ProjectTemplateContents> + + <!-- Now throw in all the files in each of the project-level template's directories and their children. --> + <VS2010ProjectTemplateContents Include="@(VS2010TemplateItemContents)"> + <ZipFile>$(ProjectTemplatesLayoutPath)%(VS2010TemplateItemContents.TopLevelTemplateFileName).zip</ZipFile> + <WorkingDirectory>$(ProjectTemplatesLayoutPath)</WorkingDirectory> + </VS2010ProjectTemplateContents> + + <!-- Include the template icon for each .zip file. --> + <VS2010ProjectTemplateContents Include="@(TopLevelVS2010ProjectTemplates->'$(ProjectTemplatesLayoutPath)__TemplateIcon.ico')"> + <ZipFile>$(ProjectTemplatesLayoutPath)%(TopLevelVS2010ProjectTemplates.FileName).zip</ZipFile> + <WorkingDirectory>$(ProjectTemplatesLayoutPath)</WorkingDirectory> + </VS2010ProjectTemplateContents> + + <ExtensionVsixContents Include="%(VS2010ProjectTemplateContents.ZipFile)" /> + </ItemGroup> + + <Zip + Files="@(VS2010ProjectTemplateContents)" + ZipFileName="%(VS2010ProjectTemplateContents.ZipFile)" + WorkingDirectory="%(VS2010ProjectTemplateContents.WorkingDirectory)" + ZipLevel="$(ZipLevel)" + /> + </Target> + + <Target Name="Layout2008" DependsOnTargets="Layout"> + <ItemGroup> + <ProjectTemplates2008Source Include="$(ProjectTemplatesLayoutPath)**" Exclude="$(ProjectTemplatesLayoutPath)*.zip" /> + <ProjectTemplates2008Layout Include="@(ProjectTemplates2008Source->'$(ProjectTemplates2008LayoutPath)%(RecursiveDir)%(FileName)%(Extension)')" /> + <ProjectTemplates2008Layout> + <HardLink Condition=" '%(Extension)' != '.csproj' ">true</HardLink> + </ProjectTemplates2008Layout> + + <VS2008ProjectTemplates Include="@(ProjectTemplates2008Layout)" Condition="'%(Extension)' == '.vstemplate'" /> + <TopLevelVS2008ProjectTemplates Include="@(VS2008ProjectTemplates)" Condition="'%(RootDir)%(Directory)' == '$(ProjectTemplates2008LayoutPath)'" /> + <VS2008ProjectTemplateZipFiles Include="@(TopLevelVS2008ProjectTemplates->'%(RootDir)%(Directory)%(FileName).zip')" /> + </ItemGroup> + <Message Text="VS2008ProjectTemplates: @(VS2008ProjectTemplates)" /> + + <HardLinkCopy SourceFiles="@(ProjectTemplates2008Source)" DestinationFiles="@(ProjectTemplates2008Layout)" /> + + <DowngradeProjects + Projects="@(ProjectTemplates2008Layout)" + Condition="'%(Extension)' == '.csproj'" + DowngradeMvc2ToMvc1="true" + /> + + <Purge Directories="$(ProjectTemplates2008LayoutPath)" + IntendedFiles="@(ProjectTemplates2008Layout);@(VS2008ProjectTemplateZipFiles)" /> + </Target> + + <Target Name="Zip2008" DependsOnTargets="Layout2008" Returns="%(VS2008ProjectTemplateContents.ZipFile)"> + <DiscoverProjectTemplates TopLevelTemplates="@(TopLevelVS2008ProjectTemplates)"> + <Output TaskParameter="ProjectTemplates" ItemName="SubVS2008Templates" /> + <Output TaskParameter="ProjectTemplateContents" ItemName="VS2008TemplateItemContents" /> + </DiscoverProjectTemplates> + + <ItemGroup> + <!-- Include in each template .zip file the top-level .vstemplate file itself. --> + <VS2008ProjectTemplateContents Include="@(TopLevelVS2008ProjectTemplates)"> + <ZipFile>$(ProjectTemplates2008LayoutPath)%(FileName).zip</ZipFile> + <WorkingDirectory>$(ProjectTemplates2008LayoutPath)</WorkingDirectory> + </VS2008ProjectTemplateContents> + + <!-- Now throw in all the files in each of the project-level template's directories and their children. --> + <VS2008ProjectTemplateContents Include="@(VS2008TemplateItemContents)"> + <ZipFile>$(ProjectTemplates2008LayoutPath)%(VS2008TemplateItemContents.TopLevelTemplateFileName).zip</ZipFile> + <WorkingDirectory>$(ProjectTemplates2008LayoutPath)</WorkingDirectory> + </VS2008ProjectTemplateContents> + + <!-- Include the template icon for each .zip file. --> + <VS2008ProjectTemplateContents Include="@(TopLevelVS2008ProjectTemplates->'$(ProjectTemplates2008LayoutPath)__TemplateIcon.ico')"> + <ZipFile>$(ProjectTemplates2008LayoutPath)%(TopLevelVS2008ProjectTemplates.FileName).zip</ZipFile> + <WorkingDirectory>$(ProjectTemplates2008LayoutPath)</WorkingDirectory> + </VS2008ProjectTemplateContents> + </ItemGroup> + + <Zip + Files="@(VS2008ProjectTemplateContents)" + ZipFileName="%(VS2008ProjectTemplateContents.ZipFile)" + WorkingDirectory="%(VS2008ProjectTemplateContents.WorkingDirectory)" + ZipLevel="$(ZipLevel)" + /> + </Target> + + <Target Name="Build" DependsOnTargets="Zip;Zip2008" /> + + <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.automated.targets"/> +</Project>
\ No newline at end of file diff --git a/projecttemplates/projecttemplates.props b/projecttemplates/projecttemplates.props new file mode 100644 index 0000000..2bdc859 --- /dev/null +++ b/projecttemplates/projecttemplates.props @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <!-- We use GetFullPath here because IntermediatePath may be a relative directory, and we need to do full path comparisons. --> + <ProjectTemplatesLayoutPath>$([System.IO.Path]::GetFullPath('$(IntermediatePath)projecttemplates\'))</ProjectTemplatesLayoutPath> + <ProjectTemplates2008LayoutPath>$([System.IO.Path]::GetFullPath('$(IntermediatePath)projecttemplates2008\'))</ProjectTemplates2008LayoutPath> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tools/Publish.targets b/samples/Samples.proj index 415750c..c79a0a4 100644 --- a/tools/Publish.targets +++ b/samples/Samples.proj @@ -1,37 +1,40 @@ +<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <!-- Properties that must be set for these targets to function: $(BranchName): The name of the branch being built. Used to determine the web subdirectory for publishing. For creating web sites: $(PublishSamplesWebSiteName): The name of the web site under which the sample web applications will be created/deleted. - $(PublishDocsWebSiteName): The name of the web site under which the documentation web applications will be created/deleted. For creating or publishing to web sites: $(SampleWebRoot): the full physical path to where samples should be copied to, excluding $(BranchName) - $(DocWebRoot): the full physical path to where documentation should be copied to, excluding $(BranchName) --> + <Import Project="$(MSBuildProjectDirectory)\..\tools\DotNetOpenAuth.automated.props"/> - <Target Name="PrepareForIIS"> + <ItemGroup> + <SampleProjects Include="**\*.csproj;**\*.vbproj" /> + <SampleSites Include="OAuthConsumer;OAuthServiceProvider;InfoCardRelyingParty" /> + + <ProjectsToClean Include="@(SampleProjects)" /> + <ProjectsToClean Include="$(SolutionPath)"> + <Targets>@(SampleSites->'%(Identity):Clean')</Targets> + </ProjectsToClean> + </ItemGroup> + + <Target Name="Build" DependsOnTargets="SkipVerification"> + <MSBuild Projects="@(SampleProjects)" BuildInParallel="$(BuildInParallel)" /> + <MSBuild Projects="$(SolutionPath)" Targets="@(SampleSites)" BuildInParallel="$(BuildInParallel)" /> + </Target> + + <Target Name="Prepare"> <Error Text="The BranchName property must be set." Condition=" '$(BranchName)' == '' " /> - + <Error Text="The SampleWebRoot property must be set." Condition=" '$(SampleWebRoot)' == '' " /> <PropertyGroup> <PublishSamplesWebSiteVirtualPath>/$(BranchName)</PublishSamplesWebSiteVirtualPath> - <PublishDocsWebSiteVirtualPath>/$(BranchName)</PublishDocsWebSiteVirtualPath> </PropertyGroup> - </Target> - - <Target Name="PrepareForPublishSamples" - Condition=" '$(SampleWebRoot)' != '' " - DependsOnTargets="BuildSamples"> - <Error Text="The BranchName property must be set." Condition=" '$(BranchName)' == '' " /> - <ItemGroup> <_SampleWebConfigs Include="$(ProjectRoot)samples\*\web.config" /> <PublishableWebSamples Include="@(_SampleWebConfigs->'%(RootDir)%(Directory)')" /> - <SampleSources Include="$(ProjectRoot)samples\**\*" /> - <SampleSources> - <PublishedLocation>$(SampleWebRoot)\$(BranchName)\%(RecursiveDir)%(Filename)%(Extension)</PublishedLocation> - </SampleSources> </ItemGroup> <!-- Trim the trailing slash on the web sample paths so we can just get the leaf directory name. --> @@ -45,6 +48,15 @@ <PublishableWebSamplesVirtualPaths Include="@(_PublishableWebSamplesNoTrailingSlash->'$(PublishSamplesWebSiteVirtualPath)/%(Filename)')" /> <PublishableWebSamplesPhysicalPaths Include="@(_PublishableWebSamplesNoTrailingSlash->'$(SampleWebRoot)\$(BranchName)\%(Filename)')" /> </ItemGroup> + </Target> + + <Target Name="PrepareForPublish" DependsOnTargets="Prepare;Build"> + <ItemGroup> + <SampleSources Include="$(ProjectRoot)samples\**\*" /> + <SampleSources> + <PublishedLocation>$(SampleWebRoot)\$(BranchName)\%(RecursiveDir)%(Filename)%(Extension)</PublishedLocation> + </SampleSources> + </ItemGroup> <FilterItems InputItems="@(SampleSources)" @@ -57,8 +69,8 @@ </ItemGroup> </Target> - <Target Name="PublishSamples" - DependsOnTargets="PrepareForPublishSamples" + <Target Name="Publish" + DependsOnTargets="PrepareForPublish" Inputs="@(PublishableWebSampleSources)" Outputs="@(PublishableWebSampleTargets)" Condition=" '$(SampleWebRoot)' != '' "> @@ -67,34 +79,12 @@ <Copy SourceFiles="@(PublishableWebSampleSources)" DestinationFiles="@(PublishableWebSampleTargets)" SkipUnchangedFiles="true" /> </Target> - <Target Name="UnpublishSamples" - DependsOnTargets="DeleteSampleSitesOnIis" + <Target Name="Unpublish" + DependsOnTargets="DeleteSitesOnIis" Condition=" '$(SampleWebRoot)' != '' "> </Target> - - <Target Name="PrepareForPublishDocumentation" DependsOnTargets="Documentation"> - <ItemGroup> - <DocSources Include="$(ProjectRoot)doc\api\**\*" /> - <DocTargets Include="@(DocSources->'$(DocWebRoot)\$(BranchName)\%(RecursiveDir)%(Filename)%(Extension)')" /> - </ItemGroup> - </Target> - - <Target Name="PublishDocumentation" - DependsOnTargets="PrepareForPublishDocumentation" - Inputs="@(DocSources)" - Outputs="@(DocTargets)" - Condition=" '$(DocWebRoot)' != '' "> - <RemoveDir Directories="$(DocWebRoot)\$(BranchName)" /> - <MakeDir Directories="$(DocWebRoot)\$(BranchName)" /> - <Copy SourceFiles="@(DocSources)" DestinationFiles="@(DocTargets)" SkipUnchangedFiles="true" /> - </Target> - <Target Name="UnpublishDocumentation" - DependsOnTargets="DeleteDocumentationSiteOnIis" - Condition=" '$(DocWebRoot)' != '' "> - </Target> - - <Target Name="CreateSampleSitesOnIis" DependsOnTargets="PrepareForIIS;PrepareForPublishSamples"> + <Target Name="CreateSitesOnIis" DependsOnTargets="Prepare"> <Error Text="The PublishSamplesWebSiteName property must be set." Condition=" '$(PublishSamplesWebSiteName)' == '' "/> <Error Text="The SampleWebRoot property must be set." Condition=" '$(SampleWebRoot)' == '' " /> <CreateWebApplication @@ -104,7 +94,7 @@ /> </Target> - <Target Name="DeleteSampleSitesOnIis" DependsOnTargets="PrepareForIIS"> + <Target Name="DeleteSitesOnIis" DependsOnTargets="Prepare"> <Error Text="The PublishSamplesWebSiteName property must be set." Condition=" '$(PublishSamplesWebSiteName)' == '' "/> <DeleteWebApplication WebSiteName="$(PublishSamplesWebSiteName)" @@ -112,21 +102,5 @@ /> </Target> - <Target Name="CreateDocumentationSiteOnIis" DependsOnTargets="PrepareForIIS"> - <Error Text="The PublishDocsWebSiteName property must be set." Condition=" '$(PublishDocsWebSiteName)' == '' "/> - <Error Text="The DocWebRoot property must be set." Condition=" '$(DocWebRoot)' == '' " /> - <CreateWebApplication - WebSiteName="$(PublishDocsWebSiteName)" - PhysicalPaths="$(DocWebRoot)\$(BranchName)" - VirtualPaths="$(PublishDocsWebSiteVirtualPath)" - /> - </Target> - - <Target Name="DeleteDocumentationSiteOnIis" DependsOnTargets="PrepareForIIS"> - <Error Text="The PublishDocsWebSiteName property must be set." Condition=" '$(PublishDocsWebSiteName)' == '' "/> - <DeleteWebApplication - WebSiteName="$(PublishDocsWebSiteName)" - VirtualPaths="$(PublishDocsWebSiteVirtualPath)" - /> - </Target> + <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.automated.targets"/> </Project> diff --git a/samples/tools.proj b/samples/tools.proj new file mode 100644 index 0000000..c6c63c4 --- /dev/null +++ b/samples/tools.proj @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildProjectDirectory)\..\tools\DotNetOpenAuth.automated.props"/> + + <Target Name="Layout" DependsOnTargets="BuildUnifiedProduct"> + <PropertyGroup> + <ToolsDirectoryNoSlash>$(DropsRoot)$(ProductName)-Tools-$(BuildVersion)</ToolsDirectoryNoSlash> + <ToolsDirectory>$(ToolsDirectoryNoSlash)\</ToolsDirectory> + </PropertyGroup> + + <ItemGroup> + <ToolProjects Include="$(ProjectRoot)Samples\OpenIdOfflineProvider\OpenIdOfflineProvider.csproj" /> + </ItemGroup> + + <MSBuild Projects="@(ToolProjects)" BuildInParallel="$(BuildInParallel)" /> + + <ItemGroup> + <OfflineProvider Include=" + $(OutputPath)**\*.dll; + $(OutputPath)OpenIdOfflineProvider.exe" + Exclude=" + $(OutputPath)$(ProductName).*; + $(ILMergeOutputAssembly); + "/> + <OfflineProviderTargets Include=" + @(OfflineProvider->'$(ToolsDirectory)%(RecursiveDir)%(FileName)%(Extension)')"/> + <OfflineProvider Include="$(ILMergeOutputAssembly)" /> + <OfflineProviderTargets Include="$(ToolsDirectory)$(ProductName).dll" /> + + <AllToolSources Include="@(OfflineProvider)" /> + <AllToolTargets Include="@(OfflineProviderTargets)" /> + </ItemGroup> + + <MakeDir Directories="@(ToolsDirectory)" /> + <Copy SourceFiles="@(AllToolSources)" DestinationFiles="@(AllToolTargets)" SkipUnchangedFiles="true" /> + + <!-- remove files that shouldn't be in the directory (perhaps from a previous version). --> + <Purge Directories="$(ToolsDirectory)" IntendedFiles="@(AllToolTargets)" /> + </Target> + + <Target Name="Build" DependsOnTargets="Layout"> + <PropertyGroup> + <ToolsZip>$(ToolsDirectoryNoSlash).zip</ToolsZip> + </PropertyGroup> + + <Zip ZipFileName="$(ToolsZip)" + Files="@(AllToolTargets)" + WorkingDirectory="$(ToolsDirectory)" + ZipLevel="$(ZipLevel)" /> + </Target> + + <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.automated.targets"/> +</Project>
\ No newline at end of file diff --git a/src/DotNetOpenAuth.BuildTasks/ChangeProjectReferenceToAssemblyReference.cs b/src/DotNetOpenAuth.BuildTasks/ChangeProjectReferenceToAssemblyReference.cs index f940a72..503e168 100644 --- a/src/DotNetOpenAuth.BuildTasks/ChangeProjectReferenceToAssemblyReference.cs +++ b/src/DotNetOpenAuth.BuildTasks/ChangeProjectReferenceToAssemblyReference.cs @@ -1,47 +1,59 @@ -using System; -using System.Linq; -using System.IO; -using System.Xml; +namespace DotNetOpenAuth.BuildTasks { + using System; + using System.IO; + using System.Linq; + using System.Xml; + using Microsoft.Build.BuildEngine; + using Microsoft.Build.Framework; + using Microsoft.Build.Utilities; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using Microsoft.Build.BuildEngine; - -namespace DotNetOpenAuth.BuildTasks { /// <summary> /// Replaces ProjectReference items in a set of projects with Reference items. /// </summary> public class ChangeProjectReferenceToAssemblyReference : Task { + private const string msbuildNamespace = "http://schemas.microsoft.com/developer/msbuild/2003"; + /// <summary> /// The projects to alter. /// </summary> [Required] public ITaskItem[] Projects { get; set; } + /// <summary> - /// The project reference to remove. + /// The project references to remove. /// </summary> [Required] - public string ProjectReference { get; set; } + public ITaskItem[] ProjectReferences { get; set; } + /// <summary> - /// The assembly reference to add. + /// The assembly references to add. /// </summary> [Required] - public string Reference { get; set; } + public ITaskItem[] References { get; set; } - const string msbuildNamespace = "http://schemas.microsoft.com/developer/msbuild/2003"; public override bool Execute() { - foreach (var project in Projects) { - Log.LogMessage(MessageImportance.Normal, "Changing P2P references to assembly references in \"{0}\".", project.ItemSpec); + if (this.ProjectReferences.Length != this.References.Length) { + this.Log.LogError("ProjectReferences and References arrays do not have matching lengths."); + } + foreach (var project in Projects) { Project doc = new Project(); doc.Load(project.ItemSpec); - - var projectReference = doc.EvaluatedItems.OfType<BuildItem>().Where( - item => item.Name == "ProjectReference" && item.Include == ProjectReference).Single(); - doc.RemoveItem(projectReference); - var newReference = doc.AddNewItem("Reference", Path.GetFileNameWithoutExtension(Reference), true); - newReference.SetMetadata("HintPath", Reference); + var projectReferences = doc.EvaluatedItems.OfType<BuildItem>().Where(item => item.Name == "ProjectReference"); + var matchingReferences = from reference in projectReferences + join refToRemove in this.ProjectReferences on reference.Include equals refToRemove.ItemSpec + let addIndex = Array.IndexOf(this.ProjectReferences, refToRemove) + select new { Remove = reference, Add = this.References[addIndex] }; + foreach (var matchingReference in matchingReferences) { + this.Log.LogMessage("Removing project reference to \"{0}\" from \"{1}\".", matchingReference.Remove.Include, project.ItemSpec); + doc.RemoveItem(matchingReference.Remove); + if (matchingReference.Add.ItemSpec != "REMOVE") { + this.Log.LogMessage("Adding assembly reference to \"{0}\" to \"{1}\".", matchingReference.Add.ItemSpec, project.ItemSpec); + var newReference = doc.AddNewItem("Reference", Path.GetFileNameWithoutExtension(matchingReference.Add.ItemSpec), true); + newReference.SetMetadata("HintPath", matchingReference.Add.ItemSpec); + } + } doc.Save(project.ItemSpec); } diff --git a/src/DotNetOpenAuth.BuildTasks/CopyWithTokenSubstitution.cs b/src/DotNetOpenAuth.BuildTasks/CopyWithTokenSubstitution.cs index 38f3b50..5b097ab 100644 --- a/src/DotNetOpenAuth.BuildTasks/CopyWithTokenSubstitution.cs +++ b/src/DotNetOpenAuth.BuildTasks/CopyWithTokenSubstitution.cs @@ -56,7 +56,12 @@ namespace DotNetOpenAuth.BuildTasks { for (int i = 0; i < this.SourceFiles.Length; i++) { string sourcePath = this.SourceFiles[i].ItemSpec; string destPath = this.DestinationFiles[i].ItemSpec; - bool skipUnchangedFiles = bool.Parse(this.SourceFiles[i].GetMetadata("SkipUnchangedFiles")); + bool skipUnchangedFiles; + bool.TryParse(this.SourceFiles[i].GetMetadata("SkipUnchangedFiles"), out skipUnchangedFiles); + + if (!Directory.Exists(Path.GetDirectoryName(destPath))) { + Directory.CreateDirectory(Path.GetDirectoryName(destPath)); + } if (string.IsNullOrEmpty(this.SourceFiles[i].GetMetadata("BeforeTokens"))) { // this is just a standard copy without token substitution @@ -65,7 +70,7 @@ namespace DotNetOpenAuth.BuildTasks { continue; } - Log.LogMessage(MessageImportance.Normal, "Copying \"{0}\" -> \"{1}\"", sourcePath, destPath); + Log.LogMessage(MessageImportance.Normal, "Copying file from \"{0}\" to \"{1}\"", sourcePath, destPath); File.Copy(sourcePath, destPath, true); } else { // We deliberably consider newer destination files to be up-to-date rather than @@ -85,9 +90,6 @@ namespace DotNetOpenAuth.BuildTasks { } using (StreamReader sr = File.OpenText(sourcePath)) { - if (!Directory.Exists(Path.GetDirectoryName(destPath))) { - Directory.CreateDirectory(Path.GetDirectoryName(destPath)); - } using (StreamWriter sw = File.CreateText(destPath)) { StringBuilder line = new StringBuilder(); while (!sr.EndOfStream) { diff --git a/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.sln b/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.sln index 34a8e46..f3e3982 100644 --- a/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.sln +++ b/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.sln @@ -4,11 +4,20 @@ Microsoft Visual Studio Solution File, Format Version 11.00 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{ABBE14A3-0404-4123-9093-E598C3DD3E9B}" ProjectSection(SolutionItems) = preProject ..\..\build.proj = ..\..\build.proj + ..\..\doc\doc.proj = ..\..\doc\doc.proj + ..\..\tools\DotNetOpenAuth.automated.props = ..\..\tools\DotNetOpenAuth.automated.props + ..\..\tools\DotNetOpenAuth.automated.targets = ..\..\tools\DotNetOpenAuth.automated.targets ..\..\lib\DotNetOpenAuth.BuildTasks.targets = ..\..\lib\DotNetOpenAuth.BuildTasks.targets ..\..\tools\DotNetOpenAuth.Common.Settings.targets = ..\..\tools\DotNetOpenAuth.Common.Settings.targets ..\..\tools\DotNetOpenAuth.props = ..\..\tools\DotNetOpenAuth.props ..\..\tools\DotNetOpenAuth.targets = ..\..\tools\DotNetOpenAuth.targets ..\..\tools\DotNetOpenAuth.Versioning.targets = ..\..\tools\DotNetOpenAuth.Versioning.targets + ..\..\tools\drop.proj = ..\..\tools\drop.proj + ..\..\projecttemplates\projecttemplates.proj = ..\..\projecttemplates\projecttemplates.proj + ..\..\samples\Samples.proj = ..\..\samples\Samples.proj + ..\..\samples\tools.proj = ..\..\samples\tools.proj + ..\..\vsi\vsi.proj = ..\..\vsi\vsi.proj + ..\..\vsix\vsix.proj = ..\..\vsix\vsix.proj EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetOpenAuth.BuildTasks", "DotNetOpenAuth.BuildTasks.csproj", "{AC231A51-EF60-437C-A33F-AF8ADEB8EB74}" diff --git a/src/DotNetOpenAuth.BuildTasks/FixupReferenceHintPaths.cs b/src/DotNetOpenAuth.BuildTasks/FixupReferenceHintPaths.cs index 13a4b8f..babaab3 100644 --- a/src/DotNetOpenAuth.BuildTasks/FixupReferenceHintPaths.cs +++ b/src/DotNetOpenAuth.BuildTasks/FixupReferenceHintPaths.cs @@ -40,7 +40,13 @@ namespace DotNetOpenAuth.BuildTasks { // Figure out what the assembly names are of the references that are available. AssemblyName[] availableReferences = new AssemblyName[this.References.Length]; for (int i = 0; i < this.References.Length; i++) { - availableReferences[i] = AssemblyName.GetAssemblyName(this.References[i].ItemSpec); + if (File.Exists(this.References[i].ItemSpec)) { + availableReferences[i] = AssemblyName.GetAssemblyName(this.References[i].ItemSpec); + } else { + availableReferences[i] = new AssemblyName(Path.GetFileNameWithoutExtension(this.References[i].ItemSpec)) { + CodeBase = this.References[i].GetMetadata("FullPath"), + }; + } } foreach (var projectTaskItem in this.Projects) { diff --git a/src/DotNetOpenAuth.BuildTasks/MergeProjectWithVSTemplate.cs b/src/DotNetOpenAuth.BuildTasks/MergeProjectWithVSTemplate.cs index c24d634..601ff6f 100644 --- a/src/DotNetOpenAuth.BuildTasks/MergeProjectWithVSTemplate.cs +++ b/src/DotNetOpenAuth.BuildTasks/MergeProjectWithVSTemplate.cs @@ -8,6 +8,7 @@ namespace DotNetOpenAuth.BuildTasks { using System; using System.Collections.Generic; using System.Diagnostics.Contracts; + using System.Globalization; using System.IO; using System.Linq; using System.Text; @@ -15,17 +16,16 @@ namespace DotNetOpenAuth.BuildTasks { using Microsoft.Build.BuildEngine; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; - using System.Globalization; public class MergeProjectWithVSTemplate : Task { internal const string VSTemplateNamespace = "http://schemas.microsoft.com/developer/vstemplate/2005"; - + internal const string VsixNamespace = "http://schemas.microsoft.com/developer/vsx-schema/2010"; /// <summary> /// A dictionary where the key is the project name and the value is the path contribution. /// </summary> - private Dictionary<string, string> vsixContributionToPath = new Dictionary<string,string>(StringComparer.OrdinalIgnoreCase); + private Dictionary<string, string> vsixContributionToPath = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); [Required] public string[] ProjectItemTypes { get; set; } @@ -34,40 +34,42 @@ namespace DotNetOpenAuth.BuildTasks { public string[] ReplaceParametersExtensions { get; set; } [Required] - public ITaskItem[] Templates { get; set; } + public ITaskItem[] SourceTemplates { get; set; } - /// <summary> - /// Gets or sets the path to the .vsixmanifest file that will be used to assist - /// in calculating the actual full path of project items. - /// </summary> - /// <remarks> - /// This property is required if <see cref="EnsureMaxPath"/> > 0; - /// </remarks> - public ITaskItem VsixManifest { get; set; } + [Required] + public ITaskItem[] SourceProjects { get; set; } + + [Required] + public ITaskItem[] DestinationTemplates { get; set; } /// <summary> /// Gets or sets the maximum length a project item's relative path should /// be limited to, artificially renaming them as necessary. /// </summary> /// <value>Use 0 to disable the renaming feature.</value> - public int EnsureMaxPath { get; set; } + public int MaximumRelativePathLength { get; set; } /// <summary> - /// Gets or sets the project items that had to be renamed to comply with maximum path length requirements. + /// Gets or sets the project item paths from the source project to copy to the destination location. /// </summary> - /// <remarks> - /// The item name is the original full path. The ShortPath metadata contains the shortened full path. - /// </remarks> [Output] - public ITaskItem[] MaxPathAdjustedPaths { get; set; } + public ITaskItem[] ProjectItems { get; set; } /// <summary> /// Executes this instance. /// </summary> public override bool Execute() { - var shortenedItems = new List<ITaskItem>(); + if (this.DestinationTemplates.Length != this.SourceTemplates.Length) { + this.Log.LogError("SourceTemplates array has length {0} while DestinationTemplates array has length {1}, but must equal.", this.SourceTemplates.Length, this.DestinationTemplates.Length); + } + if (this.SourceProjects.Length != this.SourceTemplates.Length) { + this.Log.LogError("SourceTemplates array has length {0} while SourceProjects array has length {1}, but must equal.", this.SourceTemplates.Length, this.SourceProjects.Length); + } + + var projectItemsToCopy = new List<ITaskItem>(); - foreach(ITaskItem sourceTemplateTaskItem in this.Templates) { + for (int iTemplate = 0; iTemplate < this.SourceTemplates.Length; iTemplate++) { + ITaskItem sourceTemplateTaskItem = this.SourceTemplates[iTemplate]; var template = XElement.Load(sourceTemplateTaskItem.ItemSpec); var templateContentElement = template.Element(XName.Get("TemplateContent", VSTemplateNamespace)); var projectElement = templateContentElement.Element(XName.Get("Project", VSTemplateNamespace)); @@ -76,20 +78,69 @@ namespace DotNetOpenAuth.BuildTasks { continue; } - var projectPath = Path.Combine(Path.GetDirectoryName(sourceTemplateTaskItem.ItemSpec), projectElement.Attribute("File").Value); + var projectPath = this.SourceProjects[iTemplate].ItemSpec; var projectDirectory = Path.GetDirectoryName(Path.Combine(Path.GetDirectoryName(sourceTemplateTaskItem.GetMetadata("FullPath")), projectElement.Attribute("File").Value)); Log.LogMessage("Merging project \"{0}\" with \"{1}\".", projectPath, sourceTemplateTaskItem.ItemSpec); var sourceProject = new Project(); sourceProject.Load(projectPath); + var projectItems = sourceProject.EvaluatedItems.Cast<BuildItem>().Where(item => this.ProjectItemTypes.Contains(item.Name)); + + // Figure out where every project item is in source, and where it will go in the destination, + // taking into account a given maximum path length that may require that we shorten the path. + var sourceToDestinationProjectItemMap = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); + //var oversizedItemPaths = projectItems.Where(item => item.Include.Length > this.MaximumRelativePathLength); + foreach (var item in projectItems) { + var source = item.Include; + var dest = item.Include; + + // if (this.MaximumRelativePathLength > 0) { + // if (item.Include.Length > this.MaximumRelativePathLength) { + // string leafName = Path.GetFileName(item.Include); + // int targetLeafLength = leafName.Length - (item.Include.Length - this.MaximumRelativePathLength); + // string shortenedFileName = CreateUniqueShortFileName(leafName, targetLeafLength); + // string shortenedRelativePath = Path.Combine(Path.GetDirectoryName(item.Include), shortenedFileName); + // if (shortenedRelativePath.Length <= this.MaximumRelativePathLength) { + // this.Log.LogMessage( + // "Renaming long project item '{0}' to '{1}' within project template to avoid MAX_PATH issues. The instantiated project will remain unchanged.", + // item.Include, + // shortenedRelativePath); + // projectItem.SetAttributeValue("TargetFileName", Path.GetFileName(item.Include)); + // projectItem.Value = shortenedFileName; + // string originalFullPath = Path.Combine(projectDirectory, item.Include); + // string shortenedFullPath = Path.Combine(projectDirectory, shortenedRelativePath); + // if (File.Exists(shortenedFullPath)) { + // File.Delete(shortenedFullPath); // File.Move can't overwrite files + // } + // File.Move(originalFullPath, shortenedFullPath); + + // // Document the change so the build system can account for it. + // TaskItem shortChange = new TaskItem(originalFullPath); + // shortChange.SetMetadata("ShortPath", shortenedFullPath); + // shortenedItems.Add(shortChange); + // } else { + // this.Log.LogError( + // "Project item '{0}' exceeds maximum allowable length {1} by {2} characters and it cannot be sufficiently shortened. Estimated full path is: '{3}'.", + // item.Include, + // this.MaximumRelativePathLength, + // item.Include.Length - this.MaximumRelativePathLength, + // item.Include); + // } + // } + //} + + sourceToDestinationProjectItemMap[source] = dest; + } // Collect the project items from the project that are appropriate // to include in the .vstemplate file. - var itemsByFolder = from item in sourceProject.EvaluatedItems.Cast<BuildItem>() - where this.ProjectItemTypes.Contains(item.Name) - orderby item.Include - group item by Path.GetDirectoryName(item.Include); + var itemsByFolder = from item in projectItems + orderby item.Include + group item by Path.GetDirectoryName(item.Include); + foreach (var folder in itemsByFolder) { - XElement parentNode = FindOrCreateParent(folder.Key, projectElement); + XElement parentNode = projectElement; + parentNode = FindOrCreateParent(folder.Key, projectElement); + //parentNode.SetAttributeValue("TargetFolderName", folder.Key); foreach (var item in folder) { bool replaceParameters = this.ReplaceParametersExtensions.Contains(Path.GetExtension(item.Include)); @@ -102,50 +153,21 @@ namespace DotNetOpenAuth.BuildTasks { if (replaceParameters) { projectItem.SetAttributeValue("ReplaceParameters", "true"); } - - if (this.EnsureMaxPath > 0) { - string estimatedFullPath = EstimateFullPathInProjectCache(Path.GetFileNameWithoutExtension(sourceProject.FullFileName), item.Include); - if (estimatedFullPath.Length > this.EnsureMaxPath) { - string leafName = Path.GetFileName(item.Include); - int targetLeafLength = leafName.Length - (estimatedFullPath.Length - this.EnsureMaxPath); - string shortenedFileName = CreateUniqueShortFileName(leafName, targetLeafLength); - string shortenedRelativePath = Path.Combine(Path.GetDirectoryName(item.Include), shortenedFileName); - string shortenedEstimatedFullPath = EstimateFullPathInProjectCache(Path.GetFileNameWithoutExtension(sourceProject.FullFileName), shortenedRelativePath); - if (shortenedEstimatedFullPath.Length <= this.EnsureMaxPath) { - this.Log.LogMessage( - "Renaming long project item '{0}' to '{1}' within project template to avoid MAX_PATH issues. The instantiated project will remain unchanged.", - item.Include, - shortenedRelativePath); - projectItem.SetAttributeValue("TargetFileName", Path.GetFileName(item.Include)); - projectItem.Value = shortenedFileName; - string originalFullPath = Path.Combine(projectDirectory, item.Include); - string shortenedFullPath = Path.Combine(projectDirectory, shortenedRelativePath); - if (File.Exists(shortenedFullPath)) { - File.Delete(shortenedFullPath); // File.Move can't overwrite files - } - File.Move(originalFullPath, shortenedFullPath); - - // Document the change so the build system can account for it. - TaskItem shortChange = new TaskItem(originalFullPath); - shortChange.SetMetadata("ShortPath", shortenedFullPath); - shortenedItems.Add(shortChange); - } else { - this.Log.LogError( - "Project item '{0}' exceeds maximum allowable length {1} by {2} characters and it cannot be sufficiently shortened. Estimated full path is: '{3}'.", - item.Include, - this.EnsureMaxPath, - estimatedFullPath.Length - this.EnsureMaxPath, - estimatedFullPath); - } - } - } } } - template.Save(sourceTemplateTaskItem.ItemSpec); + template.Save(this.DestinationTemplates[iTemplate].ItemSpec); + foreach (var pair in sourceToDestinationProjectItemMap) { + TaskItem item = new TaskItem(Path.Combine(Path.GetDirectoryName(this.SourceTemplates[iTemplate].ItemSpec), pair.Key)); + item.SetMetadata("SourceFullPath", Path.GetFullPath(Path.Combine(Path.GetDirectoryName(this.SourceTemplates[iTemplate].ItemSpec), pair.Key))); + item.SetMetadata("DestinationFullPath", Path.GetFullPath(Path.Combine(Path.GetDirectoryName(this.DestinationTemplates[iTemplate].ItemSpec), pair.Value))); + item.SetMetadata("RecursiveDir", Path.GetDirectoryName(this.SourceTemplates[iTemplate].ItemSpec)); + projectItemsToCopy.Add(item); + } } - this.MaxPathAdjustedPaths = shortenedItems.ToArray(); + this.ProjectItems = projectItemsToCopy.ToArray(); + return !Log.HasLoggedErrors; } @@ -158,7 +180,7 @@ namespace DotNetOpenAuth.BuildTasks { return fileName; } - string hashSuffix = Utilities.SuppressCharacters(fileName.GetHashCode().ToString("x"), Path.GetInvalidFileNameChars(), '_'); + string hashSuffix = Utilities.SuppressCharacters(Math.Abs(fileName.GetHashCode() % 0xfff).ToString("x"), Path.GetInvalidFileNameChars(), '_'); string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileName); string extension = Path.GetExtension(fileName); string hashSuffixWithExtension = hashSuffix + extension; @@ -194,36 +216,5 @@ namespace DotNetOpenAuth.BuildTasks { return parent; } - - private string EstimateFullPathInProjectCache(string projectName, string itemRelativePath) { - Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(projectName)); - Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(itemRelativePath)); - - const string PathRoot = @"c:\documents and settings\usernameZZZ\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\"; - string subPath; - if (!vsixContributionToPath.TryGetValue(projectName, out subPath)) { - if (this.VsixManifest == null) { - this.Log.LogError("The task parameter VsixManifest is required but missing."); - } - var vsixDocument = XDocument.Load(this.VsixManifest.ItemSpec); - XElement vsix = vsixDocument.Element(XName.Get("Vsix", VsixNamespace)); - XElement identifier = vsix.Element(XName.Get("Identifier", VsixNamespace)); - XElement content = vsix.Element(XName.Get("Content", VsixNamespace)); - string author = identifier.Element(XName.Get("Author", VsixNamespace)).Value; - string name = identifier.Element(XName.Get("Name", VsixNamespace)).Value; - string version = identifier.Element(XName.Get("Version", VsixNamespace)).Value; - string pt = content.Element(XName.Get("ProjectTemplate", VsixNamespace)).Value; - vsixContributionToPath[projectName] = subPath = string.Format( - CultureInfo.InvariantCulture, - @"{0}\{1}\{2}\~PC\{3}\CSharp\Web\{4}.zip\", - author, - name, - version, - pt, - projectName - ); - } - return Path.Combine(PathRoot + subPath + Path.GetFileNameWithoutExtension(projectName), itemRelativePath); - } } } diff --git a/src/DotNetOpenAuth.BuildTasks/Purge.cs b/src/DotNetOpenAuth.BuildTasks/Purge.cs index e19e485..cf1a214 100644 --- a/src/DotNetOpenAuth.BuildTasks/Purge.cs +++ b/src/DotNetOpenAuth.BuildTasks/Purge.cs @@ -7,12 +7,12 @@ namespace DotNetOpenAuth.BuildTasks { using System; using System.Collections.Generic; + using System.IO; using System.Linq; using System.Text; - using Microsoft.Build.Utilities; - using Microsoft.Build.Framework; - using System.IO; using System.Text.RegularExpressions; + using Microsoft.Build.Framework; + using Microsoft.Build.Utilities; /// <summary> /// Purges directory trees of all directories and files that are not on a whitelist. @@ -40,6 +40,7 @@ namespace DotNetOpenAuth.BuildTasks { /// <summary> /// Gets or sets the files that should be NOT be purged. /// </summary> + [Required] public ITaskItem[] IntendedFiles { get; set; } /// <summary> @@ -82,7 +83,7 @@ namespace DotNetOpenAuth.BuildTasks { } private static string NormalizePath(string path) { - return Regex.Replace(path, @"\\+", @"\"); + return Path.GetFullPath(Regex.Replace(path, @"\\+", @"\")); } } } diff --git a/src/DotNetOpenAuth/DotNetOpenAuth.csproj b/src/DotNetOpenAuth/DotNetOpenAuth.csproj index 3bfecae..70b2710 100644 --- a/src/DotNetOpenAuth/DotNetOpenAuth.csproj +++ b/src/DotNetOpenAuth/DotNetOpenAuth.csproj @@ -728,6 +728,27 @@ http://opensource.org/licenses/ms-pl.html </BootstrapperPackage> <Content Include="DotNetOpenAuth.ico" /> </ItemGroup> + + <ItemGroup> + <SignDependsOn Include="BuildUnifiedProduct" /> + <DelaySignedAssemblies Include="$(ILMergeOutputAssembly); + $(OutputPath)$(ProductName).Contracts.dll; + " /> + </ItemGroup> + + <Target Name="BuildUnifiedProduct" + DependsOnTargets="Build" + Inputs="@(ILMergeInputAssemblies)" + Outputs="$(ILMergeOutputAssembly)"> + <MakeDir Directories="$(ILMergeOutputAssemblyDirectory)" /> + <ILMerge ExcludeFile="$(ProjectRoot)ILMergeInternalizeExceptions.txt" + InputAssemblies="@(ILMergeInputAssemblies)" + OutputFile="$(ILMergeOutputAssembly)" + KeyFile="$(PublicKeyFile)" + DelaySign="true" + /> + </Target> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.targets" /> </Project> diff --git a/tools/DotNetOpenAuth.automated.props b/tools/DotNetOpenAuth.automated.props new file mode 100644 index 0000000..f66c1fe --- /dev/null +++ b/tools/DotNetOpenAuth.automated.props @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> + <Import Project="DotNetOpenAuth.props"/> + + <PropertyGroup> + <AutomatedBuild>true</AutomatedBuild> + <SolutionPath>$(ProjectRoot)src\$(ProductName).sln</SolutionPath> + <BuildInParallel Condition=" '$(BuildInParallel)' == '' ">true</BuildInParallel> + <!-- Validation controls whether extra builds are done in order to fully validate what we're distributing, + even if we're not distributing the built bits (as is the case for project templates). --> + <Validation Condition=" '$(Validation)' == '' ">Full</Validation> + </PropertyGroup> +</Project> diff --git a/tools/DotNetOpenAuth.automated.targets b/tools/DotNetOpenAuth.automated.targets new file mode 100644 index 0000000..5333b34 --- /dev/null +++ b/tools/DotNetOpenAuth.automated.targets @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0" InitialTargets="_SetDropProperties"> + <Import Project="$(ProjectRoot)tools\$(ProductName).targets"/> + <UsingTask AssemblyFile="$(ProjectRoot)lib\MSBuild.Community.Tasks.dll" TaskName="Zip"/> + <UsingTask AssemblyFile="$(ProjectRoot)lib\MSBuild.Community.Tasks.dll" TaskName="NUnit" /> + + <Target Name="Rebuild" DependsOnTargets="Clean;Build"/> + + <Target Name="Clean"> + <ItemGroup> + <ProjectsToClean> + <Targets Condition=" '%(ProjectsToClean.Targets)' == '' ">Clean</Targets> + </ProjectsToClean> + </ItemGroup> + + <Delete Files="@(FilesToClean)" /> + <RemoveDir Directories="@(DirectoriesToClean)" /> + <MSBuild Projects="@(ProjectsToClean)" Targets="%(ProjectsToClean.Targets)" BuildInParallel="$(BuildInParallel)" /> + </Target> + + <Target Name="_SetDropProperties" DependsOnTargets="GetBuildVersion"> + <!-- This target is necessary because PropertyGroups within the same Target as + where CallTarget is fired do NOT affect those called targets. --> + <!-- The rest of these are here so that other DependsOn targets have access to these properties. --> + <PropertyGroup> + <DropDirectoryNoSlash>$(DropsRoot)$(ProductName)-$(BuildVersion)</DropDirectoryNoSlash> + <DropDirectory>$(DropDirectoryNoSlash)\</DropDirectory> + </PropertyGroup> + </Target> + + <Target Name="SkipVerification" Condition="'$(IsElevated)' == 'true'"> + <SignatureVerification SkipVerification="true" AssemblyName="*" PublicKeyToken="$(PublicKeyToken)" /> + </Target> + + <Target Name="BuildProduct" DependsOnTargets="SkipVerification"> + <MSBuild BuildInParallel="$(BuildInParallel)" + Projects="$(ProjectRoot)src\$(ProductName)\$(ProductName).csproj" /> + </Target> + + <Target Name="BuildUnifiedProduct" DependsOnTargets="BuildProduct"> + <MSBuild BuildInParallel="$(BuildInParallel)" + Projects="$(ProjectRoot)src\$(ProductName)\$(ProductName).csproj" + Targets="BuildUnifiedProduct" /> + </Target> +</Project> diff --git a/tools/DotNetOpenAuth.props b/tools/DotNetOpenAuth.props index a3ad973..91a5e5e 100644 --- a/tools/DotNetOpenAuth.props +++ b/tools/DotNetOpenAuth.props @@ -4,13 +4,14 @@ <ProductName>DotNetOpenAuth</ProductName> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <TargetFrameworkVersion Condition=" '$(TargetFrameworkVersion)' == '' ">v3.5</TargetFrameworkVersion> - <ProjectRoot Condition="'$(ProjectRoot)' == ''">$(MSBuildProjectDirectory)\</ProjectRoot> - <DropsRoot>$(ProjectRoot)drops\$(Configuration)\</DropsRoot> + <ProjectRoot Condition="'$(ProjectRoot)' == ''">$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\'))</ProjectRoot> + <DropsRoot>$(ProjectRoot)drops\$(TargetFrameworkVersion)\$(Configuration)\</DropsRoot> <OutputPath>$(ProjectRoot)bin\$(TargetFrameworkVersion)\$(Configuration)\</OutputPath> <DocOutputPath>$(ProjectRoot)doc\</DocOutputPath> <IntermediatePath>$(ProjectRoot)obj\$(TargetFrameworkVersion)\$(Configuration)\</IntermediatePath> <BaseIntermediateOutputPath Condition=" '$(BaseIntermediateOutputPath)' == '' ">obj\$(TargetFrameworkVersion)\</BaseIntermediateOutputPath> <ToolsDir>$(ProjectRoot)tools\</ToolsDir> + <ZipLevel>6</ZipLevel> <ClrVersion Condition=" '$(TargetFrameworkVersion)' == 'v4.0' ">4</ClrVersion> <ClrVersion Condition=" '$(TargetFrameworkVersion)' != 'v4.0' ">2</ClrVersion> @@ -20,8 +21,17 @@ <KeyPairContainer Condition="'$(KeyPairContainer)' == ''">DotNetOpenAuth</KeyPairContainer> <PublicKeyToken>2780CCD10D57B246</PublicKeyToken> <DelaySign>true</DelaySign> + + <ILMergeOutputAssemblyDirectory>$(OutputPath)unified\</ILMergeOutputAssemblyDirectory> + <ILMergeOutputAssembly>$(ILMergeOutputAssemblyDirectory)$(ProductName).dll</ILMergeOutputAssembly> </PropertyGroup> + <ItemGroup> + <SignDependsOn Include="Build" /> + <ILMergeInputAssemblies Include="$(OutputPath)$(ProductName).dll; + $(ProjectRoot)lib\Microsoft.Contracts.dll; "/> + </ItemGroup> + <Import Project="$(ProjectRoot)lib\DotNetOpenAuth.BuildTasks.targets" /> <Target Name="InitializeProps"> diff --git a/tools/DotNetOpenAuth.targets b/tools/DotNetOpenAuth.targets index 9a2c6f9..34aa424 100644 --- a/tools/DotNetOpenAuth.targets +++ b/tools/DotNetOpenAuth.targets @@ -2,12 +2,17 @@ <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> <Import Project="DotNetOpenAuth.Versioning.targets" /> <Import Project="JavascriptPacker.targets" /> + <UsingTask AssemblyFile="$(ProjectRoot)lib\MSBuild.Community.Tasks.dll" TaskName="ILMerge"/> <PropertyGroup> <DefineConstants Condition=" '$(SignAssembly)' == 'true' ">$(DefineConstants);StrongNameSigned</DefineConstants> <DefineConstants Condition=" '$(ClrVersion)' == '4' ">$(DefineConstants);CLR4</DefineConstants> </PropertyGroup> + <ItemGroup> + <DelaySignedAssemblies Include="$(TargetPath)" /> + </ItemGroup> + <ItemGroup Condition=" '$(ClrVersion)' != '4' "> <Reference Include="Microsoft.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=736440c9b414ea16, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> @@ -48,4 +53,31 @@ <Output TaskParameter="AccessorAssembly" ItemName="ReferencePath" /> </Publicize> </Target> + + <Target Name="Sign" DependsOnTargets="@(SignDependsOn)" Condition=" '@(DelaySignedAssemblies)' != '' "> + <!-- Add the resource assemblies. --> + <PropertyGroup> + <DelaySignedSatelliteAssembliesPattern>@(DelaySignedAssemblies->'%(RootDir)%(Directory)*\%(FileName).resources.*')</DelaySignedSatelliteAssembliesPattern> + </PropertyGroup> + <ItemGroup> + <DelaySignedSatelliteAssemblies Include="$(DelaySignedSatelliteAssembliesPattern)" /> + </ItemGroup> + + <Message Text="Signing delay-signed assemblies using key pair container $(KeyPairContainer)." /> + <ReSignDelaySignedAssemblies + KeyContainer="$(KeyPairContainer)" + Assemblies="@(DelaySignedAssemblies);@(DelaySignedSatelliteAssemblies)" + Condition="Exists(%(Identity))" /> + </Target> + + <Target Name="ResignDelaySignedAssemblies"> + <ItemGroup> + <DelaySignedProjects Include=" + $(ProjectRoot)src\dotnetopenauth\dotnetopenauth.csproj; + $(ProjectRoot)src\dotnetopenauth.test\dotnetopenauth.test.csproj; + $(ProjectRoot)samples\openidofflineprovider\openidofflineprovider.csproj; + " /> + </ItemGroup> + <MSBuild Projects="@(DelaySignedProjects)" Targets="Sign" BuildInParallel="$(BuildInParallel)" /> + </Target> </Project> diff --git a/tools/drop.proj b/tools/drop.proj new file mode 100644 index 0000000..143d3b5 --- /dev/null +++ b/tools/drop.proj @@ -0,0 +1,139 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildProjectDirectory)\DotNetOpenAuth.automated.props"/> + + <Target Name="Layout" DependsOnTargets="BuildUnifiedProduct;ReSignDelaySignedAssemblies"> + <!-- Note that we use an MSBuild task for these dependencies rather than individual DependsOnTargets entries + so that these builds can be executed in parallel. --> + <MSBuild BuildInParallel="$(BuildInParallel)" + Projects=" + $(ProjectRoot)samples\samples.proj; + $(ProjectRoot)vsi\vsi.proj; + $(ProjectRoot)vsix\vsix.proj; + $(ProjectRoot)doc\doc.proj; + "> + <Output TaskParameter="TargetOutputs" ItemName="DropLayoutDependencies"/> + </MSBuild> + <PropertyGroup> + <DropBinDirectory>$(DropDirectory)Bin\</DropBinDirectory> + <DropLibDirectory>$(DropDirectory)Lib\</DropLibDirectory> + <DropProjectTemplatesDirectory>$(DropDirectory)Project Templates\</DropProjectTemplatesDirectory> + <DropSamplesDirectory>$(DropDirectory)Samples\</DropSamplesDirectory> + <DropSpecsDirectory>$(DropDirectory)Specs\</DropSpecsDirectory> + </PropertyGroup> + <ItemGroup> + <ExtensionVsix Include="@(DropLayoutDependencies)" Condition=" '%(DropLayoutDependencies.MSBuildSourceProjectFile)' == '$(ProjectRoot)vsix\vsix.proj' " /> + <ProjectTemplatesVsi Include="@(DropLayoutDependencies)" Condition=" '%(DropLayoutDependencies.MSBuildSourceProjectFile)' == '$(ProjectRoot)vsi\vsi.proj' " /> + <DropDirectories Include=" + $(DropDirectory); + $(DropBinDirectory); + $(DropLibDirectory); + $(DropProjectTemplatesDirectory); + $(DropSamplesDirectory); + $(DropSpecsDirectory); + " /> + + <DropSourceFiles Include=" + $(ProjectRoot)Doc\$(ProductName).chm; + $(ProjectRoot)Doc\*.htm*; + $(ProjectRoot)LICENSE.txt; + $(ProjectRoot)CONTRIB.txt; + " + Exclude="$(ProjectRoot)Doc\README.*.html;" /> + <DropBinSourceFiles Include=" + $(ILMergeOutputAssemblyDirectory)$(ProductName).???; + $(OutputPath)**\$(ProductName).resources.dll; + $(OutputPath)$(ProductName).xml; + $(OutputPath)$(ProductName).Contracts.???; + $(ProjectRoot)Doc\README.Bin.html; + $(ProjectRoot)src\$(ProductName)\Configuration\$(ProductName).xsd; + " /> + <DropLibSourceFiles Include=" + $(ProjectRoot)Lib\log4net.*; + " /> + <DropProjectTemplatesSourceFiles Include="@(ProjectTemplatesVsi)" /> + <DropVsixSourceFiles Include="@(ExtensionVsix)" Condition=" '%(ExtensionVsix.IncludeInDrop)' == 'true' " /> + <DropSamplesSourceFiles Include="$(ProjectRoot)Samples\**" Exclude=" + $(ProjectRoot)**\obj\**; + $(ProjectRoot)**\*.sln.cache; + $(ProjectRoot)**\*.suo; + $(ProjectRoot)**\*.user; + $(ProjectRoot)**\*.gitignore; + $(ProjectRoot)**\*.ldf; + $(ProjectRoot)**\*.log*; + $(ProjectRoot)**\*~; + $(ProjectRoot)**\Debug\**; + $(ProjectRoot)**\Settings.StyleCop; + $(ProjectRoot)**\StyleCop.Cache; + $(ProjectRoot)Samples\**\DotNetOpenAuth.???; + $(ProjectRoot)Samples\**\log4net.???; + $(ProjectRoot)Samples\**\PresentationCore.dll; + $(ProjectRoot)Samples\**\System.Printing.dll; + $(ProjectRoot)Samples\**\*.refresh_; + $(ProjectRoot)Samples\*.proj; + " /> + <!-- Some .refresh files are only applicable to drop builds, so we rename them from *.refresh_ --> + <DropSamplesRefreshSourceFiles Include="$(ProjectRoot)Samples\**\*.refresh_" /> + <DropSpecsSourceFiles Include="$(ProjectRoot)Doc\specs\*.htm*" /> + + <DropFiles Include="@(DropSourceFiles->'$(DropDirectory)%(RecursiveDir)%(FileName)%(Extension)')"/> + <DropBinFiles Include="@(DropBinSourceFiles->'$(DropBinDirectory)%(RecursiveDir)%(FileName)%(Extension)')"/> + <DropLibFiles Include="@(DropLibSourceFiles->'$(DropLibDirectory)%(RecursiveDir)%(FileName)%(Extension)')"/> + <DropProjectTemplatesFiles Include="@(DropProjectTemplatesSourceFiles->'$(DropProjectTemplatesDirectory)%(FileName)%(Extension)')" /> + <DropVsixFiles Include="@(DropVsixSourceFiles->'$(DropProjectTemplatesDirectory)%(FileName)%(Extension)')" /> + <DropSamplesFiles Include="@(DropSamplesSourceFiles->'$(DropSamplesDirectory)%(RecursiveDir)%(FileName)%(Extension)')"/> + <DropSamplesRefreshFiles Include="@(DropSamplesRefreshSourceFiles->'$(DropSamplesDirectory)%(RecursiveDir)%(FileName).refresh')"/> + <DropSamplesToolsProjects Include="$(DropSamplesDirectory)OpenIdOfflineProvider\OpenIdOfflineProvider.csproj" /> + <DropSpecsFiles Include="@(DropSpecsSourceFiles->'$(DropSpecsDirectory)%(RecursiveDir)%(FileName)%(Extension)')"/> + + <AllDropSources Include=" + @(DropSourceFiles); + @(DropBinSourceFiles); + @(DropLibSourceFiles); + @(DropProjectTemplatesSourceFiles); + @(DropVsixSourceFiles); + @(DropSamplesSourceFiles); + @(DropSamplesRefreshSourceFiles); + @(DropDocSourceFiles); + @(DropSpecsSourceFiles); + " /> + + <AllDropTargets Include=" + @(DropFiles); + @(DropBinFiles); + @(DropLibFiles); + @(DropProjectTemplatesFiles); + @(DropVsixFiles); + @(DropSamplesFiles); + @(DropSamplesRefreshFiles); + @(DropDocFiles); + @(DropSpecsFiles) + " /> + </ItemGroup> + + <!-- clean up any previous drop with the same name so we don't aggregate files. --> + <MakeDir Directories="@(DropDirectories)" /> + <Copy SourceFiles="@(AllDropSources)" DestinationFiles="@(AllDropTargets)" SkipUnchangedFiles="true" /> + <Purge Directories="$(DropDirectory)" IntendedFiles="@(AllDropTargets)" /> + <!-- fix up the samples so that they will compile right out of the drop --> + <ItemGroup> + <SampleProjectTargets Include="$(DropSamplesDirectory)**\*.*proj" /> + <SampleSolutionTargets Include="$(DropSamplesDirectory)**\*.sln" /> + </ItemGroup> + <FixupShippingToolSamples Projects="@(DropSamplesToolsProjects)" + RemoveImportsStartingWith="%24(ProjectRoot)tools\" + AddReferences="Microsoft.Contracts"/> + <ChangeProjectReferenceToAssemblyReference Projects="@(SampleProjectTargets)" + ProjectReferences="..\..\src\$(ProductName)\$(ProductName).csproj" References="..\..\Bin\$(ProductName).dll" /> + <DowngradeProjects Projects="@(SampleProjectTargets);@(SampleSolutionTargets)" DowngradeMvc2ToMvc1="true" /> + </Target> + + <Target Name="Build" DependsOnTargets="Layout"> + <PropertyGroup> + <DropZip>$(DropDirectoryNoSlash).zip</DropZip> + </PropertyGroup> + <Zip Files="@(AllDropTargets)" ZipFileName="$(DropZip)" WorkingDirectory="$(DropsRoot)" ZipLevel="$(ZipLevel)" /> + </Target> + + <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.automated.targets"/> +</Project>
\ No newline at end of file diff --git a/vsi/vsi.proj b/vsi/vsi.proj new file mode 100644 index 0000000..04ac615 --- /dev/null +++ b/vsi/vsi.proj @@ -0,0 +1,53 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildProjectDirectory)\..\tools\DotNetOpenAuth.automated.props"/> + <Import Project="..\projecttemplates\ProjectTemplates.props"/> + + <PropertyGroup> + <ProjectTemplatesVsiDirectory>$(IntermediatePath)vsi\</ProjectTemplatesVsiDirectory> + </PropertyGroup> + + <ItemGroup> + <DirectoriesToClean Include="$(ProjectTemplatesLayoutPath)" /> + <ProjectTemplates Include="$(ProjectRoot)projecttemplates\**\*.*proj" /> + </ItemGroup> + + <Target Name="Build" Returns="$(ProjectTemplatesVsi)"> + <MSBuild Projects="..\projecttemplates\projecttemplates.proj" Targets="Zip2008" BuildInParallel="$(BuildInParallel)"> + <Output TaskParameter="TargetOutputs" ItemName="ProjectTemplate2008ZipSource"/> + </MSBuild> + + <PropertyGroup> + <ProjectTemplatesVsi>$(DropDirectoryNoSlash).vsi</ProjectTemplatesVsi> + </PropertyGroup> + <ItemGroup> + <VsiTransformSource Include="*.vscontent"> + <BeforeTokens>$version$</BeforeTokens> + <AfterTokens>$(BuildVersion)</AfterTokens> + <SkipUnchangedFiles>false</SkipUnchangedFiles> + </VsiTransformSource> + <VsiTransformLayout Include="@(VsiTransformSource->'$(ProjectTemplatesVsiDirectory)%(RecursiveDir)%(FileName)%(Extension)')" /> + + <ProjectTemplateVsiContents Include=" + $(ProjectTemplatesVsiDirectory)*.zip; + @(VsiTransformLayout); + " /> + + <ProjectTemplate2008ZipSource> + <HardLink>true</HardLink> + </ProjectTemplate2008ZipSource> + <ProjectTemplate2008ZipTargets Include="@(ProjectTemplate2008ZipSource->'$(ProjectTemplatesVsiDirectory)%(FileName)%(Extension)')" /> + </ItemGroup> + + <CopyWithTokenSubstitution SourceFiles="@(VsiTransformSource)" DestinationFiles="@(VsiTransformLayout)" /> + <HardLinkCopy SourceFiles="@(ProjectTemplate2008ZipSource)" DestinationFiles="@(ProjectTemplate2008ZipTargets)" /> + + <Zip + Files="@(ProjectTemplateVsiContents)" + ZipFileName="$(ProjectTemplatesVsi)" + WorkingDirectory="$(ProjectTemplatesVsiDirectory)" + ZipLevel="$(ZipLevel)" + /> + </Target> + + <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.automated.targets"/> +</Project>
\ No newline at end of file diff --git a/vsix/vsix.proj b/vsix/vsix.proj new file mode 100644 index 0000000..ffa1995 --- /dev/null +++ b/vsix/vsix.proj @@ -0,0 +1,130 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildProjectDirectory)\..\tools\DotNetOpenAuth.automated.props"/> + <Import Project="..\projecttemplates\ProjectTemplates.props"/> + + <PropertyGroup> + <ExtensionVsixLayoutDirectory>$(IntermediatePath)vsix\</ExtensionVsixLayoutDirectory> + <ProjectTemplateSubdirectory>$(ExtensionVsixLayoutDirectory)PT\CSharp\Web\</ProjectTemplateSubdirectory> + </PropertyGroup> + + <Target Name="Layout"> + <MSBuild Projects="..\projecttemplates\projecttemplates.proj" Targets="Zip" BuildInParallel="$(BuildInParallel)"> + <Output TaskParameter="TargetOutputs" ItemName="ProjectTemplateZipSource"/> + </MSBuild> + + <ItemGroup> + <ProjectTemplateZipSource> + <HardLink>true</HardLink> + </ProjectTemplateZipSource> + <ProjectTemplateZipTargets Include="@(ProjectTemplateZipSource->'$(ProjectTemplateSubdirectory)%(FileName)%(Extension)')" /> + + <ExtensionVsixTransformSource Include=" + $(ProjectRoot)vsix\extension.vsixmanifest; + $(ProjectRoot)LICENSE.txt; + "> + <BeforeTokens>$version$</BeforeTokens> + <AfterTokens>$(BuildVersion)</AfterTokens> + <SkipUnchangedFiles>false</SkipUnchangedFiles> + </ExtensionVsixTransformSource> + <ExtensionVsixTransformLayout Include="@(ExtensionVsixTransformSource->'$(ExtensionVsixLayoutDirectory)%(RecursiveDir)%(FileName)%(Extension)')" /> + + <ExtensionVsixSources Include=" + $(ProjectRoot)vsix\*; + " Exclude=" + $(ProjectRoot)vsix\extension.vsixmanifest; + $(ProjectRoot)vsix\$(MSBuildThisFile); + "> + <SkipUnchangedFiles>true</SkipUnchangedFiles> + </ExtensionVsixSources> + <ExtensionVsixTargets Include="@(ExtensionVsixSources->'$(ExtensionVsixLayoutDirectory)%(FileName)%(Extension)')" /> + + <ExtensionVsixContents Include=" + @(ExtensionVsixTargets); + @(ExtensionVsixTransformLayout); + @(ProjectTemplateZipTargets); + "/> + </ItemGroup> + + <CopyWithTokenSubstitution SourceFiles="@(ExtensionVsixTransformSource)" DestinationFiles="@(ExtensionVsixTransformLayout)" /> + <Copy SourceFiles="@(ExtensionVsixSources)" DestinationFiles="@(ExtensionVsixTargets)" SkipUnchangedFiles="true" /> + <HardLinkCopy SourceFiles="@(ProjectTemplateZipSource)" DestinationFiles="@(ProjectTemplateZipTargets)" /> + <Purge Directories="$(ExtensionVsixLayoutDirectory)" IntendedFiles="@(ExtensionVsixContents)" /> + </Target> + + <Target Name="VSGalleryVsixLayout" DependsOnTargets="Layout"> + <!-- Build individual VSIX files for each project template for the Visual Studio Gallery, + which only allows one project template per VSIX. --> + <ItemGroup> + <VSGalleryVsixRawSources Include="$(ExtensionVsixLayoutDirectory)*" + Exclude="$(ExtensionVsixLayoutDirectory)*.vsixmanifest"> + <VSGalleryVsix>$(DropsRoot)$(ProductName) %(ProjectTemplateZipTargets.FileName)-$(BuildVersion).vsix</VSGalleryVsix> + <TopLevelTemplate>%(ProjectTemplateZipTargets.FileName)</TopLevelTemplate> + </VSGalleryVsixRawSources> + <VSGalleryVsixSources Include="@(VSGalleryVsixRawSources)"> + <TargetPath>$(IntermediatePath)%(TopLevelTemplate).vsix\%(FileName)%(Extension)</TargetPath> + </VSGalleryVsixSources> + + <VSGalleryVsixZipSources Include="$(ExtensionVsixLayoutDirectory)**\*.zip" /> + <VSGalleryVsixSources Include="@(VSGalleryVsixZipSources)"> + <TopLevelTemplate>%(FileName)</TopLevelTemplate> + <VSGalleryVsix>$(DropsRoot)$(ProductName) %(FileName)-$(BuildVersion).vsix</VSGalleryVsix> + <TargetPath>$(IntermediatePath)%(FileName).vsix\%(RecursiveDir)%(FileName)%(Extension)</TargetPath> + </VSGalleryVsixSources> + + <VSGalleryVsixSources Include="@(ProjectTemplateZipTargets->'$(ProjectRoot)projecttemplates\%(FileName).vsixmanifest')"> + <VSGalleryVsix>$(DropsRoot)$(ProductName) %(ProjectTemplateZipTargets.FileName)-$(BuildVersion).vsix</VSGalleryVsix> + <TopLevelTemplate>%(ProjectTemplateZipTargets.FileName)</TopLevelTemplate> + <TargetPath>$(IntermediatePath)%(ProjectTemplateZipTargets.FileName).vsix\extension.vsixmanifest</TargetPath> + <Transform>true</Transform> + <BeforeTokens>$version$</BeforeTokens> + <AfterTokens>$(BuildVersion)</AfterTokens> + <SkipUnchangedFiles>false</SkipUnchangedFiles> + </VSGalleryVsixSources> + + <VSGalleryVsixTargets Include="@(VSGalleryVsixSources->'%(TargetPath)')"> + <WorkingDirectory>$(IntermediatePath)%(TopLevelTemplate).vsix</WorkingDirectory> + </VSGalleryVsixTargets> + <VSGalleryVsixPathsToPurge Include="@(ProjectTemplateZipTargets->'$(IntermediatePath)%(FileName).vsix')"/> + </ItemGroup> + + <HardLinkCopy + SourceFiles="@(VSGalleryVsixSources)" + DestinationFiles="%(VSGalleryVsixSources.TargetPath)" + Condition=" '%(VSGalleryVsixSources.Transform)' != 'true' "/> + <CopyWithTokenSubstitution + SourceFiles="@(VSGalleryVsixSources)" + DestinationFiles="%(VSGalleryVsixSources.TargetPath)" + Condition=" '%(VSGalleryVsixSources.Transform)' == 'true' "/> + <Purge + Directories="@(VSGalleryVsixPathsToPurge)" + IntendedFiles="@(VSGalleryVsixTargets)" /> + </Target> + + <Target Name="Build" DependsOnTargets="Layout;VSGalleryVsixLayout" Returns="@(GeneratedVsix)"> + <PropertyGroup> + <ExtensionVsix>$(DropsRoot)$(ProductName) SDK-$(BuildVersion).vsix</ExtensionVsix> + </PropertyGroup> + <ItemGroup> + <GeneratedVsix Include="$(ExtensionVsix)"> + <IncludeInDrop>true</IncludeInDrop> + </GeneratedVsix> + <GeneratedVsix Include="%(VSGalleryVsixTargets.VSGalleryVsix)" /> + </ItemGroup> + + <Zip + Files="@(ExtensionVsixContents)" + ZipFileName="$(ExtensionVsix)" + WorkingDirectory="$(ExtensionVsixLayoutDirectory)" + ZipLevel="$(ZipLevel)" + /> + + <Zip + Files="@(VSGalleryVsixTargets)" + ZipFileName="%(VSGalleryVsixTargets.VSGalleryVsix)" + WorkingDirectory="%(VSGalleryVsixTargets.WorkingDirectory)" + ZipLevel="$(ZipLevel)" + /> + </Target> + + <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.automated.targets"/> +</Project>
\ No newline at end of file |