Hello I have been having issues with MonoGame when building I get the glbind... error in the opengl32.dll so I was suggested to find my GUID and it sounds like a simple task but i have looked in the project folder files and cant find it I found one which is
<ProjectGuid>{325BCA73-8459-49AF-9C31-D4A268BF8A1A}</ProjectGuid>
but im looking for one like this
<ProjectTypeGuids>{9B831FEF-F496-498F-9FE8-180DA5CB4258};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
here is a image of my file folder and the main "collisions".csproj file where I found the one GUID. I have done some research but i cant seem to find an answer as to where to look.
HERE
More accuretly im looking for the Projecttypeguids so I can delete one of them to see if that solves my problem as suggested here....I recognized what i worded at the top is kind of vague sorry
Here
The first example you gave is the GUID of your project. Hence ProjectGuid.
The second is a list of the GUIDs of the project types of your project. Hence ProjectTypeGuids.
If you are looking for the GUID of your project, the first example is giving you the correct answer.
The screenshot you linked to shows a project that does not have any type GUIDs listed. If present, the value is mostly used by development tools (e.g. VS uses it to figure out what items to include in the context menus for adding new items.) If there is no project type GUID your project will still "work" for the most part, but you will likely encounter odd behavior in your IDE of choice.
The project type GUID values in your question are correct for a project that is a C# application that uses the MonoGame plugin. If your project file is missing that tag, just add it yourself with whichever GUIDs you want your project to have.
(The list of well-known GUIDs can be found here, though the MonoGame one I had to look up on Google.)
First you didn't mentioned what you're using winforms or wpf.
OK whatever.The ProjectTypeGuids is not supported in winforms you can find them if you're using wpf.
If you're using wpf you can use this code:
public string GetProjectTypeGuids(EnvDTE.Project proj)
{
string projectTypeGuids = "";
object service = null;
Microsoft.VisualStudio.Shell.Interop.IVsSolution solution = null;
Microsoft.VisualStudio.Shell.Interop.IVsHierarchy hierarchy = null;
Microsoft.VisualStudio.Shell.Interop.IVsAggregatableProject aggregatableProject = null;
int result = 0;
service = GetService(proj.DTE, typeof(Microsoft.VisualStudio.Shell.Interop.IVsSolution));
solution = (Microsoft.VisualStudio.Shell.Interop.IVsSolution)service;
result = solution.GetProjectOfUniqueName(proj.UniqueName, hierarchy);
if (result == 0)
{
aggregatableProject = (Microsoft.VisualStudio.Shell.Interop.IVsAggregatableProject) hierarchy;
result = aggregatableProject.GetAggregateProjectTypeGuids(projectTypeGuids);
}
return projectTypeGuids;
}
public object GetService(object serviceProvider, System.Type type)
{
return GetService(serviceProvider, type.GUID);
}
public object GetService(object serviceProviderObject, System.Guid guid)
{
object service = null;
Microsoft.VisualStudio.OLE.Interop.IServiceProvider serviceProvider = null;
IntPtr serviceIntPtr;
int hr = 0;
Guid SIDGuid;
Guid IIDGuid;
SIDGuid = guid;
IIDGuid = SIDGuid;
serviceProvider = (Microsoft.VisualStudio.OLE.Interop.IServiceProvider)serviceProviderObject;
hr = serviceProvider.QueryService(SIDGuid, IIDGuid, serviceIntPtr);
if (hr != 0)
{
System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(hr);
}
else if (!serviceIntPtr.Equals(IntPtr.Zero))
{
service = System.Runtime.InteropServices.Marshal.GetObjectForIUnknown(serviceIntPtr);
System.Runtime.InteropServices.Marshal.Release(serviceIntPtr);
}
return service;
}
it's from here
Related
I am working on a project where I need to create multiple revit files consisting of wall types and create shared parameters into them. I completed this process.
But on manually clicking on Manage > Transfer Project Standards
Copy from "project name" > Wall Types through the revit interface.
I imported the wall types of different revit files created into one.
But the shared parameters seems to repeat in the type parameter list of the wall type with data in one set and the repeated set has no data.
It looks like the parameters I created are not shareable.
if (Convert.ToString(value) != "")
{
Type type = value.GetType();
string originalFile = uiApp.Application.SharedParametersFilename;
string tempFile = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()) + ".txt";
using (File.Create(tempFile)) { }
uiApp.Application.SharedParametersFilename = tempFile;
try
{
if (ele.LookupParameter(param) == null)
{
ExternalDefinitionCreationOptions edco = null;
if (type.Name.Equals("Double"))
edco = new ExternalDefinitionCreationOptions(param, ParameterType.Number);
else
edco = new ExternalDefinitionCreationOptions(param, ParameterType.Text);
edco.Visible = true;
var definition = uiApp.Application.OpenSharedParameterFile().Groups.Create("Custom Parameters").Definitions.Create(edco);
var newCategorySet = uiApp.Application.Create.NewCategorySet();
newCategorySet.Insert(doc.Settings.Categories.get_Item(BuiltInCategory.OST_Walls));
Autodesk.Revit.DB.Binding binding = uiApp.Application.Create.NewTypeBinding(newCategorySet);
doc.ParameterBindings.Insert(definition, binding, BuiltInParameterGroup.PG_IDENTITY_DATA);
if (!string.IsNullOrEmpty((string)value))
ele.LookupParameter(param).Set((string)value);
}
else
{
if (!string.IsNullOrEmpty((string)value))
ele.LookupParameter(param).Set((string)
}
}
catch (Exception ex)
{
}
finally
{
uiApp.Application.SharedParametersFilename = originalFile;
}
}
Here, this block of code is executed in a loop where "element" is the element into whom the shared parameter needs to be added. "param" is the parameter name and "value" is the value for the parameter. Please let me know if this is the right way to create shared parameter that can be shared when project wall types are transferred to another project.
Thank you
definitely this will happen, as long as you are in a loop, and keeps creating a shared parameter for each file. this will lead to creating unique GUID for each revit file. and when you combine all you will find all the shared parameters with different Guids but with the same name.
you need to create the shared parameter once, then for each revit file, set the sharedparameter file (that is already created with sharedparameter) and get the sharedparameter from it, then assign it to the category you wish for each revit file.
moreinfo about shared parameters here
hope that helps.
I'm writing a visual studio extension based on the Concord Samples Hello World project. The goal is to let the user filter out stack frames by setting a list of search strings. If any of the search strings are in a stack frame, it is omitted.
I've got the filter working for a hardcoded list. That needs to be in a non-package-based dll project in order for the debugger to pick it up. And I have a vsix project that references that dll with an OptionPageGrid to accept the list of strings. But I can't for the life of me find a way to connect them.
On the debugger side, my code looks something like this:
DkmStackWalkFrame[] IDkmCallStackFilter.FilterNextFrame(DkmStackContext stackContext, DkmStackWalkFrame input)
{
if (input == null) // null input frame indicates the end of the call stack. This sample does nothing on end-of-stack.
return null;
if (input.InstructionAddress == null) // error case
return new[] { input };
DkmWorkList workList = DkmWorkList.Create(null);
DkmLanguage language = input.Process.EngineSettings.GetLanguage(new DkmCompilerId());
DkmInspectionContext inspection = DkmInspectionContext.Create(stackContext.InspectionSession, input.RuntimeInstance, input.Thread, 1000,
DkmEvaluationFlags.None, DkmFuncEvalFlags.None, 10, language, null);
string frameName = "";
inspection.GetFrameName(workList, input, DkmVariableInfoFlags.None, result => GotFrameName(result, out frameName));
workList.Execute();
CallstackCollapserDataItem dataItem = CallstackCollapserDataItem.GetInstance(stackContext);
bool omitFrame = false;
foreach (string filterString in dataItem.FilterStrings)
{
if (frameName.Contains(filterString))
{
omitFrame = true;
}
}
The CallstackCollapserDataItem is where I theoretically need to retrieve the strings from user settings. But I don't have access to any services/packages in order to e.g. ask for WritableSettingsStore, like in You've Been Haacked's Example. Nor can I get my OptionPageGrid, like in the MSDN Options Example.
The other thing I tried was based on this StackOverflow question. I overrode the LoadSettingsFromStorage function of my OptionPageGrid and attempted to set a static variable on a public class in the dll project. But if that code existed in the LoadSettingsFromStorage function at all, the settings failed to load without even entering the function. Which felt like voodoo to me. Comment out the line that sets the variable, the breakpoint hits normally, the settings load normally. Restore it, and the function isn't even entered.
I'm at a loss. I really just want to pass a string into my Concord extension, and I really don't care how.
Ok, apparently all I needed to do was post the question here for me to figure out the last little pieces. In my CallstackCollapserDataItem : DkmDataItem class, I added the following code:
private CallstackCollapserDataItem()
{
string registryRoot = DkmGlobalSettings.RegistryRoot;
string propertyPath = "vsix\\CallstackCollapserOptionPageGrid";
string fullKey = "HKEY_CURRENT_USER\\" + registryRoot + "\\ApplicationPrivateSettings\\" + propertyPath;
string savedStringSetting = (string)Registry.GetValue(fullKey, "SearchStrings", "");
string semicolonSeparatedStrings = "";
// The setting resembles "1*System String*Foo;Bar"
if (savedStringSetting != null && savedStringSetting.Length > 0 && savedStringSetting.Split('*').Length == 3)
{
semicolonSeparatedStrings = savedStringSetting.Split('*')[2];
}
}
vsix is the assembly in which CallstackCollapserOptionPageGrid is a DialogPage, and SearchStrings is its public property that's saved out of the options menu.
In Revit 2013 I have tool that I'm making that copies dimensions from one drafting view to another. I've got it to properly create a new version of a dimension including the Curve, DimensionType, and References but I'm having trouble with the properties Above, Below, Prefix, and Suffix. They copy just fine if at least one of them has a value. However, if none of them have a value then it will throw an AccessViolationException when I try to access them. I have tried to catch that exception but it bubbles up and it crashes Revit (I'm assuming it's caused by native code that fails).
How can I check to see if these properties have any value when I do my copying without triggering this AccessViolationException?
Autodesk Discussion Group Question
The DimensionData class is my own used for storing the dimension information so that it can be used to create the dimension in a separate document.
private IEnumerable<DimensionData> GetDimensionDataSet(Document document,
View view)
{
if (document == null)
throw new ArgumentNullException("document");
if (view == null)
throw new ArgumentNullException("view");
List<DimensionData> dimensionDataSet = new List<DimensionData>();
FilteredElementCollector dimensionCollector =
new FilteredElementCollector(document, view.Id);
dimensionCollector.OfClass(typeof(Dimension));
foreach (Dimension oldDimension in dimensionCollector)
{
Line oldDimensionLine = (Line)oldDimension.Curve;
string dimensionTypeName = oldDimension.DimensionType.Name;
List<ElementId> oldReferences = new List<ElementId>();
foreach (Reference oldReference in oldDimension.References)
oldReferences.Add(oldReference.ElementId);
DimensionData dimensionData;
try
{
string prefix = oldDimension.Prefix;
dimensionData = new DimensionData(oldDimensionLine,
oldReferences,
dimensionTypeName,
prefix,
oldDimension.Suffix,
oldDimension.Above,
oldDimension.Below);
}
catch (AccessViolationException)
{
dimensionData = new DimensionData(oldDimensionLine,
oldReferences, dimensionTypeName);
}
dimensionDataSet.Add(dimensionData);
}
return dimensionDataSet;
}
Regarding transactions: As far as I'm aware, you are only required to be inside a transaction when you are making any sort of CHANGE (modifications, deletions, additions). If all you are doing is collecting dimension information, you would not need a transaction, but when you use that information to create new dimensions in another document, that code would have to be inside a transaction. I have had a number of programs under development which did not yet modify the document but simply collected parameter settings and posted them to a TaskDialog.Show(). These programs worked fine, and I don't see anything in your code that actually modifies your model, so that doesn't seem to be your issue.
It seems like I bug.
Can you post the issue to the ADN Support?
The solution I can suggest is to use Parameters of the Dimension element instead of Dimension class properties.
For example, you can get Suffix and Prefix by following code
var suffixParameter =
oldDimension.get_Parameter(BuiltInParameter.SPOT_SLOPE_SUFFIX);
string suffix = null;
if (suffixParameter != null)
{
suffix = suffixParameter.AsString();
}
var prefixParameter =
oldDimension.get_Parameter(BuiltInParameter.SPOT_SLOPE_PREFIX);
string prefix = null;
if (prefixParameter != null)
{
prefix = prefixParameter.AsString();
}
Unfortunatelly, I don't tell you how to get Above and Below Properties via parameters, because I don't have a project to test. But you can easily determine parameters using BuiltInParameter Checker
Hope it helps.
I´m using C# Microsoft.Build.Evaluation.Project class to retrieve specific information from a VS project file like the TargetFramework, AssemblyName...etc. But I'm unable to find the way or the property name to identify if the project is a Web Project. For a VS Project in framework 1.1 I'm using Xml parsing like this.
string path = "C:\\Test.csproj";
XElement root = XElement.Load(path);
var type = from el in root.Elements("CSHARP")
select el.Attribute("ProjectType");
if (type.Count() > 0)
{
// Local or Web
return((XAttribute)type.First()).Value);
}
I'll appreciate if someone could give me the name of the property or another suggestion to solve this problem.
Thanks in advance.
My full method code
public bool IsWeb(string path)
{
bool isWeb = false;
try
{
Project project = new Project(path);
// I dont know the name of the propety to identify if its a web project
//string type = project.GetPropertyValue();
//if (type.Equals("Web"))
//{
// isWeb = true;
//}
}
catch (InvalidProjectFileException)
{
//It's fw 1.1
XElement root = XElement.Load(path);
var type = from el in root.Elements("CSHARP")
select el.Attribute("ProjectType");
if (type.Count() > 0)
{
if ((((XAttribute)type.First()).Value).Equals("Web"))
{
isWeb = true;
}
}
}
return isWeb;
}
I went through a few project files. In one of my mvc projects, I found this node in the PropertyGroup node <MvcBuildViews> it's definitely not an end-all answer to your question but it looks like more information than you were working with.
You can check if project type guid belongs to one of the known types.
Below error is thrown when accessing the ie.Frames in new version of Watin 2.1
Error details: COM object that has been separated from its underlying RCW cannot be used.
System.Runtime.InteropServices.InvalidComObjectException: COM object that has been separated from its underlying RCW cannot be used.
at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, Boolean& pfNeedsRelease)
at mshtml.HTMLFrameElementClass.IHTMLElement_get_tagName()
at WatiN.Core.Native.InternetExplorer.IEElement.get_TagName()
at WatiN.Core.ElementTag.FromNativeElement(INativeElement nativeElement)
at WatiN.Core.StaticElementFinder.CreateTagList(INativeElement nativeElement)
at WatiN.Core.StaticElementFinder..ctor(DomContainer domcontainer, INativeElement nativeElement)
at WatiN.Core.Element.InitElement(DomContainer domContainer, INativeElement nativeElement, ElementFinder elementFinder)
at WatiN.Core.Element..ctor(DomContainer domContainer, INativeElement nativeElement)
at WatiN.Core.Frame..ctor(DomContainer domContainer, INativeDocument frameDocument)
at WatiN.Core.FrameCollection..ctor(DomContainer domContainer, INativeDocument htmlDocument)
at WatiN.Core.Document.get_Frames()
Please help me out it in solving this.
I modified the code for AllFramesProcessor using Praveen's suggestion (see below).
Before I did this, I did an SVN update on the Watin trunk. Jeroen made a checkin on 4/18/11 that fixed an issue around WaitForFramesToComplete to retry/wait loading the main document. Jeroen's fix alone didn't solve the problem, but I believe it's the combination of that code and the modified AllFramesProcessor that made Watin more stable around the Frames issue.
public AllFramesProcessor(HTMLDocument htmlDocument)
{
Elements = new List<INativeDocument>();
_htmlDocument = htmlDocument;
// Bug fix, trying to revert back to previous version
// http://stackoverflow.com/questions/5882415/error-when-accessing-the-frames-in-watin-new-version-2-1
//_iFrameElements = (IHTMLElementCollection)htmlDocument.all.tags("iframe");
_iFrameElements = (IHTMLElementCollection)_htmlDocument.all.tags("frame");
// If the current document doesn't contain FRAME elements, it then
// might contain IFRAME elements.
if (_iFrameElements.length == 0)
{
_iFrameElements = (IHTMLElementCollection)_htmlDocument.all.tags("iframe");
}
}
You can work around this by accessing ie.NativeDocument.Frames and then passing ie and any INativeElement objects to the WatiN.Core.Element constructor:
Element ElementFromFrames(string elementId, IList<INativeDocument> frames)
{
foreach(var f in frames)
{
var e=f.Body.AllDescendants.GetElementsById(elementId).FirstOrDefault();
if (e != null) return new Element(ie ,e);
if (f.Frames.Count > 0)
{ var ret = ElementFromFrames(elementId, f.Frames);
if (ret != null) return ret;
}
}
return null;
}
from https://sourceforge.net/tracker/?func=detail&aid=3290877&group_id=167632&atid=843727
This problem seems to be caused by the AllFramesProcessor class. The
constructor for this class in Watin 1.3 looked like this:
public AllFramesProcessor(DomContainer domContainer, HTMLDocument
htmlDocument)
{
elements = new ArrayList();
frameElements = (IHTMLElementCollection)
htmlDocument.all.tags(ElementsSupport.FrameTagName);
// If the current document doesn't contain FRAME elements, it then
// might contain IFRAME elements.
if (frameElements.length == 0)
{
frameElements = (IHTMLElementCollection)
htmlDocument.all.tags("IFRAME");
}
this._domContainer = domContainer;
this.htmlDocument = htmlDocument;
}
The constructor in 2.1 looks like this:
public AllFramesProcessor(HTMLDocument htmlDocument)
{
Elements = new List<INativeDocument>();
_htmlDocument = htmlDocument;
_iFrameElements =
(IHTMLElementCollection)htmlDocument.all.tags("iframe");
}
By changing the "htmlDocument.all.tags("iframe")" to be
"htmlDocument.all.tags("frame")" as per the Watin 1.3 constructor this
seems to resolve this issue. Not quite sure why the constructor was changed
to just look for iFrames though.
Recently I also encountered this problem and I started by following Richard Guions (accepted) answer and just to elaborate a little on that I did the following:-
svn co https://watin.svn.sourceforge.net/svnroot/watin watin
and then loaded the "Watin/trunk/src/WatiN.sln" solution and recompiled the src, then referencing that new Watin.core.dll in my project.
Low and behold the browser.Frame(Find.ByName("maincontent")); started working and I did not need to apply any other changes to the AllFrames code. So I think that the svn source has already been updated to include this change