0

I am using Visual Studio 2010, and this is my first time using an API. When I try to use the Last.FM API, I get the "type or namespace name 'Lastfm' could not be found..." for lines 10 and 48. I've looked at some other StackOverflow questions on similar topics, but none seemed to apply directly.

I downloaded the lastfm-sharp.dll from http://code.google.com/p/lastfm-sharp/downloads/list and placed it in the projects folder. I then added it as a reference and do not recall doing anything else. I then used the example in http://code.google.com/p/lastfm-sharp/wiki/Examples to write my code.

Here is my code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Lastfm.Services;

namespace MusicOrganize
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            DIRECTORY = this.FilePath.Text;
        }

        private void FilePath_TextChanged(object sender, EventArgs e)
        {
            DIRECTORY = this.FilePath.Text;
        }

        //Choose what Folder to work with
        private void BrowseBtn_Click(object sender, EventArgs e)
        {
            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
            {
                this.FilePath.Text = folderBrowserDialog1.SelectedPath;
            }
        }

        //Organize Music in selected Directory
        private void OrganizeBtn_Click(object sender, EventArgs e)
        {
            //Put all tracks into one folder
            Music.Consolidate(DIRECTORY);

            string API_KEY = "****";
            string API_SECRET = "****";
            Session session = new Session(API_KEY, API_SECRET);

            Music.GetTrackTags();
        }

        public string DIRECTORY;
    }
}

Thanks for any help you can provide.

2 Answers2

1

Get the C# documentation.

You either miss the USING statement on the top with all the others that contains the namespace for the class, OR you forgot to add the project or dll as a reference.

TomTom
  • 61,059
  • 10
  • 88
  • 148
0
And placed it in the projects folder? 

Where you keep your lastfm-sharp.dll.Its not sufficient to put it in a Project folder.Put your dll in bin folder .

4b0
  • 21,981
  • 30
  • 95
  • 142
  • AFIK it must be referenced too. – rekire Jan 03 '13 at 05:54
  • @rekire yap and its must be reference too.Thanks. – 4b0 Jan 03 '13 at 07:56
  • All right, I moved my .dll file to the "bin" folder. I have the same errors with this warning: 'The currently targeted framework ".NETFramework,Version=v4.0,Profile=Client" does not include "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which the referenced assembly "lastfm-sharp" depends on. This caused the referenced assembly to not resolve. To fix this, either (1) change the targeted framework for this project, or (2) remove the referenced assembly from the project.' – user1944695 Jan 07 '13 at 17:56
  • Link help you. http://blogs.msdn.com/b/jgoldb/archive/2009/10/19/what-s-new-in-net-framework-4-client-profile-beta-2.aspx – 4b0 Jan 08 '13 at 03:56