I am trying to create a new addon but the addon is not being displayed in the addons menu in G1ANT Studio. Even other addons installed from the marketplace are also not displayed. I am using the latest version. I have tried running G1ANT studio as administrator. Yet it makes no difference.
Here is the Addon.cs file of my addon:
using System.Collections.Generic;
using System.Linq;
using System.Text;
using G1ANT.Language;
// Please remember to refresh G1ANT.Language.dll in references
namespace G1ANT.Addon.LibreOffice
{
[Addon(Name = "libreoffice", Tooltip = "Provides commands to automate LibreOffice")]
[Copyright(Author = "G1ANT LTD", Copyright = "G1ANT LTD", Email = "support#g1ant.com", Website = "www.g1ant.com")]
[License(Type = "LGPL", ResourceName = "License.txt")]
[CommandGroup(Name = "calc", Tooltip = "Commands connected with creating editing and generally working on calc")]
public class LibreOfficeAddon : Language.Addon
{
public override void Check()
{
base.Check();
// Check integrity of your Addon
// Throw exception if this Addon needs something that doesn't exists
}
public override void LoadDlls()
{
base.LoadDlls();
// All dlls embeded in resources will be loaded automatically,
// but you can load here some additional dlls:
// Assembly.Load("...")
}
public override void Initialize()
{
base.Initialize();
// Insert some code here to initialize Addon's objects
}
public override void Dispose()
{
base.Dispose();
// Insert some code here which will dispose all unnecessary objects when this Addon will be unloaded
}
}
}
The addon also references some other DLLs as dependencies.
There are no errors in your code. Have you ever compiled the HelloWorld example from this tutorial? https://github.com/G1ANT-Robot/G1ANT.Addon.Tutorials/tree/master/G1ANT.Addon.Command.HelloWorld
Remember
1. All dlls in the solution should be marked as "Resource" and will be embeded into your addon
2. The target .NET Framework of your project should be 4.6.1
I figured out what the issue was. The G1ANT.Language.dll was in the same directory as the addons, it seems to have been causing the issue.
Related
First thing I must say is that I'm not really sure about how to phrase this questions since I'm new to Xamarin.
I'm building an app in Xamaring with the aim of being Cross Platform.
These are the steps:
Create Solution
New Project, name: Demo.UI.TestHarness.iOS, type: iOS Unified Unit Test App
New Project, name: Demo.UnitTests, type: Cross-Platform Portable Library
Make Demo.UI.TestHarness.iOS the startup project
Add Nuget package NUnitLite to Demo.UnitTests
Add Reference to Demo.UnitTests in Demo.UI.TestHarness.iOS
This done, I created a class DummyTest in Demo.UnitTests:
using System;
using NUnit.Framework;
namespace Demo.UnitTests
{
[TestFixture]
public class DummyTest
{
[Test]
public void DUMMY ()
{
Assert.True (false);
}
}
}
And I added to the file UnitTestAppDelegate in Demo.UI.TestHarness.iOS a reference to this DummyTest:
using System;
using System.Linq;
using System.Collections.Generic;
using Foundation;
using UIKit;
using MonoTouch.NUnit.UI;
using Demo.UnitTests;
namespace Demo.UI.TestHarness.iOS
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
// application events from iOS.
[Register ("UnitTestAppDelegate")]
public partial class UnitTestAppDelegate : UIApplicationDelegate
{
// class-level declarations
UIWindow window;
TouchRunner runner;
//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
// create a new window instance based on the screen size
window = new UIWindow (UIScreen.MainScreen.Bounds);
runner = new TouchRunner (window);
// register every tests included in the main application/assembly
// runner.Add (System.Reflection.Assembly.GetExecutingAssembly ());
runner.Add(typeof(DummyTest).Assembly);
window.RootViewController = new UINavigationController (runner.GetViewController ());
// make the window visible
window.MakeKeyAndVisible ();
return true;
}
}
}
Now, I can build the project and run the debugger simulation, but no tests show up.
If instead I add the DummyTest directly inside my Demo.UI.TestHarness.iOS project and completely forget about the Demo.UnitTests project, it runs as intended (but this is not what I want because I want to make the tests all together to later use the same tests for Android and Mac and not having to redo them for every platform).
Incase anyone else is wondering why this does not work - here is what my research led me to:
https://forums.xamarin.com/discussion/16909/cant-test-pcl-test-assembly-from-xamarin-android-nunitlite-or-monotouch-nunit-ui
Specifically the post by "Seb Bartholomew". In his reply he posts a work around (which I have not tried yet). The basic issue is:
Xamarin.iOS uses MonoTouch.NUnitLite, Xamarin.Android uses Xamarin.Android.NUnitLite and the PCL used the base NUnit nuget package.
Although the assemblies have the same names and belong to the same namespaces they are intact different types so the Monotouch test runner does not detect the external [Test] attributes.
is there a way to subscribe to Test Explorer events in visual studio extension?
I didn't find anything like that in DTE2 interface. My goal is to trigger some function from extension when Test run completed (for the test that were ran from Test Explorer)
Thank you!
Thanks 280Z28 for your answer. Working code by using application object DTE:
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.TestWindow.Extensibility;
using Microsoft.VisualStudio.ComponentModelHost;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.TestTools.Execution;
public void OnConnection(object application, Extensibility.ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
Microsoft.VisualStudio.OLE.Interop.IServiceProvider InteropServiceProvider = application as Microsoft.VisualStudio.OLE.Interop.IServiceProvider;
_ServiceProvider = new ServiceProvider(InteropServiceProvider);
_ComponentModel = (IComponentModel)_ServiceProvider.GetService(typeof(SComponentModel));
_OperationState = _ComponentModel.GetService<IOperationState>();
_OperationState.StateChanged += _OperationState_StateChanged;
}
void _OperationState_StateChanged(object sender, OperationStateChangedEventArgs e)
{
}
It is also possible to access currently discovered test by ITestsService.
_TestsService = _ComponentModel.GetService<Microsoft.VisualStudio.TestWindow.Extensibility.ITestsService>();
var GetTestTask = _TestsService.GetTests();
GetTestTask.ContinueWith(Task =>
{
var DiscoveredTests = Task.Results.ToList();
});
The interfaces you need are available through MEF in the Microsoft.VisualStudio.TestWindow.Interfaces.dll assembly.
You need to expose your extension through MEF and [Import] an instance of IOperationState, or use the IComponentModel interface (returned for the SComponentModel service) to access the IOperationState. From there, you want to add an event handler to the IOperationState.StateChanged event, and look for the State property to include the TestOperationStates.TestExecutionFinished flag.
I'm terribly sorry for the lack of links, but I couldn't find any information about this in MSDN.
Edit: Two remarks about compatibility.
This is only available in Visual Studio 2012 and newer.
The necessary assembly (mentioned above) has a different strong name in the two versions of Visual Studio, and there is no bindingRedirect in Visual Studio 2013. What this means is you will be forced to deploy separate extensions for Visual Studio 2012 and Visual Studio 2013, or get "clever" about the way you dynamically load your extension code (the latter is way beyond the scope of this answer, but I've used it for some cases like Inheritance Margin extension that requires access to version-specific IntelliSense resources).
Sample VS 2017
A sample using MEF and the ITestContainerDiscoverer exported type. But be aware this may be gone in VS 2019!
[Export(typeof(ITestContainerDiscoverer))]
[Export(typeof(Testything))]
internal class Testything : ITestContainerDiscoverer
{
[ImportingConstructor]
internal Testything([Import(typeof(IOperationState))]IOperationState operationState)
{
operationState.StateChanged += OperationState_StateChanged;
}
public Uri ExecutorUri => new Uri("executor://PrestoCoverageExecutor/v1");
public IEnumerable<ITestContainer> TestContainers
{
get
{
return new ITestContainer[0].AsEnumerable();
}
}
public event EventHandler TestContainersUpdated;
private void OperationState_StateChanged(object sender, OperationStateChangedEventArgs e)
{
if (e.State == TestOperationStates.TestExecutionFinished)
{
var s = e.Operation;
}
}
}
Some more things could be found here
https://www.fuget.org/packages/Microsoft.VisualStudio.TestWindow.Interfaces/
I've added the Windows Azure Cache 1.8.0 nuget package to my solution, but it ends up crashing Visual studio when I load the project. I've found that I can "prevent" the crashing by removing the dlls from the bin folder, and then again when visual studio adds them back to the bin while the project loads.
The dlls I'm removing are:
Microsoft.ApplicationServer.Caching.AzureClientHelper.dll
Microsoft.ApplicationServer.Caching.AzureCommon.dll
Microsoft.ApplicationServer.Caching.Client.dll
Microsoft.ApplicationServer.Caching.Core.dll
When I look at the event viewer for the visual studio crash I get this:
Application: devenv.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ArgumentNullException
Stack:
at System.Threading.Monitor.Enter(System.Object)
at Microsoft.ApplicationServer.Caching.DataCacheFactory.Close()
at Microsoft.ApplicationServer.Caching.DataCacheFactory.Finalize()
I'm uncertain why VS is doing things with the dlls while the project is loading, but I admit I'm not an expert on that.
I've basically followed the process described on this page to add a dedicated cache worker role for caching:
http://www.windowsazure.com/en-us/develop/net/how-to-guides/cache/
I've tried removing and reinstalling the package, removing and reinstalling the Visual Studio SDK (Oct 2012), but the problem comes back.
Also, I don't have the App Fabric Server installed.
Thanks in advance for your help!
In case anyone else runs into this problem, I'm providing what seemed to work for me here.
In order to get visual studio to load the project, I removed the DLLs from the project. I also removed them as the project was loading and VS put the dlls back in the bin folder.
I removed the references to the dlls. Then I removed my code that was using the datacachefactory.
In the end I believe that it was caused by an improper use of the cache in my code that I had performed a build on. I was able to correct the usage of it, build the solution and get all the dlls back into the project.
Previously by datacache object had not be static.
here's my correct usage of the datacache factory:
using System;
using Microsoft.ApplicationServer.Caching;
namespace WebRole1.Classes
{
public class AzureCache
{
public static DataCache cache { get; set; }
public static DataCacheFactory dataCacheFactory { get; set; }
public AzureCache()
{
if (cache == null){
DataCacheFactoryConfiguration cfg = new DataCacheFactoryConfiguration();
cfg.AutoDiscoverProperty = new DataCacheAutoDiscoverProperty(true, "CacheWorkerRole1");
dataCacheFactory = new DataCacheFactory(cfg);
cache = dataCacheFactory.GetDefaultCache();
}
}
public void Add(string item, object value)
{
cache.Add(item, value);
}
public void Add(string item, object value, TimeSpan timeout)
{
cache.Put(item, value, timeout);
}
public object Get(string item)
{
return cache.Get(item);
}
public TimeSpan TimeRemaining (string item)
{
DataCacheItem DCitem = cache.GetCacheItem(item);
return DCitem.Timeout;
}
public void Flush()
{
cache.Clear();
DataCacheFactory cacheFactory = new DataCacheFactory();
cache = cacheFactory.GetDefaultCache();
}
}
}
We may need to capture a dump of the visual studio process(devenv.exe) to see what is causing this exception. You can use debugdiag("http://www.microsoft.com/en-us/download/details.aspx?id=26798") to capture the dump.
You may need to involve Microsoft support services("http://www.windowsazure.com/en-us/support/contact/") to further investigate this since the exception is coming from the cache code itself.
It's not an issue exclusively related to Visual Studio. I get it while running my webrole.
Check out this other article.
i'm using microsoft visual C# 2010 express to write a form program to read and write to an access database.
i created a class that is designed to read/write to the database file, saved it under a namespace and created a dll from it.
it is set as ".net Framework 4"
in my main program i added the reference to the dll file but when i try to add it to the code with
using Database;
it won't work even that the Database is in the reference of the namespace.
am i doing something wrong? or is there another way to use the commands from Database in my main program other then copying it to it?
// update //
solved
added public to all database public and DataBase db = new DataBase();
DATABASE.cs is use it for dll
using System;
using System.Collections.Generic;
using System.Data.OleDb;
namespace Database
{
public class DataBase
{
public DataBase()
{
}
public void ItemInsert(string name,string creator,string publishing,string itemType,string genere, string year)
the main program
using System;
using System.Windows.Forms;
using Database;
namespace library
{
public partial class newItemForm : Form
{
private void btnConfirmNewItemClick(object sender, EventArgs e)
{
DataBase db = new DataBase(); //this solved it
db.ItemInsert(txtItemNameType.Text, txtEditorType.Text, txtCreatorType.Text, comboBoxType.Text, txtGenereType.Text, txtYearType.Text);
}
}
}
You also need to Add a Reference to said assembly in your current project. The using statement brings a referenced assembly into scope...
right click you project in visual studio, select add refrence then choose Browse tab, then find the poject folder and get in bin -> debug and then you will see the dll choose it. visual studio will add it to your refrences, now you need to add a using on top of the pages you want it like this:
using mydllName;
if you didnt find your dll:
Load the librery project agian and right click in visual studio and press Build it will generate the dll.
You must add a reference to the assembly you created. The point of creating an Assembly is not that you don't have to "copy it" to another project, but rather that you don't have to duplicate code.
I'm developing in Visual Studio 2010 and I've just downloaded and installed Script# 0.6.2 for VS 2010. I'm trying to follow the clock example in the Read Me pdf but can't get it to compile.
I've created a new Script# Class Library project inside my solution called Clock, renamed the .cs file to ClockBehaviour and added the following code as per the example:
using System;
using System.DHTML;
using ScriptFX;
using ScriptFX.UI;
namespace Clock {
public class ClockBehavior : Behavior {
private int _intervalCookie;
public ClockBehavior(DOMElement domElement, string id) : base(domElement, id) {
_intervalCookie = Window.SetInterval(OnTimer, 1000);
}
public override void Dispose() {
if (_intervalCookie != 0) {
Window.ClearInterval(_intervalCookie);
} base.Dispose();
} private void OnTimer() { DateTime dateTime = new DateTime(); DOMElement.InnerHTML = dateTime.Format("T"); }
}
}
When I try and compile the project I get errors saying that the System.DHMTL, ScriptFX and ScriptFX.UI namespaces could not be found (and some others, but I guess by fixing these errors the others will fall out).
It feels like I'm not referencing the correct projects/dlls. In the References for the project I have mscorlib and Script.Web. I've tried using the object browser find the classes (such as Behavior) in other namespaces but with no luck. I've added all of the .dlls from the ScriptSharp folder in Program Files but the namespaces still can't be found.
Any help would be very much appreciated,
Thanks,
Hugh
the sample docs are a bit out of date - look at the phot sample in the samples download : http://projects.nikhilk.net/Content/Projects/ScriptSharp/Sample.zip
See http://projects.nikhilk.net/ScriptSharp/Conceptual-What
You need to reference ssfx.Core.dll which should be installed with Script#
(Alternatively, see pp 23-24 of the pdf you linked...)