Skip to content

Commit a9952f1

Browse files
committed
#14936 Adding new license fixed, PostSharp upgraded to 5.0.26-rc.
1 parent c7900b2 commit a9952f1

File tree

6 files changed

+44
-41
lines changed

6 files changed

+44
-41
lines changed

src/PostSharp.LicenseServer/Admin/AddLicense.aspx.cs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#endregion
1010

1111
using System;
12+
using System.Linq;
1213
using System.Web.UI;
1314
using PostSharp.Sdk;
1415
using PostSharp.Sdk.Extensibility.Licensing;
@@ -29,17 +30,6 @@ protected void AddButton_OnClick( object sender, EventArgs e )
2930
return;
3031
}
3132

32-
if ( parsedLicense.MinPostSharpVersion > ApplicationInfo.Version )
33-
{
34-
this.errorLabel.Text = string.Format(
35-
"License key cannot be added because it requires higher version of PostSharp. Please upgrade PostSharp NuGet packages of the License Server to >= {0}.{1}.{2}.",
36-
parsedLicense.MinPostSharpVersion.Major,
37-
parsedLicense.MinPostSharpVersion.Minor,
38-
parsedLicense.MinPostSharpVersion.Build );
39-
this.errorLabel.Visible = true;
40-
return;
41-
}
42-
4333
if ( !parsedLicense.IsLicenseServerEligible() )
4434
{
4535
this.errorLabel.Text = string.Format( "Cannot add a {0} of {1} to the server.",
@@ -56,8 +46,16 @@ protected void AddButton_OnClick( object sender, EventArgs e )
5646
CreatedOn = VirtualDateTime.UtcNow,
5747
ProductCode = parsedLicense.Product.ToString(),
5848
};
49+
5950
Database db = new Database();
60-
db.Licenses.InsertOnSubmit( license );
51+
if (db.Licenses.Any(l => l.LicenseId == license.LicenseId))
52+
{
53+
this.errorLabel.Text = "The given license has been added already.";
54+
this.errorLabel.Visible = true;
55+
return;
56+
}
57+
58+
db.Licenses.InsertOnSubmit(license);
6159
db.SubmitChanges();
6260

6361
this.Response.Redirect( ".." );

src/PostSharp.LicenseServer/PostSharp.LicenseServer.csproj

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\..\packages\PostSharp.5.0.23-preview\build\PostSharp.props" Condition="Exists('..\..\packages\PostSharp.5.0.23-preview\build\PostSharp.props')" />
3+
<Import Project="..\..\packages\PostSharp.5.0.26-rc\build\PostSharp.props" Condition="Exists('..\..\packages\PostSharp.5.0.26-rc\build\PostSharp.props')" />
44
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
55
<PropertyGroup>
66
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -27,6 +27,8 @@
2727
<IISExpressUseClassicPipelineMode />
2828
<TargetFrameworkProfile />
2929
<MSBuildCommunityTasksPath>$(MSBuildThisFileDirectory)..\..\packages\MSBuildTasks.1.4.0.88\tools</MSBuildCommunityTasksPath>
30+
<NuGetPackageImportStamp>
31+
</NuGetPackageImportStamp>
3032
</PropertyGroup>
3133
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
3234
<DebugSymbols>true</DebugSymbols>
@@ -71,16 +73,16 @@
7173
<SkipPostSharp>True</SkipPostSharp>
7274
</PropertyGroup>
7375
<ItemGroup>
74-
<Reference Include="PostSharp, Version=5.0.23.0, Culture=neutral, PublicKeyToken=b13fd38b8f9c99d7, processorArchitecture=MSIL">
75-
<HintPath>..\..\packages\PostSharp.Redist.5.0.23-preview\lib\net45\PostSharp.dll</HintPath>
76+
<Reference Include="PostSharp, Version=5.0.26.0, Culture=neutral, PublicKeyToken=b13fd38b8f9c99d7, processorArchitecture=MSIL">
77+
<HintPath>..\..\packages\PostSharp.Redist.5.0.26-rc\lib\net45\PostSharp.dll</HintPath>
7678
<Private>True</Private>
7779
</Reference>
78-
<Reference Include="PostSharp.Compiler.Common, Version=5.0.23.0, Culture=neutral, PublicKeyToken=b13fd38b8f9c99d7, processorArchitecture=MSIL">
79-
<HintPath>..\..\packages\PostSharp.Compiler.Common.5.0.23-preview\lib\net40\PostSharp.Compiler.Common.dll</HintPath>
80+
<Reference Include="PostSharp.Compiler.Common, Version=5.0.26.0, Culture=neutral, PublicKeyToken=b13fd38b8f9c99d7, processorArchitecture=MSIL">
81+
<HintPath>..\..\packages\PostSharp.Compiler.Common.5.0.26-rc\lib\net45\PostSharp.Compiler.Common.dll</HintPath>
8082
<Private>True</Private>
8183
</Reference>
82-
<Reference Include="PostSharp.Compiler.Settings, Version=5.0.23.0, Culture=neutral, PublicKeyToken=b13fd38b8f9c99d7, processorArchitecture=MSIL">
83-
<HintPath>..\..\packages\PostSharp.Compiler.Settings.5.0.23-preview\lib\net40\PostSharp.Compiler.Settings.dll</HintPath>
84+
<Reference Include="PostSharp.Compiler.Settings, Version=5.0.26.0, Culture=neutral, PublicKeyToken=b13fd38b8f9c99d7, processorArchitecture=MSIL">
85+
<HintPath>..\..\packages\PostSharp.Compiler.Settings.5.0.26-rc\lib\net45\PostSharp.Compiler.Settings.dll</HintPath>
8486
<Private>True</Private>
8587
</Reference>
8688
<Reference Include="System" />
@@ -276,10 +278,10 @@
276278
</Target>
277279
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
278280
<PropertyGroup>
279-
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
281+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
280282
</PropertyGroup>
281-
<Error Condition="!Exists('..\..\packages\PostSharp.5.0.23-preview\build\PostSharp.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\PostSharp.5.0.23-preview\build\PostSharp.props'))" />
282-
<Error Condition="!Exists('..\..\packages\PostSharp.5.0.23-preview\build\PostSharp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\PostSharp.5.0.23-preview\build\PostSharp.targets'))" />
283+
<Error Condition="!Exists('..\..\packages\PostSharp.5.0.26-rc\build\PostSharp.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\PostSharp.5.0.26-rc\build\PostSharp.props'))" />
284+
<Error Condition="!Exists('..\..\packages\PostSharp.5.0.26-rc\build\PostSharp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\PostSharp.5.0.26-rc\build\PostSharp.targets'))" />
283285
</Target>
284286
<Import Project="..\..\packages\PostSharp.5.0.23-preview\build\PostSharp.targets" Condition="Exists('..\..\packages\PostSharp.5.0.23-preview\build\PostSharp.targets')" />
285287
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

src/PostSharp.LicenseServer/PostSharp.LicenseServer.csproj.user

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<IISExpressAnonymousAuthentication />
77
<IISExpressWindowsAuthentication />
88
<IISExpressUseClassicPipelineMode />
9+
<UseGlobalApplicationHostFile />
910
</PropertyGroup>
1011
<ProjectExtensions>
1112
<VisualStudio>
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="MSBuildTasks" version="1.4.0.88" targetFramework="net45" />
4-
<package id="PostSharp" version="5.0.23-preview" targetFramework="net45" />
5-
<package id="PostSharp.Compiler.Common" version="5.0.23-preview" targetFramework="net45" />
6-
<package id="PostSharp.Compiler.Settings" version="5.0.23-preview" targetFramework="net45" />
7-
<package id="PostSharp.Redist" version="5.0.23-preview" targetFramework="net45" />
4+
<package id="PostSharp" version="5.0.26-rc" targetFramework="net45" developmentDependency="true" />
5+
<package id="PostSharp.Compiler.Common" version="5.0.26-rc" targetFramework="net45" />
6+
<package id="PostSharp.Compiler.Settings" version="5.0.26-rc" targetFramework="net45" />
7+
<package id="PostSharp.Redist" version="5.0.26-rc" targetFramework="net45" />
88
</packages>

test/PostSharp.LicenseServer.Test/PostSharp.LicenseServer.Test.csproj

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\..\packages\PostSharp.5.0.23-preview\build\PostSharp.props" Condition="Exists('..\..\packages\PostSharp.5.0.23-preview\build\PostSharp.props')" />
3+
<Import Project="..\..\packages\PostSharp.5.0.26-rc\build\PostSharp.props" Condition="Exists('..\..\packages\PostSharp.5.0.26-rc\build\PostSharp.props')" />
44
<PropertyGroup>
55
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
66
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
@@ -15,6 +15,8 @@
1515
<TargetFrameworkProfile>
1616
</TargetFrameworkProfile>
1717
<FileAlignment>512</FileAlignment>
18+
<NuGetPackageImportStamp>
19+
</NuGetPackageImportStamp>
1820
</PropertyGroup>
1921
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
2022
<PlatformTarget>x86</PlatformTarget>
@@ -51,16 +53,16 @@
5153
<SkipPostSharp>True</SkipPostSharp>
5254
</PropertyGroup>
5355
<ItemGroup>
54-
<Reference Include="PostSharp, Version=5.0.23.0, Culture=neutral, PublicKeyToken=b13fd38b8f9c99d7, processorArchitecture=MSIL">
55-
<HintPath>..\..\packages\PostSharp.Redist.5.0.23-preview\lib\net45\PostSharp.dll</HintPath>
56+
<Reference Include="PostSharp, Version=5.0.26.0, Culture=neutral, PublicKeyToken=b13fd38b8f9c99d7, processorArchitecture=MSIL">
57+
<HintPath>..\..\packages\PostSharp.Redist.5.0.26-rc\lib\net45\PostSharp.dll</HintPath>
5658
<Private>True</Private>
5759
</Reference>
58-
<Reference Include="PostSharp.Compiler.Common, Version=5.0.23.0, Culture=neutral, PublicKeyToken=b13fd38b8f9c99d7, processorArchitecture=MSIL">
59-
<HintPath>..\..\packages\PostSharp.Compiler.Common.5.0.23-preview\lib\net40\PostSharp.Compiler.Common.dll</HintPath>
60+
<Reference Include="PostSharp.Compiler.Common, Version=5.0.26.0, Culture=neutral, PublicKeyToken=b13fd38b8f9c99d7, processorArchitecture=MSIL">
61+
<HintPath>..\..\packages\PostSharp.Compiler.Common.5.0.26-rc\lib\net45\PostSharp.Compiler.Common.dll</HintPath>
6062
<Private>True</Private>
6163
</Reference>
62-
<Reference Include="PostSharp.Compiler.Settings, Version=5.0.23.0, Culture=neutral, PublicKeyToken=b13fd38b8f9c99d7, processorArchitecture=MSIL">
63-
<HintPath>..\..\packages\PostSharp.Compiler.Settings.5.0.23-preview\lib\net40\PostSharp.Compiler.Settings.dll</HintPath>
64+
<Reference Include="PostSharp.Compiler.Settings, Version=5.0.26.0, Culture=neutral, PublicKeyToken=b13fd38b8f9c99d7, processorArchitecture=MSIL">
65+
<HintPath>..\..\packages\PostSharp.Compiler.Settings.5.0.26-rc\lib\net45\PostSharp.Compiler.Settings.dll</HintPath>
6466
<Private>True</Private>
6567
</Reference>
6668
<Reference Include="System" />
@@ -92,12 +94,12 @@
9294
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
9395
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
9496
<PropertyGroup>
95-
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
97+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
9698
</PropertyGroup>
97-
<Error Condition="!Exists('..\..\packages\PostSharp.5.0.23-preview\build\PostSharp.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\PostSharp.5.0.23-preview\build\PostSharp.props'))" />
98-
<Error Condition="!Exists('..\..\packages\PostSharp.5.0.23-preview\build\PostSharp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\PostSharp.5.0.23-preview\build\PostSharp.targets'))" />
99+
<Error Condition="!Exists('..\..\packages\PostSharp.5.0.26-rc\build\PostSharp.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\PostSharp.5.0.26-rc\build\PostSharp.props'))" />
100+
<Error Condition="!Exists('..\..\packages\PostSharp.5.0.26-rc\build\PostSharp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\PostSharp.5.0.26-rc\build\PostSharp.targets'))" />
99101
</Target>
100-
<Import Project="..\..\packages\PostSharp.5.0.23-preview\build\PostSharp.targets" Condition="Exists('..\..\packages\PostSharp.5.0.23-preview\build\PostSharp.targets')" />
102+
<Import Project="..\..\packages\PostSharp.5.0.26-rc\build\PostSharp.targets" Condition="Exists('..\..\packages\PostSharp.5.0.26-rc\build\PostSharp.targets')" />
101103
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
102104
Other similar extension points exist, see Microsoft.Common.targets.
103105
<Target Name="BeforeBuild">
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="PostSharp" version="5.0.23-preview" targetFramework="net45" />
4-
<package id="PostSharp.Compiler.Common" version="5.0.23-preview" targetFramework="net45" />
5-
<package id="PostSharp.Compiler.Settings" version="5.0.23-preview" targetFramework="net45" />
6-
<package id="PostSharp.Redist" version="5.0.23-preview" targetFramework="net45" />
3+
<package id="PostSharp" version="5.0.26-rc" targetFramework="net45" developmentDependency="true" />
4+
<package id="PostSharp.Compiler.Common" version="5.0.26-rc" targetFramework="net45" />
5+
<package id="PostSharp.Compiler.Settings" version="5.0.26-rc" targetFramework="net45" />
6+
<package id="PostSharp.Redist" version="5.0.26-rc" targetFramework="net45" />
77
</packages>

0 commit comments

Comments
 (0)