Quantcast
Channel: Visual Studio Integrate forum
Viewing all 4410 articles
Browse latest View live

from project to project

$
0
0

hi

I have a "Microsoft.VisualStudio.ProjectSystem.ConfiguredProject" and I want to read the "ProjectGuid" of this project.

How can I do this? I tried to get a "Microsoft.VisualStudio.VCProjectEngine.VCProject" or "Microsoft.Build.Evaluation.Project" to read data from it. But... how's this done? I've no idea how to do that.

Or is there an other way to do that? An easier one?

... you know, everyone tells me how easy it is to use .net ... but, you still have to know a lot... what I never understand is which type can be casted into which others? Or is this just something you find out by luck? Try to cast and if it works, fine... if not.. hey, let's try something else? Like in the good old days with the QueryInterface? ... sort of "well, it's a dog... why not asking this object if it provides the interfaces of a ship?" ... is it that stupid? Or is there more behind it?

How do you for example solve the problem I have now? What's the steps you use to get behind this secret?

And, by the way... using the "GetType()" on some objects is also highly confusing... e.g. the ConfiguredProject.Services.HostObject.GetType() returns a "VCConfigurationShim" ... what the hell is this class? Nobody has ever documented it and I don't find an assembly for that. How? What? Why? ... and ... last question: is this really "easier" than in the old days with C interfaces and COM ?? I don't understand this world.

Rudolf



T4 template was not generated. Controller and view file shows the “Errorgeneratingoutput” in VS2017 & VS 2019 combination machine

$
0
0

When create a project by choosing custom control like (grid control) to  asp.net mvc project. After creation of project, shows the "ErrorGeneratingOutput"in both controller and view file.

We got a error like "There was a problem getting an appdomain to run the transformation from the host. The process cannot continue", while converting generating the t4 template file.  
 It shows only in Vs2017 and Vs2019 combination machine. Its working fine in vs2017 machine.


    

how to build that?

$
0
0

hi

I need to install something into Visual Studio. It is what I would call an "SDK". Which is a compiler (an exe) installed to somewhere (c:\program files\...) and some project templates and project items. All for C++ (at least at the moment).

We have a setup that does all this (msi file). But our extension doesn't show up as an "SDK" in the extension manager (only under "templates").

Our question now is, if we can do something to get our extension into this group or if an SDK is something special in Visual Studio and if it is, could we convert our thing into an SDK?

The only examples I can find describing an SDK is for .net or wrt and there we have something like an "sdkmanifest.xml" with a "file reference" ... and, I don't have winmd files. But... I've no idea how this is done today. Can you write an SDK and (also in C++ native projects) somehow import/link stuff via those files and the "references" item that I can see in the project tree?

... is there somewhere some useful documentation for native project extension? Not always about the .net / winrt or other stuff?

Rudolf

How to expose property of ocx built by C++(MFC) to be accessed from VB6

$
0
0

I have a ocx code which was built by C++(MFC)

I added a property to it.

I want to access that property from VB6 but can't.

I copied just ocx file.(there are lots of files are in the \Release folder including *.exp, *.lib, *.obj, *.tlb..

Which files should I copy additionally to the VB6 application folder?

Or what do I do to make it work?

.NET core 3.0 after installation does it require reboot

$
0
0
.NET core 3.0 after installation does it require  to reboot box. 

How to enumerate Collapsed Regions in the VS2015 code editor window?

$
0
0

HI,

I need to enumerate Collapsed Regions in the code window of VS 2015. I have a solution that worked for VS 2013 that uses interfaces in the following:

  using Microsoft.VisualStudio.Editor;
  using Microsoft.VisualStudio.Text;
  using Microsoft.VisualStudio.Text.Editor;
  using Microsoft.VisualStudio.Text.Outlining;

However, when I converted my project to VS2015, I get errors that .Text is not found etc.

I posted this question in StackOverflow and get the folloing reply:

Use MEF to import an IOutliningManagerService, call GetOutliningManager() with your TextView, then use its methods to see the collapsible regions

Please help me by providing a working example if you can to enumerate Collapsed regions.

Joginder Nahil
www.starprinttools.com

Problem with setting a StartUp project in a Multi-project Template

$
0
0

Hi,

I have created a Project Template with Multiple projects in it. When i run and create a new project, i am not able to set specific project as a 'Startup Project' by default for my solution.

How can i make a specific project as my Startup project by default.

In my roottemplate.Vstemplate file, i have a project collection.

<TemplateContent>
  <ProjectCollection>
   <ProjectTemplateLink  ProjectName ="Console">Client Script\Client.vstemplate </ProjectTemplateLink>
   <ProjectTemplateLink  ProjectName ="Test">Sample Script\Sample.vstemplate</ProjectTemplateLink>   
  </ProjectCollection>
 </TemplateContent>

 is it possbile to make "Test" project as my Startup Project by default in my output.

Please suggest.

Thanks in advance,

Ravi


Adding property sheet to new project with custom wizard

$
0
0

Hello,

I'm trying to build a custom wizard for new Visual Studio 2010 projects. The custom wizard will essentially create a new VC++ project and add a few of my property sheets to each configuration.

I have this working well in Visual Studio 2008. In the default.js's AddConfig I simply referenced selProj.Object.Configurations("Debug|Win32"), then set the InheritedPropertySheets field to the property sheet. I did the same for Configurations("Release|Win32").

With 2010, however, the InheritedPropertySheets field is deprecated. Trying to get or set this field results in an exception. It appears the new way is to call AddPropertySheet method on the VCConfiguration object I get back when I use selProject.Object.Configurations("Debug|Win32"). However, when I try to do that I get the error "Variable uses an Automation type not supported in JScript".

One thing I've noticed is that if I look at the VCConfiguration's PropertySheets property (there are 3 items, which are the standard property sheets VS includes), I can call AddPropertySheet on those. Doing so would add the property sheet reference to the standard property sheets that VS includes, not to the project configuration.

Any ideas?


Visual Studio error "The expression for the data breakpoint does not specify an address" whenever user clicks on "Break when value changes"

$
0
0

I am working on a custom debug engine and I am able to get the option "Break when value changes" to pop up on the context menu for watch variables but whenever the user clicks on the option, it brings up a Microsoft Visual Studio error dialog with the following : "The expression for the data breakpoint does not specify an address." 

Any ideas of what interface I may be missing on implementing or what information to pass along to the SDM?

It tries calling this interface whenever a user right clicks on a watch variable, IDebugProperty2::GetMemoryContext which I believe I'm passing the right info. 

For some context, I was able to get the option to show up by passing this enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_DATA to the dwAttrib field of the DEBUG_PROPERTY_INFO struct of the IDebugProperty2::GetPropertyInfo interface function call. This might not be the right way so if I'm doing this wrong too please let me know.

Error opening Microsip project

$
0
0
I'm trying to open the source for microsip (source at www.microsip.org) with Visual Studio 2017, but I'm getting an error stating that "It was not possible to complete the operation" after I select the microsip.vcxproj file. Any clues on this one?

KDiff3 as external tool for compare/merge?

$
0
0

I'd like to use KDiff3 as the compare and merge tool in Visual Studio 2017. Is this possible, and if so, how? I've googled but haven't found which arguments to use for the compare and merge operations in Visual Studio.

The Visual Studio settings for external tools are under:

Tools > Options > Source Control > Visual Studio Team Foundation Server > Configure User Tools

Thanks!

How to define theme specific ClassificationFormatDefinitions in VSPackage

$
0
0

I would like to create a Syntax Highlighter in Visual Studio 2012 (and later) that supports different themes (Dark, Light, Blue).

Visual Studio's Editor Classifier project template explains how to create your own colors in the environment using Microsoft.VisualStudio.Text.Classification.ClassificationFormatDefinition. It works fine...

... until you realize that there are different themes in Visual Studio 2012 (and later) and you don't really support them. Your pretty dark blue colored identifiers on the light theme just become unreadable in a dark themed environment.

To my understanding if you change your ClassificationFormatDefinition in the Tools/Options/Fonts & Colors in a given theme (e.g.: Light) it won't affect the same ClassificationFormatDefinition in a different theme (e.g.: Dark). The colors seem to be independent across different themes.

That is good. But how do I achieve defining the same ClassificationFormatDefinition (e.g.: MyKeywords) that has the same name in all the themes, but provides different colors for them? Just like Visual Studio's own "Identifier", which is default black on the Light theme and default while on the Black theme.

I haven't found any attribute that would assign the given ClassificationFormatDefinition to a specific theme nor found much helpful article on the subject.

Any help appreciated.

Cannot find SSIS Toolbox in Visual Studio 2019

$
0
0
I have installed Visual Studio 2019, Version 16.1.5.  I can go to Help, About and see SSDT and SSRS in the installed product boxes.  When I look at other windows, I cannot see the ssis toolbox.  What am I doing wrong.   Thanks

Visual Studio 2019 Integration services error

$
0
0

Hello,


I am trying to run a little data flow task and I can't get it to work. I get the following error. Something to do with the debugger. Any ideas on how to fix this or why it happens?


Thanks in advance!

Details:

===================================

Failed to start project (Microsoft Visual Studio)

===================================

Cannot communicate with the debug host process. The IDtsHost interface is not registered. (Microsoft.DataTransformationServices.VsIntegration)

------------------------------
Program Location:

   at Microsoft.DataTransformationServices.Project.DataTransformationsPackageDebugger.LaunchVsDebugger(Boolean isRemoteTest, IVsDebugger iVsDebugger, DataTransformationsProjectConfigurationOptions options)
   at Microsoft.DataTransformationServices.Project.DataTransformationsPackageDebugger.ValidateAndRunDebugger(Int32 flags, IOutputWindow outputWindow, DataTransformationsProjectConfigurationOptions options)
   at Microsoft.DataTransformationServices.Project.DataTransformationsProjectDebugger.LaunchDtsPackage(Int32 launchOptions, ProjectItem startupProjItem, DataTransformationsProjectConfigurationOptions options)
   at Microsoft.DataTransformationServices.Project.DataTransformationsProjectDebugger.LaunchActivePackage(Int32 launchOptions)
   at Microsoft.DataTransformationServices.Project.DataTransformationsProjectDebugger.LaunchDtsPackage(Int32 launchOptions, DataTransformationsProjectConfigurationOptions options)
   at Microsoft.DataTransformationServices.Project.DataTransformationsProjectDebugger.Launch(Int32 launchOptions, DataTransformationsProjectConfigurationOptions options)


Syntax highlighting doesn't work for C# invisible editor in custom pane

$
0
0

I want to host two different VS C#/VB editors (as wpf controls) created via the IVsInvisibleEditorManager.RegisterInvisibleEditor method in my custom pane inherited from IVsUIElementPane and IVsPersistDocData interfaces. But highlighting works only for one editor.
I use the following code for creating editor

private void SetLeftDisplayedFile(string filePath)
{
	ThreadHelper.ThrowIfNotOnUIThread();


	ErrorHandler.ThrowOnFailure(_invisibleEditorManager.RegisterInvisibleEditor(filePath,
																			   pProject: null,
																			   dwFlags: (uint)_EDITORREGFLAGS.RIEF_ENABLECACHING,
																			   pFactory: null,
																			   ppEditor: out invisibleEditorLeft));

	RegisterDocument(filePath);
	
	IntPtr docDataPointer = IntPtr.Zero;
	Guid guidIVSTextLines = typeof(IVsTextLines).GUID;
	ErrorHandler.ThrowOnFailure(invisibleEditorLeft.GetDocData(fEnsureWritable: 1, riid: ref guidIVSTextLines, ppDocData: out docDataPointer));
	try
	{
		IVsTextLines docData = (IVsTextLines)Marshal.GetObjectForIUnknown(docDataPointer);
		//Create a code window adapter.
		codeWindowLeft = _editorAdapter.CreateVsCodeWindowAdapter(VisualStudioServices.OLEServiceProvider);
		const _codewindowbehaviorflags CWB_DISABLEDIFF = (_codewindowbehaviorflags)0x04;

		IVsCodeWindowEx codeWindowEx = (IVsCodeWindowEx)codeWindowLeft;
		INITVIEW[] initView = new INITVIEW[1];
		codeWindowEx.Initialize((uint)_codewindowbehaviorflags.CWB_DISABLESPLITTER | (uint)CWB_DISABLEDIFF,
								 VSUSERCONTEXTATTRIBUTEUSAGE.VSUC_Usage_Filter,
								 szNameAuxUserContext: "",
								 szValueAuxUserContext: "",
								 InitViewFlags: 0,
								 pInitView: initView);

		//Associate our IVsTextLines with our new code window.
		ErrorHandler.ThrowOnFailure(codeWindowLeft.SetBuffer((IVsTextLines)docData));

		//Get our text view for our editor which we will use to get the WPF control that hosts said editor.
		ErrorHandler.ThrowOnFailure(codeWindowLeft.GetPrimaryView(out textViewLeft));

		//Get our WPF host from our text view (from our code window).
		IWpfTextViewHost textViewHost = _editorAdapter.GetWpfTextViewHost(textViewLeft);

		Debug.Assert(this.control != null);

		//We already have an open window, so just insert this editor in place of the old one.
		this.control.InsertLeftEditor(textViewHost.HostControl);
	}
	finally
	{
		if (docDataPointer != IntPtr.Zero)
		{
			//Release the doc data from the invisible editor since it gave us a ref-counted copy.
			Marshal.Release(docDataPointer);
		}
	}
}
private uint RegisterDocument(string targetFile)
{
	//Then when creating the IVsInvisibleEditor, find and lock the document
	uint itemID;
	IntPtr docData;
	uint docCookie;
	IVsHierarchy hierarchy;
	var runningDocTable = (IVsRunningDocumentTable)Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(SVsRunningDocumentTable));

	ErrorHandler.ThrowOnFailure(runningDocTable.FindAndLockDocument(
		dwRDTLockType: (uint)_VSRDTFLAGS.RDT_NoLock,
		pszMkDocument: targetFile,
		ppHier: out hierarchy,
		pitemid: out itemID,
		ppunkDocData: out docData,
		pdwCookie: out docCookie));

	return docCookie;
}

The custom pane (see all code in my project on One Drive):

VsWpfCompareWindowPane : IVsUIElementPane, IVsPersistDocData
{
    ...
    int IVsUIElementPane.CreateUIElementPane(out object punkUIElement)
	{
		if (control == null)
		{
			control = new WpfCompareControl();
			if (!string.IsNullOrEmpty(_leftFilePath))
			{
				SetLeftDisplayedFile(_leftFilePath);
			}
			if (!string.IsNullOrEmpty(_rightFilePath))
			{
				SetRightDisplayedFile(_rightFilePath);
			}
		}
		punkUIElement = control;
		return VSConstants.S_OK;
	}
    ...
}

In the WpfCompareControl I use two ContentControl.

STR:

  1.  Download and build my solution on One Drive
  2. In the properties of the "TestEditor" project, select Start External program and use the path to VS 2019 devenv.exe
  3. Set the command line arguments to “/rootsuffix Exp”
  4. Save and then run the solution or download and install the .vsix
  5. Create test.testdiff file and add paths to two .cs files on your computer. For example
C:\Users\MstislavS\Source\repos\WpfApp10\WpfApp10\MainWindow2.xaml.cs
C:\Users\MstislavS\Source\repos\WpfApp10\WpfApp10\MainWindow.xaml.cs

   Save the test.testdiff file. In VS, click File-Open-File... and select the test.testdiff file.

Actual Result: Syntax highlighting and intellisence works only in the right editor, the left editor does not have syntax highlighting

but includes the same parts as the right one (bar items, scroll, zoom)

Expected result: Syntax highlighting and intellisence works in both editors.

Note: Syntax highlighting will work in both editors if you open any .cs file (File-Open-file...) after starting VS and before opening the test.testdiff file.
I have found the following article. Calling the runningDocTable.FindAndLockDocument and SetLanguageServiceID methods does not solve the problem. This post describes new mechanisms of creating editors in VS 2019, but doesn't solve my problem.

This problem reproduces only for Roslyn languages C# and VB, but xml, typescript, json etc editors work fine!
Syntax highlighting also does not work in ProjectionBufferTutorial example.





Add New Item Dialog Box

$
0
0
Is it possible to edit the Add New Item dialog box in Visual Studio where if I select class, a list if access modifiers appears at the bottom in radio button format?  I know how to create a template, but I don't want to create a template for each access modifier.  I have gone through the VSIX articles on Microsoft but can't find how to edit a dialog box in Visual Studio.  I'm not sure if the Add New Item dialog box is considered a Tools Window.

"Goto Definition" opens new tab for already opened tab

$
0
0

Hi everyone,

In my languageservice one can use the "goto definition/declaration" feature by pressing [F12]. In that case, the "Goto()" method of the corresponding AuthoringScope is called as expected. The method is supposed to return an URI of the target file for the goto operation. So far so good!

My problem is that a new file-tab is opened (instead of using the already existing tab if the file is already opened in the editor). So I now have two tabs pointing to the same file. Changes in one tab are immediately visible in the other tab. Another call to goto then always uses this newly created duplicated tab as goto-target, so no more than two tabs of the same file will be opened.

Has anyone also observed this behavior? Is this a known bug? More probably, what am I doing wrong? I'm always returning the full path to the file, not the relative path. How does VS determine if a file is already opened?

Thanks in advance,
Max

Syntax highlight and inserting special character extension

$
0
0

My English is not perfect, Sorry.

I am using Visual Studio 2010-2019 Community for typeing source files for my own language. These are UTF-8 files. I wish to create an extension: insering special characters by pressing own key combinations, for example, Alt+R should be insert ∈. I do not know Visual Studio Extensions use what language. I know only C, C++, Pascal, Assembly. I have no experience in any scipting or interpreting languages, only compiled languages. So, I need an example routine for inserting, after it, I can copy, modify the name and the inserted character, so I can make the routines of the other special characters.

This extension should be make syntax highlight: comment must be displayed in other color, for example cyan: 00FFFF. Comments are in [], nested comments are allowed. This is very simple: nesting level in the brackets must be computed: 0 at the begin of the file, [ increases with 1 (C++: ++ or += 1), ] decreases with 1 (--, -= 1 in C++). 0 -> -1 transition is an error: the ] can be showed in red for example, but can be cyan or default, the number of nesting level must remain 0, not -1. If the nesting level of the end of the file is not 0, this is an error so, but error report is not required.

Thanks.

VSIX Get method name, parameters, namespace and class name

$
0
0

Hi,

How can I get method name, parameters, class name and namespace with command on context menu from code windows on VSIX? Thanks.

Best,

_Abd

A way to evaluate expression/call function, on demand, while the app either running or on break mode

$
0
0
I'm writing a VS extension that would allow me to change data/get data from a debuggee, and to call some of it's functions. All of it is required to be able to run while it's in break mode or running. I tried to use expression evaluator, but it crashes the app when it's doing something (call stack becoming corrupted, there are 0xffffff's return addresses appearing there), and only works as desired while app is in break mode. I tried to create remote threads, but by some reason they don't work as well. It seems like there should be some universal solution for both cases, like "enter the break mode, evaluate expressions, exit the break mode" but using  EnvDTE90a::Debugger4::Break doesn't do much too, it just hangs until i stop the app from IDE window. All of it seem pretty weird and indicate that's i'm doing something wrong. Any advice?
Viewing all 4410 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>