...

Packages restored, but your project is still missing references?

Here is a classic error that happens to me a lot. It's extremely simple, yet sometimes I find myself spending too much time trying to remember what it is that goes wrong.

Symptoms: You have retrieved a GitHub project you created as part of another solution onto a new machine. You don't get any errors when restoring nuget packages, but still you are missing a lot of assemblies when you try to compile.

I have a bad habit. I build a lot of addons for systems such as Episerver (that's not a bad habit in itself), but when I do, I typically start out with a regular Episerver site on my local machine. Then I add some code to it that solves a given problem. So far so good. At some point I decide "Hey, this would make a great add-on, I should split it out in a class library and share the code or build a nuget". And so I do.

But often I'll stay in the same solution as my initial experimentation site - after all, it's handy to have a site to test out the library in right away. But I don't feel like including the experimentation site in the Github repo, so I often just move the class library there on it's own.

Now, the problem arises if the solution is located in a much different location than the project and you include nuget packages. What happens is that your "packages" folder (where nuget packages are downloaded to) is a subfolder to the solution directory, even though the packages.config is in the project.

And when you add references to nuget packages it will download them to the packages folder and add a relative link in the project file. Like this: 

<ItemGroup>
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\..\..\..\Projects\MyProject\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll</HintPath>
</Reference>

Notice how the HintPath is very relative? That's a problem on other machines that doesn't have that path, hence the assemblies cannot be loaded from the packages folder and are missing.

The solution is obviously not to make such a mess of things as I do. But if you have, manually edit the .csproj file and ensure the HintPaths points to the correct packages folder - and that you have a local solution for your project.

Blog Posts

...

Free online course - C# and .NET Core introduction

The best way to learn coding - and in particular c# and .NET Core - is to code. CodeArt is proud to make all the teaching materials to a newly created course online and freely available for self-study.

...

Packages restored, but your project is still missing references?

Here is a classic error that happens to me a lot. It's extremely simple, yet sometimes I find myself spending too much time trying to remember what it is that goes wrong.

...

Idio: First look on Content Analytics and Recommendations

I recently got a chance to try out Episervers latest acquisition, Idio, right here on codeart.dk. In this post, I'll share my first impressions.

...

Attribute to set XHTML property settings in Episerver

A pretty normal task is to have an XHTML property that uses only a very specific subset of the normal TinyMCE functionality. For example a text field that also allows the editors to create links - but nothing else. I came up with what I think is an elegant solution here.

...

Powerslice: Identify unused blocks

Powerslice might have a few years on it's back, but it's still a great editorial tool, when you are working with large amounts of content and have access to Episerver Find. Here's an example of a recent slice I made that let's editors easily identify unused blocks.

...

Introducing the Profile Manager tool

Episerver Insight and the Profile store are powerful tools. But to make them even more powerful, we @ CodeArt have been developing a few tools to make them easier to work with. Here is the first one.

...

Episerver Forms: Adding custom validators to existing elements

It's easy to extend Episerver forms with custom validation types. But it's a little bit harder to add the new validation types to the existing elements. In this blog post I'll add an ultra simple letter-only validation option to the existing TextboxElement.

...

Episerver Forms: Adding Datasource for hidden field with Profile Store data

Some times, it can be handy to track additional data about the visitor along with a form submission. If you have Profile Store, stuff like DeviceId, sessionId and maybe even the ProfileId can definitely come in handy later when you are later processing the form submissions. Here is a code sample on how to do that.

...

Ascend 2019: Code Mania

Yesterday, I had the honor and pleasure of giving the traditional Code Mania demo at Episerver Ascend 2019 in Miami together with Fredrik Haglund. After popular demand, here is a blog post about some of the components we showed.

...

Getting more Insight (pun intended) into Episerver Profile Store

Profile Store, Insight, Tracker, Advance - Episerver offers a myriad of different (but connected) REST services for managing and tracking your visitors and prospects. It can be slightly confusing at first - and some of the documentation might be a tad misleading - but once you get the hang of it, they are really powerful tools. I've recently had a chance to explore them in depth. Here is what I've learned so far.

...

Episerver Forms and Pardot Form Handlers

Episerver comes with a wide range of connectors that allows you to connect Marketing Automation systems to Episerver through multiple integration points. However in some cases you might want to hook directly into the Marketing Automation systems form handler. In the case of SalesForce Pardot it's very easy to do!

...

The tricky redirect

Sometimes, when you are troubleshooting you forget the obvious in search of more complex reasons. Recently I had a case of that where an Episerver site kept redirecting the moment it was launched.

Post Comments()