Skip to content
This repository was archived by the owner on Oct 14, 2024. It is now read-only.

Commit 54a23d5

Browse files
Split VSIX into 2 versions: v3 and v1 (#319)
1 parent 177170f commit 54a23d5

7 files changed

+429
-43
lines changed

AjaxControlToolkitVsPackage/AjaxControlToolkitVsPackage.csproj

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
2+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="15.0">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
34
<PropertyGroup>
45
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
56
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -13,6 +14,12 @@
1314
<SignAssembly>True</SignAssembly>
1415
<AssemblyOriginatorKeyFile>..\AjaxKey.snk</AssemblyOriginatorKeyFile>
1516
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
17+
<MinimumVisualStudioVersion>15.0</MinimumVisualStudioVersion>
18+
<FileUpgradeFlags>
19+
</FileUpgradeFlags>
20+
<UpgradeBackupLocation>
21+
</UpgradeBackupLocation>
22+
<OldToolsVersion>4.0</OldToolsVersion>
1623
</PropertyGroup>
1724
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1825
<DebugSymbols>true</DebugSymbols>
@@ -79,8 +86,13 @@
7986
<PropertyGroup>
8087
<UseCodebase>true</UseCodebase>
8188
</PropertyGroup>
89+
<PropertyGroup>
90+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
91+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
92+
</PropertyGroup>
8293
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
83-
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\VSSDK\Microsoft.VsSDK.targets" />
94+
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
95+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\VSSDK\Microsoft.VsSDK.targets" Condition="false" />
8496
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
8597
Other similar extension points exist, see Microsoft.Common.targets.
8698
<Target Name="BeforeBuild">
Lines changed: 17 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,18 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Vsix
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
5-
xmlns="http://schemas.microsoft.com/developer/vsx-schema/2010"
6-
Version="1.0.0">
7-
8-
<Identifier Id="e79bade7-6755-466f-9788-3d8243bdcc5f">
9-
<Name>ASP.NET AJAX Control Toolkit</Name>
10-
<Author>CodePlex Foundation</Author>
11-
<Version>15.1.2.0</Version>
12-
<Description xml:space="preserve">ASP.NET AJAX Control Toolkit Visual Studio integration package</Description>
13-
<License>LICENSE.txt</License>
14-
<Locale>1033</Locale>
15-
<InstalledByMsi>false</InstalledByMsi>
16-
<SupportedProducts>
17-
<VisualStudio Version="10.0">
18-
<Edition>Pro</Edition>
19-
</VisualStudio>
20-
<VisualStudio Version="11.0">
21-
<Edition>Pro</Edition>
22-
</VisualStudio>
23-
<VisualStudio Version="12.0">
24-
<Edition>Pro</Edition>
25-
</VisualStudio>
26-
<VisualStudio Version="13.0">
27-
<Edition>Pro</Edition>
28-
</VisualStudio>
29-
<VisualStudio Version="14.0">
30-
<Edition>Pro</Edition>
31-
</VisualStudio>
32-
<VisualStudio Version="15.0">
33-
<Edition>Pro</Edition>
34-
</VisualStudio>
35-
</SupportedProducts>
36-
<SupportedFrameworkRuntimeEdition MinVersion="4.0" MaxVersion="4.6" />
37-
</Identifier>
38-
39-
<Content>
40-
<ToolboxControl>|%CurrentProject%;PkgdefProjectOutputGroup|</ToolboxControl>
41-
</Content>
42-
</Vsix>
2+
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
3+
<Metadata>
4+
<Identity Id="e79bade7-6755-466f-9788-3d8243bdcc5f" Version="100.0.0.0" Language="en-US" Publisher="CodePlex Foundation" />
5+
<DisplayName>ASP.NET AJAX Control Toolkit</DisplayName>
6+
<Description xml:space="preserve">ASP.NET AJAX Control Toolkit Visual Studio integration package</Description>
7+
<License>LICENSE.txt</License>
8+
</Metadata>
9+
<Installation>
10+
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[10.0,15.0]" />
11+
</Installation>
12+
<Dependencies>
13+
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.0,4.6]" />
14+
</Dependencies>
15+
<Prerequisites>
16+
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0,16.0)" DisplayName="Visual Studio core editor" />
17+
</Prerequisites>
18+
</PackageManifest>
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Drawing.Design;
4+
using System.Linq;
5+
using System.Reflection;
6+
using System.Runtime.InteropServices;
7+
using Microsoft.VisualStudio.Shell;
8+
using System.IO;
9+
10+
namespace AjaxControlToolkitVsPackage {
11+
12+
[PackageRegistration(UseManagedResourcesOnly = true)]
13+
[InstalledProductRegistration("#110", "#112", "1.0"/*, IconResourceID = 400*/)]
14+
[Guid("e79bade7-6755-466f-9788-3d8243bdcc5f")]
15+
[ProvideToolboxItems(2)]
16+
public sealed class AjaxControlToolkitVsPackage : Package {
17+
18+
const string
19+
_actAssemblyName = "AjaxControlToolkit.dll",
20+
_actName = "ASP.NET AJAX Control Toolkit",
21+
_extensionsDirName = "Extensions";
22+
23+
24+
public AjaxControlToolkitVsPackage() {
25+
this.ToolboxInitialized += (s, e) => {
26+
InstallToolboxItems();
27+
};
28+
29+
this.ToolboxUpgraded += (s, e) => {
30+
RemoveToolboxItems();
31+
InstallToolboxItems();
32+
};
33+
}
34+
35+
void InstallToolboxItems() {
36+
var assembly = LoadToolkitAssembly();
37+
var version = assembly.GetName().Version.ToString(2);
38+
39+
var service = (IToolboxService)GetService(typeof(IToolboxService));
40+
foreach(var item in EnumerateToolboxItems(assembly))
41+
service.AddToolboxItem(item, "AJAX Control Toolkit v" + version);
42+
}
43+
44+
void RemoveToolboxItems() {
45+
var service = (IToolboxService)GetService(typeof(IToolboxService));
46+
foreach(var item in EnumerateToolboxItems(LoadToolkitAssembly()))
47+
service.RemoveToolboxItem(item);
48+
}
49+
50+
static IEnumerable<ToolboxItem> EnumerateToolboxItems(Assembly assembly) {
51+
return ToolboxService.GetToolboxItems(assembly, null).Cast<ToolboxItem>();
52+
}
53+
54+
static Assembly LoadToolkitAssembly() {
55+
var result = GetAssemblyFromUserDocs();
56+
if(result != null)
57+
return result;
58+
59+
result = GetAssemblyFromVsExtensions();
60+
if(result != null)
61+
return result;
62+
63+
return GetAssemblyFromCurrentDir();
64+
}
65+
66+
static Assembly GetAssemblyFromUserDocs() {
67+
var path = Path.Combine(
68+
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
69+
_actName,
70+
"Bin",
71+
_actAssemblyName);
72+
73+
return TryLoadAssembly(path);
74+
}
75+
76+
static Assembly GetAssemblyFromVsExtensions() {
77+
var path = Path.Combine(GetParentDirByName(GetCurrentAssemblyPath(), _extensionsDirName), _actName, _actAssemblyName);
78+
79+
return TryLoadAssembly(path);
80+
}
81+
82+
static string GetParentDirByName(string path, string parentName) {
83+
var current = new DirectoryInfo(path);
84+
85+
while (current != null) {
86+
if(String.Compare(current.Name, parentName, true) == 0)
87+
return current.FullName;
88+
89+
current = current.Parent;
90+
}
91+
92+
return String.Empty;
93+
}
94+
95+
static Assembly GetAssemblyFromCurrentDir() {
96+
var path = Path.Combine(GetCurrentAssemblyPath(), _actAssemblyName);
97+
98+
return TryLoadAssembly(path);
99+
}
100+
101+
static string GetCurrentAssemblyPath() {
102+
var path = new Uri(typeof(AjaxControlToolkitVsPackage).Assembly.CodeBase).AbsolutePath;
103+
path = Uri.UnescapeDataString(path);
104+
105+
return Path.GetDirectoryName(path);
106+
}
107+
108+
static Assembly TryLoadAssembly(string path) {
109+
if(!File.Exists(path))
110+
return null;
111+
112+
try {
113+
return Assembly.LoadFrom(path);
114+
} catch {
115+
return null;
116+
}
117+
}
118+
}
119+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<SchemaVersion>2.0</SchemaVersion>
7+
<ProjectGuid>{BB416572-24CB-4A40-A1D6-FECA7F53691F}</ProjectGuid>
8+
<ProjectTypeGuids>{82b43b9b-a64c-4715-b499-d71e9ca2bd60};{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
9+
<OutputType>Library</OutputType>
10+
<AppDesignerFolder>Properties</AppDesignerFolder>
11+
<RootNamespace>AjaxControlToolkitVsPackage</RootNamespace>
12+
<AssemblyName>AjaxControlToolkitVsPackageLegacy</AssemblyName>
13+
<SignAssembly>True</SignAssembly>
14+
<AssemblyOriginatorKeyFile>..\AjaxKey.snk</AssemblyOriginatorKeyFile>
15+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
16+
</PropertyGroup>
17+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<OutputPath>..\bin\</OutputPath>
22+
<DefineConstants>DEBUG;TRACE</DefineConstants>
23+
<ErrorReport>prompt</ErrorReport>
24+
<WarningLevel>4</WarningLevel>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<DebugType>pdbonly</DebugType>
28+
<Optimize>true</Optimize>
29+
<OutputPath>..\bin\</OutputPath>
30+
<DefineConstants>TRACE</DefineConstants>
31+
<ErrorReport>prompt</ErrorReport>
32+
<WarningLevel>4</WarningLevel>
33+
<RunCodeAnalysis>true</RunCodeAnalysis>
34+
</PropertyGroup>
35+
<ItemGroup>
36+
<Reference Include="System" />
37+
<Reference Include="System.Core" />
38+
<Reference Include="System.Drawing" />
39+
<Reference Include="System.Drawing.Design" />
40+
<Reference Include="Microsoft.VisualStudio.OLE.Interop" />
41+
<Reference Include="Microsoft.VisualStudio.Shell.Interop" />
42+
<Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0" />
43+
<Reference Include="Microsoft.VisualStudio.Shell.Interop.9.0" />
44+
<Reference Include="Microsoft.VisualStudio.Shell.Interop.10.0" />
45+
<Reference Include="Microsoft.VisualStudio.Shell.10.0" />
46+
<Reference Include="Microsoft.VisualStudio.Shell.Immutable.10.0" />
47+
</ItemGroup>
48+
<ItemGroup>
49+
<Compile Include="..\SharedAssemblyInfo.cs">
50+
<Link>SharedAssemblyInfo.cs</Link>
51+
</Compile>
52+
<Compile Include="AjaxControlToolkitVsPackage.cs" />
53+
</ItemGroup>
54+
<ItemGroup>
55+
<EmbeddedResource Include="VSPackage.resx">
56+
<MergeWithCTO>true</MergeWithCTO>
57+
<ManifestResourceName>VSPackage</ManifestResourceName>
58+
<SubType>Designer</SubType>
59+
</EmbeddedResource>
60+
</ItemGroup>
61+
<ItemGroup>
62+
<None Include="source.extension.vsixmanifest">
63+
<SubType>Designer</SubType>
64+
</None>
65+
</ItemGroup>
66+
<ItemGroup>
67+
<Content Include="..\bin\Release\AjaxControlToolkit.dll">
68+
<Link>AjaxControlToolkit.dll</Link>
69+
<IncludeInVSIX>true</IncludeInVSIX>
70+
</Content>
71+
<Content Include="..\LICENSE.txt">
72+
<Link>LICENSE.txt</Link>
73+
<IncludeInVSIX>true</IncludeInVSIX>
74+
</Content>
75+
</ItemGroup>
76+
<ItemGroup>
77+
<Folder Include="Properties\" />
78+
</ItemGroup>
79+
<PropertyGroup>
80+
<UseCodebase>true</UseCodebase>
81+
</PropertyGroup>
82+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
83+
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\VSSDK\Microsoft.VsSDK.targets" />
84+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
85+
Other similar extension points exist, see Microsoft.Common.targets.
86+
<Target Name="BeforeBuild">
87+
</Target>
88+
<Target Name="AfterBuild">
89+
</Target>
90+
-->
91+
</Project>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 11.00
3+
# Visual Studio 2010
4+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AjaxControlToolkitVsPackage", "AjaxControlToolkitVsPackage.csproj", "{BB416572-24CB-4A40-A1D6-FECA7F53691F}"
5+
EndProject
6+
Global
7+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8+
Debug|Any CPU = Debug|Any CPU
9+
Release|Any CPU = Release|Any CPU
10+
EndGlobalSection
11+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
12+
{BB416572-24CB-4A40-A1D6-FECA7F53691F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13+
{BB416572-24CB-4A40-A1D6-FECA7F53691F}.Debug|Any CPU.Build.0 = Debug|Any CPU
14+
{BB416572-24CB-4A40-A1D6-FECA7F53691F}.Release|Any CPU.ActiveCfg = Release|Any CPU
15+
{BB416572-24CB-4A40-A1D6-FECA7F53691F}.Release|Any CPU.Build.0 = Release|Any CPU
16+
EndGlobalSection
17+
GlobalSection(SolutionProperties) = preSolution
18+
HideSolutionNode = FALSE
19+
EndGlobalSection
20+
EndGlobal

0 commit comments

Comments
 (0)