I'm trying to create an ItemTemplate with multiple files. So far, so good. Both of my files are created and they have the right name. Now, one of them is named as the user entered. The other must use that name. I think that's what $safeitemrootname$ is supposed to do. How ever I get the same result as $safeitemname$. How can I do?
Thanks
Related
This is a repeat of a question asked by someone else way back in 2008
, but it appears there was no real answer back then and this is still a problem.
I am writing a Visual Studio extension for files which look like XML but are not, and do not end in an xml extension. (I am using .csp) However Visual Studio continues to parse and highlight the file as if it was XML. This makes it difficult to get my own parsing and error processing to work.
Is there any way to programmatically tell visual studio that the file is not XML?
See also similar issue on MS forum
Since you have your own file extension, yes there is! It's simply a matter of editor priority. The XML-sniffer editor is only given a chance to claim the file if nobody else with higher priority does so first. It does so by registering the special * file extension as editable, then grabbing the file if it looks like XML -- but that * extension registration only has a priority of 33.
All you need to do is make sure your editor is registered properly with a higher priority. On your package, make sure you have the ProvideEditorExtension attribute. I suggest a priority of 50 to start with (higher numbers have higher priority).
[ProvideEditorExtension(typeof(CspEditorFactory), ".csp", 50)]
If you don't already have an editor factory, there's a good walkthrough on MSDN about how to create one.
I have a VB6 project that I didn't create but I have to update, when I go to make the exe I get a compile error: Method or data member not found, and it points too "SCom1.FileReceive" in the code below. When I look at the Main form, the SCom1 control is a PictureBox.
This code has been working for the last 5 years but I don't know why SCom1 is a picturebox, or why I'm getting the error, is it a reference? SCom1 to me looks like a MSComm function? Let me know if anyone has any ideas, I just don't know VB enough to know how to troubleshoot this. Thanks
If SCom1.FileReceive = True Then
WriteToLog (Now() & " FileReceive was true, now false")
SCom1.FileReceive = False
End If
The machine which you have opened the code doesn't have the mscomm32.ocx file or the ocx file not registered properly.
When vb cannot reference an ocx, it'll convert the relevant control to a picture box control.
What you have to do is, close the project without saving. Then open system32 folder and check for mscomm32.ocx file. If the file is not there then you have to download that from the intenet. The register the file using regsvr32 command in command prompt.
After this you can open the vb6 project and start working.
=========================================================
EDIT : Included the update in the comments to the answer, this will help other users in the future... :-)
if the method name doesn't look familiar to a known ocx file (in this case the SCom1.FileReceive), the missing component can be a custom ocx file.
So check on the working machine or in project folder whether there are any ocx file exists in the relevant name (in this case SCom.ocx).
if there is a file exists in such name, register that file using regsvr32 (if not registered), then add that to toolbox, then replace the picture box control with the relevant control (make sure the name tally).
Is there a way to add a watch to an instance of a object, instead to a variable? I have an object that is passed through various functions via parameters, and the parameters name may change in each function, so I'd like to add a watch that would be 'fixed' to that instance, regardless of the variable its currently assigned to.
Does anyone knows a way to do that? I'm using Visual Studio 2012.
When you add the item to the Watch window, try right-clicking on that entry and choose Make Object ID. Then add a watch for the particular ID (1#, 2#, etc.) See this link for more info.
I'm in VS2010, in a new Word Add-In project. This is my first attempt at Word development using VSTO. The example I'm trying has this line:
Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
But when I add this line Visual Studio says it can't find "Factory". Indeed, it's not in Intellisense.
I've got references to:
Accessibility
Microsoft.Office.Interop.Word
Microsoft.Office.Tools.Common.v9.0
Microsoft.Office.Tools.v9.0
Microsoft.Office.Tools.Word.v9.0
Microsoft.VisualStudio.Tools.Applications.Runtime.v9.0
Office
and all the usual System references.
Where am I going wrong and why can't I get to "Factory"?
stdole
That example looks a bit weird to me. Never seen that sort of reference before.
Generally, with Vsto, you hook into EVENTS on, say, the main Word App object.
Then, from within the event, you usually are passed a reference to the particular DOC object that the event is occurring for (say, being opened or saved, etc). In that way, there shouldn't be any need for using the "globals" object or the "factory" object, whereever they might be.
What method is that code in? A little more context might help.
I think the recommended way of doing this is:
Globals.ThisAddin.Application.ActiveDocument
Basically, I created a Visual Studio Installer project. I added a primary output to my project, which was great because it loaded in the dependencies and files automatically for me. The problem I'm facing is that I want to be able to mark my config file as a hidden file, but can't seem to figure out how.
When I go to View>File System it lists:
MyExternalAssembly.dll
Primary output from MyProject (Active)
So, is there a way to actually mark my config file as hidden during installation if I add a primary output project instead of the individual files?
I'm not sure if you really want to make it hidden. If you're worried about users looking at it, a more than average user will know how to un-hide things and pilfer around. So, that being said, if you want to keep users from seeing what's in the config you will need to encrypt the config. A good example of that can be found here:
http://www.davidhayden.com/blog/dave/archive/2005/11/17/2572.aspx
If you still want to hide the config, then you could try hiding it once the application is run for the first time.
Using: ApplicationDeployment.IsNetworkDeployed && ApplicationDeployment.CurrentDeployment.IsFirstRun with a click once application you can tell if this is the first time an application is run.
You could then use File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.Hidden); to actually hide the app.config.
Which would result in:
if (ApplicationDeployment.IsNetworkDeployed && ApplicationDeployment.CurrentDeployment.IsFirstRun)
{
File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.Hidden);
}