Can not compile - Also getting error when submitting issue through this system

avistokar's Avatar

avistokar

05 Dec, 2017 04:38 PM

Error:

Severity Code Description Project File Line Suppression State
Error PostSharp targets have been imported twice in the project. Be sure to set the 'DontImportPostSharp' property to 'True' when you import PostSharp manually, so that it does not get imported automatically. OfficeAnywhere.Office C:\Users\avistokar\Documents\Projects\OfficeAnywhere\OfficeAnywhere\Postsharp\Tools\PostSharp.targets 146

  1. 1 Posted by avistokar on 05 Dec, 2017 04:39 PM

    avistokar's Avatar

    Adding build output

  2. 2 Posted by avistokar on 05 Dec, 2017 04:41 PM

    avistokar's Avatar
  3. 3 Posted by avistokar on 06 Dec, 2017 12:26 PM

    avistokar's Avatar

    I was unable to submit this issue when attaching the two file initially but the system did not reply with a meaningful error - simply that there was a problem. When I submitted the files separately I determined that it was the security that blocked the csproj which needed to be zipped.

    Please help me with this problem as I have had to remove Postsharp and now have no logging in my application

  4. 4 Posted by avistokar on 06 Dec, 2017 03:18 PM

    avistokar's Avatar

    The system prompted me to install 5.0.36 compiled images but I am using 5.0.40 and searched through the entire solution for all references to postsharp of 5.0.36 and can not find them. I have tried uninstalling and reinstalling postsharp. This is completely blocking me and I need to make progress in getting to be able to compile with Postsharp. Please help.

  5. Support Staff 5 Posted by PostSharp Techn... on 06 Dec, 2017 03:52 PM

    PostSharp Technologies's Avatar

    Issue diagnosed on the phone. It seems the project imported PostSharp.targets twice: once as a NuGet package through PackageReference (CPS project), the second time explicitly through Zip distribution.

    Suggested to use only NuGet and remove all manual references.

    -gael

  6. 6 Posted by avistokar on 06 Dec, 2017 04:20 PM

    avistokar's Avatar

    I am now able to compile and Logging in started in the program entry point; however, I am not getting logging as I expect throughout my code. Each project continues to have a button offering adding Postsharp to the project on the properties tab. If I press the button it adds postsharp using nuget but there are no Postsharp options on the postsharp tab in the project properties, just the Add Postsharp to this project" button

  7. Support Staff 7 Posted by PostSharp Techn... on 06 Dec, 2017 05:54 PM

    PostSharp Technologies's Avatar

    Hello,

    Please make sure that you have PostSharp NuGet packages installed in all projects where logging is required (right click on solution and select "Manage NuGet packages for Solution"). If the NuGet package is installed correctly, then you should see an Import line with PostSharp.targets in the *.csproj file. Once the NuGet packages are installed in each project you should be able to rebuild the solution and get the logging to work. If the logging still doesn't work then we will need to investigate this further. In that case having a reproduction project with broken logging would be very helpful.

    Regarding the Postsharp Options page - which version of Visual Studio are you using and which version of PostSharp Tools is installed (Tools -> Extensions and Updates -> Installed)?

    -alex

  8. 8 Posted by avistokar on 07 Dec, 2017 12:16 AM

    avistokar's Avatar

    I have the logging working.

    I am using 5.0.40 with VS 15.4.5

  9. Support Staff 9 Posted by PostSharp Techn... on 11 Dec, 2017 04:59 PM

    PostSharp Technologies's Avatar

    Hello,

    are you still experiencing problems with PostSharp Options page? Which kinds of projects are/were affected (CPS/legacy)?

    Thanks!

    Best,
    Daniel

  10. 10 Posted by avistokar on 11 Dec, 2017 08:37 PM

    avistokar's Avatar

    I found that this problem is on my main development machine, however using tha same code on my laptop I see the postsharp options on the projects

  11. Support Staff 11 Posted by PostSharp Techn... on 12 Dec, 2017 02:49 PM

    PostSharp Technologies's Avatar

    Hello,

    thanks for the information. I'm closing this ticket for now.

    Best regards,
    Daniel

  12. PostSharp Technologies closed this discussion on 12 Dec, 2017 02:49 PM.

  13. avistokar re-opened this discussion on 12 Dec, 2017 04:50 PM

  14. 12 Posted by avistokar on 12 Dec, 2017 04:50 PM

    avistokar's Avatar

    Can help debug the issue occurring my main dev machine?

    ________________________________

  15. Support Staff 13 Posted by PostSharp Techn... on 12 Dec, 2017 05:07 PM

    PostSharp Technologies's Avatar

    Hello,

    you can try deleting Visual Studio MEF cache in %localappdata%\Microsoft\VisualStudio\1X.0\ComponentModelCache, which would force VS to reinitialize it. It seems like the installation of the extension is somewhat damaged. Also, you should try deleting .vs folders.

    Best regards,
    Daniel

  16. 14 Posted by avistokar on 12 Dec, 2017 07:21 PM

    avistokar's Avatar

    It did not help, I also tried uninstalling and installing the 5.0.41 postsharp tool for VS 2017. I still do not see Postsharp options in the properties tab of the projects

  17. Support Staff 15 Posted by PostSharp Techn... on 13 Dec, 2017 02:45 PM

    PostSharp Technologies's Avatar

    Hello,

    which version of PostSharp Tools is installed on the machine where you are seeing properties properly? Can you please send us the current csproj file of the failing project?

    Also, which version of Visual Studio is installed on both machines?

    Thanks a lot.

    Best regards,
    Daniel

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

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