Licensing configuration in "msbuild"

Esben Bach's Avatar

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 1 Posted by PostSharp Techn... on 20 Aug, 2018 10:08 AM

    PostSharp Technologies's Avatar

    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:
    1) Install the license on your computer using Visual Studio PostSharp > Options > License.
    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.)

    Does this solve your issue?

    Best regards,
    -tony

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

    Esben Bach's Avatar

    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. 3 Posted by Esben Bach on 20 Aug, 2018 10:26 AM

    Esben Bach's Avatar

    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 4 Posted by PostSharp Techn... on 20 Aug, 2018 01:26 PM

    PostSharp Technologies's Avatar

    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. 5 Posted by Esben Bach on 20 Aug, 2018 01:30 PM

    Esben Bach's Avatar

    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 6 Posted by PostSharp Techn... on 11 Sep, 2018 03:26 PM

    PostSharp Technologies's Avatar

    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
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac