Vote count:
0
I have been trying to use a few classes I created for a console app a while ago in a asp.net web application I am creating. The first thing I tried was to just copy over the classes from the console app project and then import the nuget packages so the classes would compile. However, the SAME NuGet packages that allow those classes to function perfectly for the console app are not working when I download them for the web app. Basically, whenever I declare an instance of a class that should have been imported with the NuGet packages, I get the error:
The type 'Microsoft.Search.Autopilot.IConfiguration' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.Search.Autopilot, Version=10.8.13.52429, Culture=neutral, PublicKeyToken=471e7408fd06c98f'.
As an example, lets say I have a class called SampleClass which declares instances of classes from certain NuGet packages. The following will compile fine:
using blablapackage.blabla
namespace WebSite1
{
public class SampleClass
{
public void random(ForeignClassFromPackage x)
{
//do some stuff
}
}
However, the following will throw the error I mentioned earlier:
using blablapackage.blabla
namespace WebSite1
{
public class SampleClass
{
ForeignClassFromPackage y = new ForeignClassFromPackage(); //this is the origin of the error
public void random(ForeignClassFromPackage x)
{
//do some stuff
}
}
Doing this exact same thing in the console app that I made earlier works completely fine. I don't understand why it is throwing this error for the webapp.
Aucun commentaire:
Enregistrer un commentaire