PostSharp reports broken references when using Paket

If you use Paket instead of NuGet (why? therefore!) you will experience the following difficulties:

imageGiven is the following Solution/Project. It contains a paket.references file containin just one line “PostSharp”, which is

The PostSharp Assembly is added when you your “paket.references” file in the project directory containing just one line “PostSharp”. If you execute “paket install” in your command promt, paket adds PostSharp as reference to the project and modifies the csproj accordingly.

The next time you run a build, PostSharp comes up with this dialog:

postsharp

Since the VisualStudio PostSharp plugin detects a reference to PostSharp.dll, it expects a packages.config which it can’t find. If you don’t agree, the solution builds successfully but the code won’t be modified by PostSharp.

imageIf you agree, PostSharps adds a packages.config and replaces the existing PostSharp reference with the newest stable one (which probably is not the version you have specified in Paket!).

I posted this on Twitter. The Paket maintainers can’t handle this and PostSharp won’t change this behaviour.

image

image

image

So by now, I don’t see any solution except that Paket users can ask PostSharp to change this behaviour.

//Edit: Have a look at the comments. The unsolved problem is that you have to execute the „install.ps1“. Paket doesn’t do that but NuGet will also remove this feature in a future release.

Mit Tag(s) versehen: ,

7 thoughts on “PostSharp reports broken references when using Paket

  1. Gael Fraiteur (@gfraiteur) 30. Januar 2015 um 14:15 Reply

    You can disable the automatic reference fixing of PostSharp by going to menu PostSharp / Options / Advanced and check the option „Disable NuGet dependency verification before build“.

    Gefällt mir

    • Uli Armbruster 30. Januar 2015 um 15:24 Reply

      Nope, I tried that before my post. Not working since PostSharp is not activated in the project. Paket downloads the NuGet package and adds the DLL to the project. csproj is attached below. So thats the reason why PostSharp works with projects that have had initially configured by NuGet. New projects only get the references but not the configuration to use PostSharp while compiling.
      What do I have to write in the csproj to activate that?

      //Edit: cannot post the csproj. You can find it here http://uliarmbruster.de/ConsoleApplication1.csproj

      Gefällt mir

  2. Gael Fraiteur (@gfraiteur) 30. Januar 2015 um 15:46 Reply

    This project won’t compile because tools\PostSharp.targets is not imported. It’s currently added by install.ps1. If you add this Import it should work.

    Gefällt mir

  3. Gael Fraiteur (@gfraiteur) 30. Januar 2015 um 15:48 Reply

    Basically you can see what we do by looking at install.ps1. Nothing we are very proud of but it’s how NuGet is designed…

    Gefällt mir

    • Uli Armbruster 30. Januar 2015 um 17:50 Reply

      Ah, thanks. This feature is gonna removed from NuGet. Till then I can execute this manually.

      Gefällt mir

  4. […] I reported some difficulties that I‘ve experienced with the PostSharp NuGet package when I was using the new package manager […]

    Gefällt mir

  5. Paket vs. NuGet | Uli Armbruster 21. Juli 2015 um 10:47 Reply

    […] ggf. nicht richtig nach der Installation mit Paket. Das ist z.B. bei PostSharp der Fall, was ich hier beschrieben habe. Der geneigte Leser möge bitte bei PostSharp für das offene Issue dazu […]

    Gefällt mir

Schreibe einen Kommentar

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

WordPress.com-Logo

Du kommentierst mit Deinem WordPress.com-Konto. Abmelden / Ändern )

Twitter-Bild

Du kommentierst mit Deinem Twitter-Konto. Abmelden / Ändern )

Facebook-Foto

Du kommentierst mit Deinem Facebook-Konto. Abmelden / Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden / Ändern )

Verbinde mit %s

%d Bloggern gefällt das: