Can I fake a namespace reference in XSLT - visual-studio

I have a xsl that i've copied out of Sharepoint, and pulled into visual studio.
Visual studio will not compile or apply the transfromation because of this error
XslTransformException
---------------------
Cannot find the script or external object that implements prefix 'http://schemas.microsoft.com/WebParts/v2/DataView/runtime'.
Can I tell VS to ignore the prefix? Or somehow provide a dummy schema to get the XSLT to work?
I was think of just removing all the references, editing my transform and then maybe put them back if I need them.

Related

Where can I find the complete schemas for Visual Studio 2005 and 2008 project files?

The only thing I could find so far were those two pages
http://msdn.microsoft.com/en-US/library/y4sy8216(v=vs.80).aspx
http://msdn.microsoft.com/en-US/library/y4sy8216(v=vs.90).aspx
Along with the respective "descriptions".
However, they are far from complete as is evidenced by the missing descriptions for elements underneath the Tool element.
So then I found the descriptions for VCProjectEngine in the VS installation folder:
C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.VCProjectEngine.xml
but it's unclear whether the names of the object properties is a 1:1 mapping to those inside the resulting .vcproj file?
Things appear to be a little more straightforward for newer VS versions (MSBuild based), but not completely.
There are none that describe the whole project file. The thing is that many tags work by convention, many tasks can be declared and named inline by simply calling out to the task assembly.
So even though for the basic structure a XSD exists, there is none that describes every possible way a project file can be setup not can you validate the project file without loading the tasks and have them validate their own snippets.

Is it possible to add custom resource types to a .NET .resx file?

In Visual Studio .NET projects you can create .resx files that contain resources which can be localized. Out of the box Visual Studio recognizes Strings, Images, Icons, Audio, Files and something called "Other" which I don't really understand.
What I want to know - can I extend Visual Studio and add a custom type here - say "Messages" (where a message would contain not only text, but also severity and other flags)? Naturally I would need to provide Visual Studio with my own editor and handle the necessary codebehind genereation, etc - but that's all doable. That is, if Visual Studio allows this sort of extensibility at all. Does it? And if yes, where can I find any documentation on it?
P.S. I'm using Visual Studio 2012.
Yes, this is entirely possible. In order to do this, the type you want to include has to have a TypeConverter that can convert to and from InstanceDescriptor. There is an example of this on MSDN.
Once you have the TypeConverter created, you adorn the type with a TypeConverterAttribute to tell the framework to use that type converter.
For example:
[TypeConverter(typeof(MyTypeConverter)]
public class MyType
{
...
}
Then you can persist values of that type into and out of the resx files.

Code generation in Visual Studio based on all files with a given extension

I have the following task: Make a visual editor in Visual Studio (not the core of today's question) which results in a text file, on a custom format. This file will then be used as input for code generation resulting in C# code. For this, I've been looking at:
T4
Visual Studio Extensions
Visual Studio Project Templates
Visual Studio Item Templates
I feel the solution is there somewhere, but I can't quite figure out how best to do it. As I see it, the main problem is somehow to automatically generate code for all files with a given extension. Does anyone know of any tutorials or descriptions on how to do this?
Thanks in advance!
To automatically associate a code generator with all files of a given extension, you need to
Create a Visual Studio package
Implement a custom IVsSingleFileGenerator. The easiest option is to subclass the BaseTemplatedCodeGenerator and override its GenerateCode method to supply your own T4 template as the "inputFileContent".
Use the ProvideCodeGeneratorAttribute to register the generator.
Use the ProvideCodeGeneratorExtensionAttribute to associate the generator with a file extension.
Create a VSIX with your package and generator and have your users install it.

Get a list of projects/references within a Visual Studio 2010 Extension

I'm creating a Visual Studio 2010 extension package (Microsoft.VisualStudio.Shell.Package) that needs to analyze all of the projects and those project's references. I would assume that this is done with a service (e.g. Package.GetService(typeof(IMenuCommandService))). What I need is the interface that contains the functionality to get a list of projects and references for those projects. Also, any advice on where to find a reference that contains the available interfaces within visual studio would be much appreciated.
Note that I've seen multiple people trying to do something similar using DTE from a macro. That's not what I'm trying to do. I'm trying to do the same thing from within a Visual Studio Extension.
So even though you're doing this as part of an extension, you'll still need to use the DTE APIs to get all of the information you want. It may seem backwards but that's just how it works. You should grab the DTE object via (EnvDTE.DTE)Package.GetService(typeof(SDTE)). Once you have a EnvDTE.Project, access it's Object member and cast that to a VSLangProj.VSProject if it's a C# or VB project. This has the reference information you need.

What type of extension for VS (and how) to make, to generate C# or C++ code from some text [more so a model]?

I am new to Visual Studio Extensibility and want to make an addin/extension which shall do the following:
It should read all the files with a specific file extension (assume "*.ump").
It should process the text/code/whatever in the files.
It should create new Class/Code file with some code in it. [The code will be produced in step 2, just need to know how to do it?]
Yet, I have been racking my brains through extensibility, saw the single file generators .... and addins which go through ProjectItems and can detect the file extension,
BUT I HAVE NOT BEEN ABLE TO FIND a complete tutorial, guide or explanation as to how or what to do!!
Please help...
You don't want to read all files with a specific file extension in Visual C++ project nor standard Visual C# project. You may do that with hand-made MSBuild project (included in the solution).
In Visual C++ projects, there is a way to define custom tools. They are run as separate processes, so you can implement them in anything you want. Studio will ask you whether you want to define a tool (they are defined in special xml files; studio has dialog for editing them) when you add a file with extension unknown to it. In Visual C# projects, just manually write a MSBuild tasks and insert them into the project.
Do whatever you want. IIRC the generated files will have to be included in the project though. Well, for MSBuild, just tweak the project to your heart's desire, but in Visual C++ they have to.
You can combine MSBuild (csproj,vbproj) and VisualC++ projects in a single solution, so I recommend using separate.
If you ever find out you need to compile for different target where you can't use Visual Studio, you'll be glad that you have stand-alone tool you were just calling from Studio and not something that embeds in it.

Resources