how to edit and older Addin project solution

how to edit and older Addin project solution

Ricardo.HolguinWCG54
Participant Participant
573 Views
4 Replies
Message 1 of 5

how to edit and older Addin project solution

Ricardo.HolguinWCG54
Participant
Participant

hello,

I created a Addin for Revit as a ribbon panel about a year ago, and recently have a newer computer, and tried to edit the Addin project solution frile in visual studio 2019, but I get several code errors now when I try to run it.

the errors I am getting are:
-Severity Code Description Project File Line Suppression State
Error CS1519 Invalid token '{' in class, record, struct, or interface member declaration NewRibbon02 C:\ACADSetup\DGFSDetails\NewRibbon02\Form1.cs 16 Active
-Severity Code Description Project File Line Suppression State
Error CS1022 Type or namespace definition, or end-of-file expected NewRibbon02 C:\ACADSetup\DGFSDetails\NewRibbon02\Form1.cs 108 Active

-Severity Code Description Project File Line Suppression State
Error CS0051 Inconsistent accessibility: parameter type 'Revit.UI.ExternalCommandData' is less accessible than method 'Form1.Form1(Revit.UI.ExternalCommandData)' NewRibbon02 C:\ACADSetup\DGFSDetails\NewRibbon02\Form1.cs 15 Active

-Severity Code Description Project File Line Suppression State
Error CS0116 A namespace cannot directly contain members such as fields or methods NewRibbon02 C:\ACADSetup\DGFSDetails\NewRibbon02\Form1.cs 18 Active

 

can any one tell me why I get these errors?

should I be loading the existing Addin Solution a certain way into Visual studio?

 

574 Views
4 Replies
Replies (4)
Message 2 of 5

jeremy_tammik
Alumni
Alumni

Nope, I cannot tell offhand what might be causing these errors.

  

It looks as if your namespace declaration is missing or flawed.

  

I am not aware of any differences between the versions of the Revit API that might be causing this. I am pretty sure there are none, so something else is causing this problem.

  

It would help if you could share the lines causing these errors.

  

You might also be able to help yourself by checking out what these error mean, e.g., for the last one:

  

https://duckduckgo.com/?q=Error+CS0116

  

You can simply search the Internet for the error numbers and all will be explained.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 3 of 5

Ricardo.HolguinWCG54
Participant
Participant

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace NewRibbon02
{
public partial class Form1 : Form
{
public Form1(Autodesk.Revit.UI.ExternalCommandData commandData) => InitializeComponent();
{
}
private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://bw1.sharepoint.com/sites/DGBIMandCAD/_layouts/15/Doc.aspx?OR=teams&action=edit&sourcedoc={9D...}");
}

private void panel1_Paint(object sender, PaintEventArgs e)
{

}

private void label1_Click(object sender, EventArgs e)
{

}

private void button2_Click(object sender, EventArgs e)
{
MessageBox.Show("Sorry we are working on this page","By Rick Holguin");
}

private void button3_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://bw1.sharepoint.com/sites/DGBIMandCAD/_layouts/15/Doc.aspx?OR=teams&action=edit&sourcedoc={78...}");
}

private void button4_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://bw1.sharepoint.com/sites/DGBIMandCAD/_layouts/15/Doc.aspx?OR=teams&action=edit&sourcedoc={F3...}");
}

private void button5_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://bw1.sharepoint.com/sites/DGBIMandCAD/_layouts/15/Doc.aspx?OR=teams&action=edit&sourcedoc={17...}");
}

private void button6_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://bw1.sharepoint.com/sites/DGBIMandCAD/Shared%20Documents/Architecture/10.%20DG%20Detail%20Lib...");
}

private void button7_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://bw1.sharepoint.com/sites/DGBIMandCAD/_layouts/15/Doc.aspx?OR=teams&action=edit&sourcedoc={70...}");
}

private void button8_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://bw1.sharepoint.com/sites/DGBIMandCAD/_layouts/15/Doc.aspx?OR=teams&action=edit&sourcedoc={CD...}");
}

private void button9_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://bw1.sharepoint.com/sites/DGBIMandCAD/_layouts/15/Doc.aspx?OR=teams&action=edit&sourcedoc={61...}");
}

private void button10_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://bw1.sharepoint.com/sites/DGBIMandCAD/_layouts/15/Doc.aspx?OR=teams&action=edit&sourcedoc={6E...}");
}

private void button22_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://bw1.sharepoint.com/sites/DGBIMandCAD/_layouts/15/Doc.aspx?OR=teams&action=edit&sourcedoc={66...}");
}

private void button23_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://bw1.sharepoint.com/sites/DGBIMandCAD/_layouts/15/Doc.aspx?OR=teams&action=edit&sourcedoc={B7...}");
}

private void button32_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://bw1.sharepoint.com/sites/DGBIMandCAD/_layouts/15/Doc.aspx?OR=teams&action=edit&sourcedoc={F1...}");
}

private void buttonTB_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://bw1.sharepoint.com/sites/DGBIMandCAD/Shared%20Documents/Architecture/10.%20DG%20Detail%20Lib...");
}

private void buttonMF_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://bw1.sharepoint.com/sites/DGBIMandCAD/Shared%20Documents/Architecture/10.%20DG%20Detail%20Lib...");
}
}
}

namespace Autodesk
{
class Revit
{
public class UI
{
public class ExternalCommandData
{
}
}
}
}

Message 4 of 5

RPTHOMAS108
Mentor
Mentor

Seems like your C# language version or similar project setting may have changed between projects and is now lacking features that were once used.

 

Reform i.e.:

 

namespace NewRibbon02
{
    public partial class Form1 : Form
    {
        public Form1(Autodesk.Revit.UI.ExternalCommandData commandData)
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
        //........

    }
}

 

 

Message 5 of 5

Ricardo.HolguinWCG54
Participant
Participant

I made some changes and I got it down to the 2 errors.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace NewRibbon02
{
public partial class Form1 : Form
{
public Form1(Autodesk.Revit.UI.ExternalCommandData commandData)
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://bw1.sharepoint.com/sites/DGBIMandCAD/_layouts/15/Doc.aspx?OR=teams&action=edit&sourcedoc={9D...}");
}

private void panel1_Paint(object sender, PaintEventArgs e)
{

}

private void label1_Click(object sender, EventArgs e)
{

}

private void button2_Click(object sender, EventArgs e)
{
MessageBox.Show("Sorry we are working on this page","By Rick Holguin");
}

private void button3_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://bw1.sharepoint.com/sites/DGBIMandCAD/_layouts/15/Doc.aspx?OR=teams&action=edit&sourcedoc={78...}");
}

private void button4_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://bw1.sharepoint.com/sites/DGBIMandCAD/_layouts/15/Doc.aspx?OR=teams&action=edit&sourcedoc={F3...}");
}

private void button5_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://bw1.sharepoint.com/sites/DGBIMandCAD/_layouts/15/Doc.aspx?OR=teams&action=edit&sourcedoc={17...}");
}

private void button6_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://bw1.sharepoint.com/sites/DGBIMandCAD/Shared%20Documents/Architecture/10.%20DG%20Detail%20Lib...");
}

private void button7_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://bw1.sharepoint.com/sites/DGBIMandCAD/_layouts/15/Doc.aspx?OR=teams&action=edit&sourcedoc={70...}");
}

private void button8_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://bw1.sharepoint.com/sites/DGBIMandCAD/_layouts/15/Doc.aspx?OR=teams&action=edit&sourcedoc={CD...}");
}

private void button9_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://bw1.sharepoint.com/sites/DGBIMandCAD/_layouts/15/Doc.aspx?OR=teams&action=edit&sourcedoc={61...}");
}

private void button10_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://bw1.sharepoint.com/sites/DGBIMandCAD/_layouts/15/Doc.aspx?OR=teams&action=edit&sourcedoc={6E...}");
}

private void button22_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://bw1.sharepoint.com/sites/DGBIMandCAD/_layouts/15/Doc.aspx?OR=teams&action=edit&sourcedoc={66...}");
}

private void button23_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://bw1.sharepoint.com/sites/DGBIMandCAD/_layouts/15/Doc.aspx?OR=teams&action=edit&sourcedoc={B7...}");
}

private void button32_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://bw1.sharepoint.com/sites/DGBIMandCAD/_layouts/15/Doc.aspx?OR=teams&action=edit&sourcedoc={F1...}");
}

private void buttonTB_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://bw1.sharepoint.com/sites/DGBIMandCAD/Shared%20Documents/Architecture/10.%20DG%20Detail%20Lib...");
}

private void buttonMF_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://bw1.sharepoint.com/sites/DGBIMandCAD/Shared%20Documents/Architecture/10.%20DG%20Detail%20Lib...");
}
}


namespace Autodesk
{
class Revit
{
public class UI
{
public class ExternalCommandData
{
}
}
}
}