I have created my own nuget package:
https://www.nuget.org/packages/Chia-Client-API/
In the code of the package, I documented all functions with xaml comments:
/// <summary>
/// returns all subwallets of the currently logged in wallet
/// </summary>
/// <param name="includeData">Set to true to include all coin info for this wallet</param>
/// <returns></returns>
public static GetWallets_Response GetWallets_Sync(bool includeData = true)
{
Task<GetWallets_Response> data = Task.Run(() => GetWallets_Async(includeData));
data.Wait();
return data.Result;
}
in my other solution, I added the package through nuget package manager. The code works as expected but intellisense will not display the xaml comment information:
Is there something which is missing or which I have to enable in order to show the markup?
I have tried publishing a .snupkg according to official documentation but it did not change:
https://learn.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg
it seemed to work by adjusting the build settings of the project:
Related
I am trying to set up an auto-versioning update on TortoiseSVN for a project I'm working on. It's very straightforward; the code is supposed to pull the SVN revision and display the date & location whenever anyone does a checkout/update from the repo.
Below I have a template class
public static class SvnRevision
{
/// <summary>
/// SVN repo revision
/// </summary>
public const string REVISION = "$WCREV$";
/// <summary>
/// SVN repo location
/// </summary>
public const string REPOSITORY_URL = #"$WCURL$";
/// <summary>
/// SVN repo date
/// </summary>
public const string REPOSITORY_DATE = "$WCDATE$";
}
I want to know the background steps necessary to get this program to work. Appreciate if anyone could provide a walk through or tutorial. I am trying to do this on Visual Studio 2022.
I made commits using this class to SVN without any luck, a search indicates that I need to set up versioning and provide some kind of source/destination files that I don't know how to do. Below is a link I've referenced.
https://docs.huihoo.com/tortoisesvn/1.5.7-en/tsvn-subwcrev-keywords.html
Before selecting The Right Thing (tm) for your task and|or using SubWCRev (which you try to use, according to used subwcrev-specific keywords) you have to know some things
Best (and, really, single correct place) for reading updated, relevant to latest release docs about SubWCRev is TortoiseSVN website (SubWCRev is part of TortoiseSVN distribution and is not of pure SVN per se)
"...whenever anyone does a checkout/update from the repo" such person with WC of your repo have more natural way to know, which revision he|she got and whence: ordinary svn info tells it, instead of reading your code or compiling it in order to see message-box with collected data
Contrary to SVN-keywords, which work from a box (when inserted into files) and updated automagically on the fly, subwcrev's keywords have to have "release" stage (read docs): you insert keywords in template-file, which, after processing by SubWCRev, will produce new file, in which template-placeholders are replaced by data, actual only for this moment and not updated automatically after WC-changes (you must to refresh files from templates again)
In your case you can
move public static class SvnRevision into somename.cs.tpl with all needed keywords
Before all other steps in your compile-chain add call of SubWCRev, smth.like SubWCRev.exe path\to\WC somename.cs.tpl somename.cs
In you code use references to somename.cs, which also have to be in svn-ignore and not versioned, while template have to be versioned
HTH
Thanks for all the help everyone. Likely my line of questioning was not clear or I worked it wrong, but the problem was that I needed to set a command line as a prebuild event so that the SVN keywords would update.
Prebuild event command line: "C:\Program Files\TortoiseSVN\bin\SubWCRev.exe" "$(ProjectDir)." "$(ProjectDir)SvnRevision_Template.cs" "$(ProjectDir)SvnRevision.cs"
I am currently using Visual Studio 2019 to write a WPF/C# application.
After writing a new method I decided to add some examples for better usage.
But my example won't show up in the Intellisense popup.
I've tried the following code:
/// <summary>...</summary>
/// <param name="path">...</param>
/// <param name="action">...</param>
/// <example>
/// Use this method like this:
/// <code>
/// MyMethod("C:\\someFile.txt", s => File.Copy(s, "C:\\someFile (copy).txt"));
/// </code>
/// </example>
public static void MyMethod(string path, Action<string> action)
{
// some code ...
}
I expected my example to show up on the Intellisense popup that pops up when calling from another file.
What happens is just the summary shows up without my examples..
It is simple - because it works so. And never worked as you expected.
Your XML comments is fine but Visual Studio shows only <summary> section (Short discription of class \ method or property) for quick familiarize with class \ method or property you are going to use.
XML comments can be very big, litterally nothing limits it size. Imagine what size shoud be tooltip to show you big comments?
So if you or other developer use Visual Studio and tooltip with <summary> does not give you enough information - just simply go to decloration with F12 and read full comment OR you can show declaration right in current section with ALT + F12
Not shure but i think it can be some extensions for showing tooltip as you want
Background: We have a custom tool which takes the xml input and generates the cs output. A custom tool needs to register with the Visual studio in order to make it work with that version of visual studio.
What we have done: We have done the custom tool registration with the Visual Studio 2015 which is working fine. But now the problem is with Visual Studio 2017.
Problem: So far in my research, I found until Visual Studio 2015, VS had the direct registry entries which were allowing to register the tool but from VS 2017, Microsoft has made changes in the way how registry entries are stored (a good read to understand changes in VS2017).
If I open up the VS 2017 and try to run the custom tool then I get the error
Cannot find custom tool "Tool Name" on this system.
This is obvious because custom tool is not yet registered with VS 2017 to work.
I tried to follow this guy which says to load .bin file in to the registries but he also says that it disables to launch the VS 2017. In order to launch VS, we have to unload hive. Research says, .bin file can be on different location based on type of VS installed (enterprise, pro etc.).
Has anyone done this before?
TIA
You may have to follow different approach here by creating a Visual Studio extension (VSIX), below I have explained it in detail, hope it helps.
How to create a Custom Tool or Single File Generator in Visual Studio 2017:
Prior to VS2017 creating a custom tool required implementing Interface IVsSingleFileGenerator and code to register and unregister the custom tool in the system registry, but in VS2017, Microsoft has changed entire registry structure. The change is, VS will make registry entries to a private registry so that system registry is not messed up. While previously the registry entries were made in the system registry, now they are made to
C:\Users\xyz\AppData\Local\Microsoft\VisualStudio\15.0_xx\privateregistry.bin
Visual studio 2017 also supports testing your tool directly by running it from the visual studio itself (F5), which starts another instance of Visual Studio called Visual Studio Experimental Instance and your tool can be tested in it since it makes registry entries to
C:\Users\xyz\AppData\Local\Microsoft\VisualStudio\15.0_xxExp\privateregistry.bin
Follow below steps to create a Custom Tool in VS2017:
We need to create a VSIX extension
Add new Visual Studio Package
Implement IVsSingleFileGenerator
Add the registry entry code
Compile and test the tool by running it in VS2017
Install the tool by double clicking the generated .VSIX file
We will create an extension/custom tool as an example named "CountLines" which will read a file (having Custom Tool property set to CountLines) and generate an XML file containing the number of lines in the file. e.g. <LineCount>1050</LineCount>
1. Create a VSIX extension
In order to create an extension you must have installed Visual Studio Extensibility Tools which is included as an optional feature in Visual Studio setup. If it is not installed you can also install it by modifying VS 2017 setup.
Create new VSIX (Visual Studio Extension) project by selecting
New Project -> Extensibility -> VSIX Project
give it some name like "CountLinesVSIX".
2. Add new Visual Studio Package
Once VSIX project is created, add new Visual Studio Package to it by selecting
Add -> New Item -> Extensibility -> Visual Studio Package
give it name "CountLines.cs". In CountLines.cs we need to delete existing code and replace it with our code for IVsSingleFileGenerator implementation
3. Implement IVsSingleFileGenerator
Write your custom implementation for interface IVsSingleFileGenerator, our example code is as below
using System;
using System.Runtime.InteropServices;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using System.Text;
namespace CountLinesVSIX
{
[PackageRegistration(UseManagedResourcesOnly = true)]
[InstalledProductRegistration( "CountLines", "Generate XML with line count", "1.0")]
[Guid("202E7E8B-557E-46CB-8A1D-3024AD68F44A")]
[ComVisible(true)]
[ProvideObject(typeof(CountLines))]
[CodeGeneratorRegistration(typeof(CountLines), "CountLines", "{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}", GeneratesDesignTimeSource = true)]
public sealed class CountLines : IVsSingleFileGenerator
{
#region IVsSingleFileGenerator Members
public int DefaultExtension(out string pbstrDefaultExtension)
{
pbstrDefaultExtension = ".xml";
return pbstrDefaultExtension.Length;
}
public int Generate(string wszInputFilePath, string bstrInputFileContents,
string wszDefaultNamespace, IntPtr[] rgbOutputFileContents,
out uint pcbOutput, IVsGeneratorProgress pGenerateProgress)
{
try
{
int lineCount = bstrInputFileContents.Split('\n').Length;
byte[] bytes = Encoding.UTF8.GetBytes("<LineCount>" + lineCount.ToString() + "</LineCount>" );
int length = bytes.Length;
rgbOutputFileContents[0] = Marshal.AllocCoTaskMem(length);
Marshal.Copy(bytes, 0, rgbOutputFileContents[0], length);
pcbOutput = (uint)length;
}
catch (Exception ex)
{
pcbOutput = 0;
}
return VSConstants.S_OK;
}
#endregion
}
}
We need to provide an unique GUID for our extension such as one in above code [Guid("202E7E8B-557E-46CB-8A1D-3024AD68F44A")]. GUID can be created from VS2017 by selecting "Tools -> Create GUID". Select GUID format as Registry format. Note that GUID mentioned above code is without curly braces.
[ComVisible(true)] is required for COM Interops
[CodeGeneratorRegistration(typeof(CountLines), "CountLines", "{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}", GeneratesDesignTimeSource = true)] is a class attribute with code to register the tool. Params being GeneratorType, GeneratorName, and C# language GUID
You can also derive from "TemplatedCodeGenerator" which supports custom TextTemplate formatting, which may require some additional code implementation.
4. Add the registry entry code
Create new class file with below code, name it CodeGeneratorRegistrationAttribute.cs
using System;
using System.Globalization;
using Microsoft.VisualStudio.Shell;
namespace CountLinesVSIX
{
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public sealed class CodeGeneratorRegistrationAttribute : RegistrationAttribute
{
private string _contextGuid;
private Type _generatorType;
private Guid _generatorGuid;
private string _generatorName;
private string _generatorRegKeyName;
private bool _generatesDesignTimeSource = false;
private bool _generatesSharedDesignTimeSource = false;
public CodeGeneratorRegistrationAttribute(Type generatorType, string generatorName, string contextGuid)
{
if (generatorType == null)
throw new ArgumentNullException("generatorType");
if (generatorName == null)
throw new ArgumentNullException("generatorName");
if (contextGuid == null)
throw new ArgumentNullException("contextGuid");
_contextGuid = contextGuid;
_generatorType = generatorType;
_generatorName = generatorName;
_generatorRegKeyName = generatorType.Name;
_generatorGuid = generatorType.GUID;
}
/// <summary>
/// Get the generator Type
/// </summary>
public Type GeneratorType
{
get { return _generatorType; }
}
/// <summary>
/// Get the Guid representing the project type
/// </summary>
public string ContextGuid
{
get { return _contextGuid; }
}
/// <summary>
/// Get the Guid representing the generator type
/// </summary>
public Guid GeneratorGuid
{
get { return _generatorGuid; }
}
/// <summary>
/// Get or Set the GeneratesDesignTimeSource value
/// </summary>
public bool GeneratesDesignTimeSource
{
get { return _generatesDesignTimeSource; }
set { _generatesDesignTimeSource = value; }
}
/// <summary>
/// Get or Set the GeneratesSharedDesignTimeSource value
/// </summary>
public bool GeneratesSharedDesignTimeSource
{
get { return _generatesSharedDesignTimeSource; }
set { _generatesSharedDesignTimeSource = value; }
}
/// <summary>
/// Gets the Generator name
/// </summary>
public string GeneratorName
{
get { return _generatorName; }
}
/// <summary>
/// Gets the Generator reg key name under
/// </summary>
public string GeneratorRegKeyName
{
get { return _generatorRegKeyName; }
set { _generatorRegKeyName = value; }
}
/// <summary>
/// Property that gets the generator base key name
/// </summary>
private string GeneratorRegKey
{
get { return string.Format(CultureInfo.InvariantCulture, #"Generators\{0}\{1}", ContextGuid, GeneratorRegKeyName); }
}
/// <summary>
/// Called to register this attribute with the given context. The context
/// contains the location where the registration inforomation should be placed.
/// It also contains other information such as the type being registered and path information.
/// </summary>
public override void Register(RegistrationContext context)
{
using (Key childKey = context.CreateKey(GeneratorRegKey))
{
childKey.SetValue(string.Empty, GeneratorName);
childKey.SetValue("CLSID", GeneratorGuid.ToString("B"));
if (GeneratesDesignTimeSource)
childKey.SetValue("GeneratesDesignTimeSource", 1);
if (GeneratesSharedDesignTimeSource)
childKey.SetValue("GeneratesSharedDesignTimeSource", 1);
}
}
/// <summary>
/// Unregister this file extension.
/// </summary>
/// <param name="context"></param>
public override void Unregister(RegistrationContext context)
{
context.RemoveKey(GeneratorRegKey);
}
}
}
Above code will make sure your entries are made to VS private registry
5. Compile and test the tool by running it in VS2017
You may add "Install targets" in "source.extension.vsixmanifest" to ensure different VS2017 editions are supported by your extesion.
Run your tool in VS 2017 to test if it is working as expected. Once you Run the VSIX, the Visual Studio Experimental Instance will install the extension and register it in registry "C:\Users\xyz\AppData\Local\Microsoft\VisualStudio\15.0_xxExp\privateregistry.bin". You can see the installed extension by selecting "Tools -> Extensions and updates". To test the tool we will have to open a dummy project, select a file in solution explorer, go to its properties and update Custom Tool property to "CountLines". Once this is done VS will run the tool in background and generate the output, in our example it will generate a xml file under the selected file. Alternatively, once Custom Tool property is set, your can right click the file and select "Run Custom Tool"
6. Install the tool by double clicking the generated .VSIX file
Once tested successfully, try installing the VSIX which can be found at location "projectName/bin/debug". Install the VSIX by double clicking the file, follow the installation steps. Now your tool will be available for use in VS2017. Using tool is similar, right click the file on which you want to run the custom tool and select "Run Custom Tool"
In case you want to uninstall the extention, go to "Tools -> Extensions and updates -> select your extension" and click uninstall. Note that tool will not get uninstalled until VS is closed. Once closeed you will get a popup window to uninstall, select "Modify" to uninstall.
Well, during research, I got the answer of this problem.
Solution:
We have to load the the .bin file (via load hiv).
Make the changes or edit the bin to register your tool.
Unload hive.
Step#1: Load Hive.
a) Open registry (regedit). Select node HKEY_LOCAL_MACHINE.
b) Go to | File -> Load Hive
c) Select the bin file which is available at -> %LocalAppData%\ Microsoft\ VisualStudio\ 15.0_'instance_id'\privateregistry.bin.
d) Provide a key name. This will create a new key entry in HKEY_LOCAL_MACHINE with your key name.
e) You can check the .bin file at HKEY_LOCAL_MACHINE\YourKeyName\Software\Microsoft\VisualStudio\
Step#2: Edit the bin: You can now register your custom tool by following the same way as you were doing for other VS versions. Actually the only problem was to get the VS2017 keys in to the global registry and that is solved using Step#1 above.
Step#3: Unload Hive.
a) select your key under HKEY_LOCAL_MACHINE.
b) Go to | File menu
c) Unload Hive.
I've created a SpecFlow Plugin following their page below. And have created a Generator Plugin as I needed to modify the auto generated code behind my features.
https://github.com/techtalk/SpecFlow/wiki/Plugins.
SpecFlowPlugin Code
[assembly: GeneratorPlugin(typeof(SpecFlowSpiraAdapterPlugin))]
namespace SpiraTest.SpecFlowPlugin
{
/// <summary>
/// A adapterpPlugin is needed to use a custom MSTest generator with SpecFlow.
/// </summary>
public class SpecFlowSpiraAdapterPlugin : IGeneratorPlugin
{
/// <summary>
/// By implementing the Initialize- Method on the IGeneratorPlugin interface, you get access to the GeneratorPluginEvents and GeneratorPluginParameters
/// </summary>
/// <param name="generatorPluginEvents"></param>
/// <param name="generatorPluginParameters"></param>
public void Initialize(GeneratorPluginEvents generatorPluginEvents, GeneratorPluginParameters generatorPluginParameters)
{
generatorPluginEvents.CustomizeDependencies += GeneratorPluginEvents_CustomizeDependencies;
}
private void GeneratorPluginEvents_CustomizeDependencies(object sender, CustomizeDependenciesEventArgs e)
{
e.ObjectContainer.RegisterTypeAs<MSTestCustomGenerator, IUnitTestGeneratorProvider>();
}
}
}
Problem
I'm getting an error message when trying to run my tests indicating that i don't have the below attribute.
[assembly:RuntimePlugin] attribute
However I don't need that attribute as I have the [assembly: GeneratorPlugin] attribute instead.
No idea why it's saying that. Any ideas?
Message: Class Initialization method
MiJobsAdminPortal.UITests.Login.LoginFeature.FeatureSetup threw
exception. TechTalk.SpecFlow.SpecFlowException:
TechTalk.SpecFlow.SpecFlowException: Missing [assembly:RuntimePlugin]
attribute in SpiraTest.SpecFlowPlugin, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null. Please check
http://go.specflow.org/doc-plugins for details..
For SpecFlow every plugin is a Generator and a Runtime plugin, except you configure it otherwise. This is the code for that: https://github.com/techtalk/SpecFlow/blob/master/TechTalk.SpecFlow/Infrastructure/ContainerBuilder.cs#L127
As an example for configuration, have a look at the configuration of the SpecFlow+Excel plugin, which is also only a generator plugin.
<specFlow>
<plugins>
<add name="SpecFlow.Plus.Excel" type="Generator" />
</plugins>
</specFlow>
You have to specify the type as Generator. If not SpecFlow is always searching for both plugin types.
This behaviour is not documented, but is there since years. I will update the documentation in the next days.
Full disclosure: I am one of the maintainers of SpecFlow & SpecFlow+
I'm using the current version of Sandcastle from Codeplex that is integrated with VS.NET 2012 to build a .cmh help file. The help file is being created, but I can't seem to ever get any of my <code> blocks to emit in the help file. I have the following easy example I keep working with:
/// <summary>
/// This is the summary
/// </summary>
/// <code>var s;</code>
public string SomeValue { get; set; }
When I look at the output .chm file, the var s; code is not present anywhere. I have done the following:
Added reference to Code Block Component in the Sandcastle project properties.
Tried making tag <code lang="C#">var s;</code> and <code language="C#">var s;</code> but neither made a difference.
Read documentation on the following sites detailing this process but to no avail:
https://www.simple-talk.com/dotnet/.net-tools/taming-sandcastle-a-.net-programmers-guide-to-documenting-your-code/
http://www.ewoodruff.us/shfbdocs/
The example is obviously a simplified version, but I'm just trying to get the basics work here. What am I doing incorrectly or missing?
I don't think the code tag is allowed to be by itself, try putting it inside an <example> tag, like <example><code>var s;</code></example>. So this should work:
/// <summary>
/// This is the summary
/// </summary>
/// <example>
/// <code>var s;</code>
/// </example>
public string SomeValue { get; set; }