Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Revit 2013 & Visual Studio 2013 Express vs Community Edition

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Anonymous
534 Views, 1 Reply

Revit 2013 & Visual Studio 2013 Express vs Community Edition

I had created a very small DLL in C# using Visual Studio Express 2013, Update 3, and if I run Revit 2013 with code that that had built, it worked fine. 

 

I have since upgraded to Visual Studio 2013 Community Edition, Update 4 to get the benefit of debugging as suggested by the Building Coder blog. Debugging certainly works - but my code now does not. It now throws an exception when trying to use TaskDialog saying it should be in the main thread (it worked before), it will no longer load custom families (it did before), and although it still creates ribbon content they are now disabled (they were enabled before). The DLL *has* been fully recompiled with the new Studio. 

 

Taking LoadFamily() as an example, this is my code: 

 

private void loadFamilies(Document doc) 
{
	string filespec = Directory.GetParent(Assembly.GetExecutingAssembly().Location) 
						+ @"\TFRectangular.rfa" 
						; 
 
	Family family = null ; 
 	try 
	{
		if (!doc.LoadFamily(filespec, out family) ) 
			throw new Exception("Unable to load " + filespec);

	}
	catch (Exception e) 
	{
		TaskDialog.Show("MyCompany", "Family load failed: " + e.Message, TaskDialogCommonButtons.Ok); 
		return ; 

	}

}

void onNewDocument(Document doc) 
{
	Transaction t = new Transaction(doc, "Performing Document Loading Procedure" );
	t.Start(); 

	loadFamilies(doc); 

	t.Commit(); 

}

void onDocumentCreated(object sender, Autodesk.Revit.DB.Events.DocumentCreatedEventArgs e)
{
	onNewDocument(e.Document); 

}

The family still loads into Revit manually. I don't get an exception from LoadFamily(); it simply returns false and I don't know how to get error information back (assuming that is even possible, since it suggests that it uses the exception mechanism to indicate errors). 

 

Any suggestions as to why updating Visual Studio should break everything? It's the same version of Revit and the references in the project are therefore still correct as they came from Revit's directory. 

 

(The family might have been already loaded in one case, but I specifically tried a new [Architectural template] drawing and I can confirm that the family was *not* loaded when it had finished.) 

 

1 REPLY 1
Message 2 of 2
Anonymous
in reply to: Anonymous

OK, I happened to see a related article and read it, and lo and behold, it had the answer. 

 

You have to force Visual Studio to use the 'legacy debugger'. See the thread here: 

http://forums.autodesk.com/t5/revit-api/debugging-revit-2014-api-with-visual-studio-2013/m-p/4574097...

 

That fixes the problems I listed. 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community