Skip to content

Commit

Permalink
VS SDK tools for building VS packages
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilk committed Oct 25, 2011
1 parent 858be51 commit 6d15021
Show file tree
Hide file tree
Showing 14 changed files with 3,674 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
@@ -0,0 +1,2 @@
*.pkgdef text
*.vstemplate text
Binary file added tools/bin/VsSDK/CreateExpInstance.exe
Binary file not shown.
12 changes: 12 additions & 0 deletions tools/bin/VsSDK/CreateExpInstance.exe.config
@@ -0,0 +1,12 @@
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="complus\sdk\bin;PrimaryInteropAssemblies;vspkgs"/>
<dependentAssembly>
<assemblyIdentity name="EnvDTE" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="7.0.3300.0" newVersion="8.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Binary file added tools/bin/VsSDK/CreatePkgDef.exe
Binary file not shown.
15 changes: 15 additions & 0 deletions tools/bin/VsSDK/CreatePkgDef.exe.config
@@ -0,0 +1,15 @@
<configuration>
<startup>
<supportedRuntime version="v4.0"/>
</startup>
<runtime>
<loadFromRemoteSources enabled="true" />
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="EnvDTE" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="7.0.3300.0" newVersion="8.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Binary file added tools/bin/VsSDK/Microsoft.VsSDK.Build.Tasks.dll
Binary file not shown.
187 changes: 187 additions & 0 deletions tools/bin/VsSDK/Microsoft.VsSDK.Common.targets
@@ -0,0 +1,187 @@

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
*************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
This code is licensed under the Visual Studio SDK license terms.
THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
*************************************************************************
-->











<UsingTask TaskName="FindVsSDKInstallation" AssemblyFile="Microsoft.VsSDK.Build.Tasks.dll" />
<UsingTask TaskName="VSCTCompiler" AssemblyFile="Microsoft.VsSDK.Build.Tasks.dll" />
<UsingTask TaskName="CreateMenuPkgDef" AssemblyFile="Microsoft.VsSDK.Build.Tasks.dll" />

<!--
Set the general properties for this installation of the SDK
-->
<PropertyGroup>
<VsSDKVersion>10.0</VsSDKVersion>
<VSSDKTargetPlatformVersion>10.0</VSSDKTargetPlatformVersion>
<VSSDKTargetsPath>$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VsSDKVersion)\VSSDK</VSSDKTargetsPath>
<VSSDKTargetPlatformRegRoot>Software\Microsoft\VisualStudio\$(VSSDKTargetPlatformVersion)</VSSDKTargetPlatformRegRoot>
<VSSDKTargetPlatformRegRootSuffix Condition="'$(VSSDKTargetPlatformRegRootSuffix)' == ''">Exp</VSSDKTargetPlatformRegRootSuffix>
</PropertyGroup>

<Target Name="FindSDKInstallation"
Condition="'$(VsSDKInstall)'==''">
<FindVsSDKInstallation SDKVersion="$(VsSDKVersion)">
<Output TaskParameter="InstallationPath" PropertyName="VsSDKInstall" />
<Output TaskParameter="IncludesPath" PropertyName="VsSDKIncludes" />
<Output TaskParameter="ToolsPath" PropertyName="VsSDKToolsPath" />
</FindVsSDKInstallation>
</Target>

<!--
=======================================================================================================
VSCT Compilation
=======================================================================================================
-->
<PropertyGroup>
<VSCTCompileDependsOn>$(VSCTCompileDependsOn);FindSDKInstallation</VSCTCompileDependsOn>
<!--Make sure that the __CTC__ macro is defined. This macro is used in common headers
like vsshids.h, so we need it for every VSCT compilation.-->
<__internal_VSCTDefinitions>__CTC__;_CTC_GUIDS_;$(VSCTDefinitions)</__internal_VSCTDefinitions>
<VsctVerboseOutput Condition="'$(VsctVerboseOutput)' == ''">false</VsctVerboseOutput>
</PropertyGroup>

<Target Name="VSCTCompile"
DependsOnTargets="$(VSCTCompileDependsOn)"
Condition="'$(BuildingProject)' != 'false' And '@(VSCTCompile)' != ''">

<!--Create the list of include path to use for the VSCT compilation-->
<ItemGroup>
<!--First add the user provided folders-->
<_InternalVSCTIncludePath Include="@(VSCTIncludePath)" Condition="'@(VSCTIncludePath)' != ''"/>
<!--Now add the internal folders-->
<_InternalVSCTIncludePath Include="$(VsSDKIncludes)" Condition="'$(VsSDKIncludes)' != ''"/>
<_InternalVSCTIncludePath Include="$(VsSDKIncludes)\office10" Condition="'$(VsSDKIncludes)' != ''"/>
</ItemGroup>

<VSCTCompiler AdditionalIncludeDirectories="@(_InternalVSCTIncludePath)"
IntermediateDirectory="$(IntermediateOutputPath)"
Definitions="$(__internal_VSCTDefinitions)"
NoLogo="true"
OutputFile="%(VSCTCompile.FileName).cto"
Source="%(VSCTCompile.Identity)"
Verbose="$(VsctVerboseOutput)"
SDKVersion="$(VsSDKVersion)">
<Output TaskParameter="TemporaryFiles" ItemName="_TemporaryVsctCompilerFiles"/>
</VSCTCompiler>

<!--Record the VSCT compile CTO outputs for the Clean task.-->
<ItemGroup>
<FileWrites Include="$(IntermediateOutputPath)%(VSCTCompile.FileName).cto" Condition="Exists('$(IntermediateOutputPath)%(VSCTCompile.FileName).cto')"/>
<FileWrites Include="@(_TemporaryVsctCompilerFiles)" />
</ItemGroup>
</Target>

<!--
=======================================================================================================
Force AppId to refresh menu cache
=======================================================================================================
-->
<!-- The goal of this target is to force a change in a Menu entry of a pkgdef file when a .vsct file is updated to force VS to pick up the new .cto -->
<Target Name="CreateMenuPkgDef"
Inputs="@(VSCTCompile)"
Outputs="$(PkgdefFileWithMenuEntry)"
DependsOnTargets="$(CreateMenuPkgDefDependsOn)"
AfterTargets="VSCTCompile"
BeforeTargets="PrepareForRun">

<CreateMenuPkgDef PkgdefFile="$(PkgdefFileWithMenuEntry)" VsctFile="%(VSCTCompile.FullPath)" Condition="'$(PkgdefFileWithMenuEntry)'!=''"/>
</Target>


<!--
============================================================
_VsixCleanRecordFileWrites
Save the list of all files written to disk by the VSIX targets so that it can be used for "Clean" later.
Files written in prior builds are not removed from Clean cache.
============================================================
-->
<Target
Name="_VsixCleanRecordFileWrites"
AfterTargets="IncrementalClean">

<!-- Read the list of files deployed by prior builds from disk. -->
<ReadLinesFromFile File="$(IntermediateOutputPath)$(VsixCleanFile)">
<Output TaskParameter="Lines" ItemName="_VsixCleanPriorFileWrites"/>
</ReadLinesFromFile>

<!--
Merge list of files from prior builds with the current build and then
remove duplicates.
-->
<RemoveDuplicates Inputs="@(_VsixCleanPriorFileWrites);@(_VsixDeployCurrentFileWrites)">
<Output TaskParameter="Filtered" ItemName="_VsixCleanUniqueFileWrites"/>
</RemoveDuplicates>

<!-- Make sure the directory exists. -->
<MakeDir Directories="$(IntermediateOutputPath)"/>

<!-- Write merged file list back to disk, replacing existing contents. -->
<WriteLinesToFile
File="$(IntermediateOutputPath)$(VsixCleanFile)"
Lines="@(_VsixCleanUniqueFileWrites)"
Overwrite="true" />

</Target>

<!--
=======================================================================================================
Clean Deployed Vsix Extension Files
=======================================================================================================
-->
<PropertyGroup>
<VsixCleanFile Condition="'$(VsixCleanFile)'==''">$(MSBuildProjectFile).VsixDeployedFileListAbsolute.txt</VsixCleanFile>
<ShouldCleanDeployedVsixExtensionFiles Condition="'$(ShouldCleanDeployedVsixExtensionFiles)'==''">true</ShouldCleanDeployedVsixExtensionFiles>
</PropertyGroup>
<Target Name="CleanDeployedVsixExtensionFiles"
BeforeTargets="AfterClean"
Condition="$(ShouldCleanDeployedVsixExtensionFiles)">

<!-- Read the list of files deployed by prior builds from disk. -->
<ReadLinesFromFile File="$(IntermediateOutputPath)$(VsixCleanFile)">
<Output TaskParameter="Lines" ItemName="_VsixCleanPriorFileWrites"/>
</ReadLinesFromFile>

<!-- Remove duplicates. -->
<RemoveDuplicates Inputs="@(_VsixCleanPriorFileWrites)">
<Output TaskParameter="Filtered" ItemName="_VsixUniqueCleanPriorFileWrites"/>
</RemoveDuplicates>

<Delete Files="@(_VsixUniqueCleanPriorFileWrites)" TreatErrorsAsWarnings="true">
<Output TaskParameter="DeletedFiles" ItemName="_VsixCleanFilesDeleted"/>
</Delete>

<!-- Create a list of everything that wasn't deleted for some reason. -->
<ItemGroup>
<_VsixCleanRemainingFileWritesAfterIncrementalClean Include="@(_VsixUniqueCleanPriorFileWrites)" Exclude="@(_VsixCleanFilesDeleted)"/>
</ItemGroup>

<!-- Write new list of current files back to disk, replacing the existing list.-->
<WriteLinesToFile
File="$(IntermediateOutputPath)$(VsixCleanFile)"
Lines="@(_VsixCleanRemainingFileWritesAfterIncrementalClean)"
Condition="'@(_VsixCleanPriorFileWrites)'!='@(_VsixCleanRemainingFileWritesAfterIncrementalClean)'"
Overwrite="true"/>

</Target>

</Project>

0 comments on commit 6d15021

Please sign in to comment.