to PostSharp

# Licensing configuration in "msbuild"

#### Esben Bach

20 Aug, 2018 09:12 AM

Hi
I have a service fabric project with a few difference services (executables).

I have in all of those services a dependency on a shared project (csproj) in which I use PostSharp Diagnostics. In the shared library I have added the msbuild property <PostSharpLicense>BLAHMYKEYHERE</PostSharpLicense>

Regardless of this, my visual studio occasionally comes up and complains about the need to configure the license key for postsharp diagnostics when i debug.

Is this because i need to add the license property to my .exe's or is it because i need to add the license property to the .sfproj (startup project that basically is just a deployment project).
The sfproj does not use postsharp in any way, as it just packages the exe's in a SF compatible way.

1. Support Staff Posted by PostSharp Techn... on 20 Aug, 2018 10:08 AM

Hi,

I understand that you only have one project, a class library, which uses PostSharp Diagnostics. No other project uses PostSharp. Some of your projects just reference this class library project. Do I understand your setup correctly?

In this case, you only need a PostSharp license for building the class library project. There's no need for a license in run-time.

Deploying of license keys is described here: http://doc.postsharp.net/deploying-keys

You have two options:
2) Install the license to your source code by adding a postsharp.config file as described in the doc. If you add this config file at solution level, it will be used by any project which uses PostSharp located in the same directory as the config file. (PostSharp recursively searches for postsharp.config files from the location of the .csproj project file being build towards the file system root.)

Best regards,
-tony

2. Posted by Esben Bach on 20 Aug, 2018 10:13 AM

You understand correctly.

Im not using either of your options, im using the third option as described here: http://doc.postsharp.net/configuration-msbuild

Basically im doing it like this to be able to include the file using a git submodule (something I can't do with postsharp.config afaik).

3. Posted by Esben Bach on 20 Aug, 2018 10:26 AM

It might be worth mentioning im using the "new" csproj format for .net core (but is is a full framework project). And im using postsharp 6.0.25.

Since it only occasionally shows im not sure its not a tooling/plugin issue, because as far as I can tell it gives me the right output runtime - the license is NOT installed on the build server, and there are no compiler warnings that I can see.

4. Support Staff Posted by PostSharp Techn... on 20 Aug, 2018 01:26 PM

I've tried your way of including the PostSharp license and I wasn't able to reproduce your behavior - the licensing dialogue didn't show up.

You can try to build your project using command msbuild /t:Rebuild /p:PostSharpTrace=Licensing. This will show trace of PostSharp licensing, so you can see what is exactly happening.

You can include a license using postsharp.confic and submobudule as well by adding

<Using File="path\to\postsharp.config\in\a\git\submodule\postsarp.config" />

to postsharp.config.

It would be great if you could share with us a build log including the licensing trace from a build which is showing the licensing dialog, so we could investigate why it's happening.

As you've seen, the dialog box does not appear every time. There is a delay between each showing of this dialog, driven by a time of last show stored in
HKEY_CURRENT_USER\Software\SharpCrafters\PostSharp 3\LastPrepareToolTime registry. If you delete this key, the dialog would pop up next time PostSharp thinks it's missing a license during build.

I'm sorry for this bothering.

Best regards,
-tony

5. Posted by Esben Bach on 20 Aug, 2018 01:30 PM

Thanks for the update, I will look into it a bit more and let you know my findings (it might be a little while though)

6. Support Staff Posted by PostSharp Techn... on 11 Sep, 2018 03:26 PM

Hello,

We are going to close this request for now. Please feel free to reopen the discussion after you've looked into it, we'll be happy to help.

Thanks,
PostSharp Team

7. PostSharp Technologies closed this discussion on 11 Sep, 2018 03:26 PM.

Comments are currently closed for this discussion. You can start a new one.

# Keyboard shortcuts

### Generic

? Show this help Blurs the current field

### Comment Form

r Focus the comment reply box Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

## Recent Discussions

 21 Sep, 2018 10:49 AM .net 4.7.1 Error 21 Sep, 2018 09:18 AM After Adding Postsharp Diagnostics Logging to ASP.NET WebForms App it does not produce ANY output 20 Sep, 2018 04:08 PM WPF + PostSharp’ed View Model get frozen in a minute 19 Sep, 2018 08:14 PM [NotifyPropertyChanged] aspect ignores [Parent] property 19 Sep, 2018 08:08 PM Tracking property changes
 17 Sep, 2018 02:30 PM POSTSHARP error: Unhandled exception (postsharp-x86.exe 6.0.25 release | .NET Framework 4.7.1): Unknown framework name: 'Silverlight,Version=v4.0'. See below for details. 17 Sep, 2018 02:28 PM Performance loss LocationInterceptionAspect when upgrading from 4.1.30 to 5.0.54 17 Sep, 2018 02:24 PM Unhandled exception (PostSharp.Compiler.Hosting.CommandLine.dll 6.0.24 release | .NET Core 2.1.2): System.NullReferenceException: Object reference not set to an instance of an object. 14 Sep, 2018 03:45 PM Compile Error: log4net:ERROR Failed to initialize configuration file watcher for file 11 Sep, 2018 03:52 PM error PS0219: The targeting pack for platform ".NETFramework,Version=v2.0" is not installed after update from 4.3.15 to 6.0.25 11 Sep, 2018 03:49 PM Default Enabled LogRecordKind