Skip to content

Commit 97e3213

Browse files
authored
Merge pull request #26 from valdisiljuconoks/master
Upgrade for CMS 11
2 parents a16aa22 + 350440d commit 97e3213

10 files changed

+322
-270
lines changed

.nuget/NuGet.exe

3.19 MB
Binary file not shown.

.nuget/NuGet.targets

Lines changed: 115 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -1,123 +1,125 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<PropertyGroup>
4-
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
5-
6-
<!-- Enable the restore command to run before builds -->
7-
<RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages>
8-
9-
<!-- Property that enables building a package from a project -->
10-
<BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>
11-
12-
<!-- Determines if package restore consent is required to restore packages -->
13-
<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent>
14-
15-
<!-- Download NuGet.exe if it does not already exist -->
16-
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
17-
</PropertyGroup>
18-
19-
<ItemGroup Condition=" '$(PackageSources)' == '' ">
20-
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
21-
<!-- The official NuGet package source (https://nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
22-
<!--
23-
<PackageSource Include="https://nuget.org/api/v2/" />
24-
<PackageSource Include="https://my-nuget-source/nuget/" />
25-
-->
26-
</ItemGroup>
27-
28-
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
29-
<!-- Windows specific commands -->
30-
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
31-
<PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
32-
</PropertyGroup>
33-
34-
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
35-
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
36-
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
37-
<PackagesConfig>packages.config</PackagesConfig>
38-
</PropertyGroup>
39-
40-
<PropertyGroup>
41-
<!-- NuGet command -->
42-
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\nuget.exe</NuGetExePath>
43-
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>
44-
45-
<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
46-
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>
47-
48-
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
49-
50-
<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
51-
<!-- Commands -->
52-
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(RequireConsentSwitch) -solutionDir "$(SolutionDir) "</RestoreCommand>
53-
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>
54-
55-
<!-- We need to ensure packages are restored prior to assembly resolve -->
56-
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
57-
RestorePackages;
58-
$(BuildDependsOn);
59-
</BuildDependsOn>
60-
61-
<!-- Make the build depend on restore packages -->
62-
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
63-
$(BuildDependsOn);
64-
BuildPackage;
65-
</BuildDependsOn>
66-
</PropertyGroup>
67-
68-
<Target Name="CheckPrerequisites">
69-
<!-- Raise an error if we're unable to locate nuget.exe -->
70-
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
71-
<SetEnvironmentVariable EnvKey="VisualStudioVersion" EnvValue="$(VisualStudioVersion)" Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' " />
72-
<!--
3+
<PropertyGroup>
4+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
5+
6+
<!-- Enable the restore command to run before builds -->
7+
<RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages>
8+
9+
<!-- Property that enables building a package from a project -->
10+
<BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>
11+
12+
<!-- Determines if package restore consent is required to restore packages -->
13+
<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">false</RequireRestoreConsent>
14+
15+
<!-- Download NuGet.exe if it does not already exist -->
16+
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">true</DownloadNuGetExe>
17+
</PropertyGroup>
18+
19+
<ItemGroup Condition=" '$(PackageSources)' == '' ">
20+
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
21+
<!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
22+
<PackageSource Include="https://nuget.org/api/v2/" />
23+
<PackageSource Include="https://nuget.episerver.com/feed/packages.svc/" />
24+
</ItemGroup>
25+
26+
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
27+
<!-- Windows specific commands -->
28+
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
29+
<PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
30+
</PropertyGroup>
31+
32+
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
33+
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
34+
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
35+
<PackagesConfig>packages.config</PackagesConfig>
36+
</PropertyGroup>
37+
38+
<PropertyGroup>
39+
<!-- NuGet command -->
40+
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
41+
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>
42+
43+
<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
44+
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>
45+
46+
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
47+
48+
<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
49+
<NonInteractiveSwitch Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' ">-NonInteractive</NonInteractiveSwitch>
50+
51+
<PaddedSolutionDir Condition=" '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
52+
<PaddedSolutionDir Condition=" '$(OS)' != 'Windows_NT' ">"$(SolutionDir)"</PaddedSolutionDir>
53+
54+
<!-- Commands -->
55+
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>
56+
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>
57+
58+
<!-- We need to ensure packages are restored prior to assembly resolve -->
59+
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
60+
RestorePackages;
61+
$(BuildDependsOn);
62+
</BuildDependsOn>
63+
64+
<!-- Make the build depend on restore packages -->
65+
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
66+
$(BuildDependsOn);
67+
BuildPackage;
68+
</BuildDependsOn>
69+
</PropertyGroup>
70+
71+
<Target Name="CheckPrerequisites">
72+
<!-- Raise an error if we're unable to locate nuget.exe -->
73+
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
74+
<!--
7375
Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
7476
This effectively acts as a lock that makes sure that the download operation will only happen once and all
7577
parallel builds will have to wait for it to complete.
7678
-->
77-
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT" />
78-
</Target>
79-
80-
<Target Name="_DownloadNuGet">
81-
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
82-
</Target>
83-
84-
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
85-
<Exec Command="$(RestoreCommand)"
86-
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
87-
88-
<Exec Command="$(RestoreCommand)"
89-
LogStandardErrorAsError="true"
90-
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
91-
</Target>
92-
93-
<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
94-
<Exec Command="$(BuildCommand)"
95-
Condition=" '$(OS)' != 'Windows_NT' " />
96-
97-
<Exec Command="$(BuildCommand)"
98-
LogStandardErrorAsError="true"
99-
Condition=" '$(OS)' == 'Windows_NT' " />
100-
</Target>
101-
102-
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
103-
<ParameterGroup>
104-
<OutputFilename ParameterType="System.String" Required="true" />
105-
</ParameterGroup>
106-
<Task>
107-
<Reference Include="System.Core" />
108-
<Using Namespace="System" />
109-
<Using Namespace="System.IO" />
110-
<Using Namespace="System.Net" />
111-
<Using Namespace="Microsoft.Build.Framework" />
112-
<Using Namespace="Microsoft.Build.Utilities" />
113-
<Code Type="Fragment" Language="cs">
114-
<![CDATA[
79+
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadNuGetExe=$(DownloadNuGetExe)" />
80+
</Target>
81+
82+
<Target Name="_DownloadNuGet">
83+
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
84+
</Target>
85+
86+
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
87+
<Exec Command="$(RestoreCommand)"
88+
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
89+
90+
<Exec Command="$(RestoreCommand)"
91+
LogStandardErrorAsError="true"
92+
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
93+
</Target>
94+
95+
<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
96+
<Exec Command="$(BuildCommand)"
97+
Condition=" '$(OS)' != 'Windows_NT' " />
98+
99+
<Exec Command="$(BuildCommand)"
100+
LogStandardErrorAsError="true"
101+
Condition=" '$(OS)' == 'Windows_NT' " />
102+
</Target>
103+
104+
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
105+
<ParameterGroup>
106+
<OutputFilename ParameterType="System.String" Required="true" />
107+
</ParameterGroup>
108+
<Task>
109+
<Reference Include="System.Core" />
110+
<Using Namespace="System" />
111+
<Using Namespace="System.IO" />
112+
<Using Namespace="System.Net" />
113+
<Using Namespace="Microsoft.Build.Framework" />
114+
<Using Namespace="Microsoft.Build.Utilities" />
115+
<Code Type="Fragment" Language="cs">
116+
<![CDATA[
115117
try {
116118
OutputFilename = Path.GetFullPath(OutputFilename);
117119
118120
Log.LogMessage("Downloading latest version of NuGet.exe...");
119121
WebClient webClient = new WebClient();
120-
webClient.DownloadFile("https://nuget.org/nuget.exe", OutputFilename);
122+
webClient.DownloadFile("https://www.nuget.org/nuget.exe", OutputFilename);
121123
122124
return true;
123125
}
@@ -126,26 +128,7 @@
126128
return false;
127129
}
128130
]]>
129-
</Code>
130-
</Task>
131-
</UsingTask>
132-
133-
<UsingTask TaskName="SetEnvironmentVariable" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
134-
<ParameterGroup>
135-
<EnvKey ParameterType="System.String" Required="true" />
136-
<EnvValue ParameterType="System.String" Required="true" />
137-
</ParameterGroup>
138-
<Task>
139-
<Using Namespace="System" />
140-
<Code Type="Fragment" Language="cs">
141-
<![CDATA[
142-
try {
143-
Environment.SetEnvironmentVariable(EnvKey, EnvValue, System.EnvironmentVariableTarget.Process);
144-
}
145-
catch {
146-
}
147-
]]>
148-
</Code>
149-
</Task>
150-
</UsingTask>
151-
</Project>
131+
</Code>
132+
</Task>
133+
</UsingTask>
134+
</Project>

DeveloperTools/Controllers/IOCController.cs

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using System.Web.Mvc;
66
using DeveloperTools.Models;
77
using EPiServer.Framework.Initialization;
8-
using StructureMap;
8+
using EPiServer.ServiceLocation.Internal;
99

1010
namespace DeveloperTools.Controllers
1111
{
@@ -15,42 +15,47 @@ public ActionResult Index()
1515
{
1616
var ie = (InitializationEngine) typeof(InitializationModule).GetField("_engine", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null);
1717

18-
var services = ie.GetType().GetProperty("Services", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(ie, null);
19-
var container = (IContainer) services.GetType().GetProperty("Container").GetValue(services, null);
18+
var services = ie.GetType().GetProperty("Services", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(ie, null) as StructureMapConfiguration;
2019

2120
var iocEntries = new List<IOCEntry>();
2221
var typeErrors = new List<string>();
2322

24-
foreach (var plugin in container.Model.PluginTypes)
23+
if (services != null)
2524
{
26-
try
27-
{
28-
var defaultType = plugin.Default?.ReturnedType;
29-
if(plugin.Default != null && defaultType == null)
30-
{
31-
defaultType = container.GetInstance(plugin.Default.PluginType, plugin.Default.Name).GetType();
32-
}
25+
var container = services.Container;
3326

34-
foreach (var entry in plugin.Instances.Where(i => i != null))
27+
foreach (var plugin in container.Model.PluginTypes)
28+
{
29+
try
3530
{
36-
var concreteType = entry.ReturnedType;
37-
if(concreteType == null && entry.PluginType.ContainsGenericParameters == false)
31+
var defaultType = plugin.Default?.ReturnedType;
32+
if (plugin.Default != null && defaultType == null)
3833
{
39-
concreteType = container.GetInstance(entry.PluginType, entry.Name).GetType();
34+
defaultType = container.GetInstance(plugin.Default.PluginType, plugin.Default.Name).GetType();
4035
}
4136

42-
iocEntries.Add(new IOCEntry
43-
{
44-
PluginType = entry.PluginType == null ? "null" : $"{entry.PluginType.FullName},{entry.PluginType.Assembly.FullName}",
45-
ConcreteType = concreteType == null ? "null" : $"{concreteType.FullName},{concreteType.Assembly.FullName}",
46-
Scope = plugin.Lifecycle.ToString(),
47-
IsDefault = defaultType == concreteType
48-
});
37+
foreach (var entry in plugin.Instances.Where(i => i != null))
38+
{
39+
var concreteType = entry.ReturnedType;
40+
if (concreteType == null && entry.PluginType.ContainsGenericParameters == false)
41+
{
42+
concreteType = container.GetInstance(entry.PluginType, entry.Name).GetType();
43+
}
44+
45+
iocEntries.Add(new IOCEntry
46+
{
47+
PluginType = entry.PluginType == null ? "null" : $"{entry.PluginType.FullName},{entry.PluginType.Assembly.FullName}",
48+
ConcreteType = concreteType == null ? "null" : $"{concreteType.FullName},{concreteType.Assembly.FullName}",
49+
50+
Scope = plugin.Lifecycle.ToString(),
51+
IsDefault = defaultType == concreteType
52+
});
53+
}
54+
}
55+
catch (Exception ex)
56+
{
57+
typeErrors.Add("Failed to get type " + plugin.PluginType.FullName + ", reason:" + ex.Message);
4958
}
50-
}
51-
catch (Exception ex)
52-
{
53-
typeErrors.Add("Failed to get type " + plugin.PluginType.FullName + ", reason:" + ex.Message);
5459
}
5560
}
5661

DeveloperTools/Controllers/RemoteEventController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ private RemoteEventsModel GetRemoteEventModel()
8181
TotalNumberOfSentEvent = sentEvents,
8282
ActiveServers = activeServers,
8383
ServerState = remoteServers,
84-
ProviderName = _providerService.DefaultProvider.Description ?? _providerService.DefaultProvider.Name,
84+
ProviderName = _providerService.DefaultProvider.Name,
8585
ProviderType = _providerService.DefaultProvider.GetType().FullName,
8686
Enabled = _providerService.Enabled
8787
};

0 commit comments

Comments
 (0)