In Visual Studio (I'm using 2010), When you create your own class/struct, where the filename and class name/struct name matches, and then attempt to rename the file, Visual Studio asks if you want to update the class name / struct name and all references to the class / struct.
When I import a code file into the project, which follows the naming convention (file name and class name / struct name are the same) and then try to rename the file, Visual Studio does not ask me to update the class / struct and references to it...why is it only working for files that I create as opposed to files that I import?
You still can rename the class using refactoring to make sure it updates all references, if it's what you're looking for.
It's not an answer though, if you really just want to know why it doesn't work ^^
Maybe the file have to compile correctly for this trick to work ?
Related
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.
I'm new to Visual Studio and Windows, trying to figure out how to include a 3rd party lib into my vb.net project. I'm using VS2010 "free edition", i've added the required DLL file: Ionic.Zlib.dll and can see it under the references recent tab. The type "ZipFile" is still not resolving but should be according to the readme. Is there something else I need to do to make VS aware of the DLL?
You also need to add a Imports statement at the top of the source file in order to be able to use a type without declaring the fully qualified name.
you need to write on the top of the file
in c#:
using Your_namespace;
in vb:
imports Your_namespace
Is it possible to prompt the user for more than just a file name when they create a new item from a Visual Studio 2005 template? It would be nice to have more than just the class's name filled in when a template is used.
Apparently, the only way to accomplish this is by creating a WizardExtension (compile a DLL with a class that implements IWizard), and referencing it in the VSTEMPLATE file.
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.
How do I prevent the name of the Solution Folder in a VS project from being appended to the namespace generated for new items added to the solution folder?
Example: C# project in a VS solution
Default Namespace set in C# project properties: "BigClient.Domain"
If you create a solution folder in this project called "MySpecialStuff" and then add a new class to the 'MySpecialStuff" solution folder, VS creates the new .cs file with a "BigClient.Domain.MySpecialStuff" namespace. I want to find a way to allow the namespace of the newly-added class to retain just the 'project-level' namespace of "BigClient.Domain" instead of VS appending the "MySpecialStuff" solution-folder-name to the namespace.
I seem to recall reading a blog post by someone that this was possible (either via options/settings in VS or a registry setting) but I cannot recall where or how now that I want it :)
My platform is VS 2008 if answer = different for different VS versions.
If you have ReSharper installed, on the settings for the directory (F4), set Namespace Provider to false.
Make a new class template or change Visual Studio's class template. See the MSDN documentation for how to this. In the template file, you quickly see the line that inserts the 'safe' namespace name.