I'm using vs2010 and I need to log a multithreading application.
So I decided to use log4net, but as I'm not used to work with this, Intellisense is gonna be worth.
I download the .xsd from http://csharptest.net/downloads/schema/log4net.xsd and put this in VSFolder/Xml/Schemas.
But, how can I say to my log4net.config to use the XSD Schema?
Use the menu XML -> Schemas...
The menu is only there if you have the config file (or any other xml file) open.
Instead of putting it into a VS folder, put it somewhere inside your solution's folder tree. It doesn't even need to be included in any projects. just put it there and it works...
Or into: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Xml\Schemas and you're sorted once and forever.
Related
I've been given a Visual Studio project which has come with the following files:
myproj.def
myproj.dsp
myproj.dsw
myproj.idl
myproj.vcxproj
myproj.vcxproj.filters
After reading the Project and Solution Files Microsoft Docs it says for Projname.vcxproj:
The project file. It stores information specific to each project. (In earlier versions, this file was named Projname.vcproj or Projname.dsp.) For an example of a C++ project file (.vcxproj), see Project Files.
And this Microsoft Docs page says:
For convenience, Microsoft Visual Studio 6.0 provides a project file for each sample. This file has the DSP extension. An Allsamp.dsw workspace file is also provided in the main directory so that you can compile all the samples at once from within Visual Studio.
Does that mean that if I have the .vcxproj file, I can safely delete the .dsp and .dsw files?
Assume I do not care to ever recompile using Visual Studio 6.0 in the future.
.sln is equivalent to .dsw in VC6.0
.vcxproj is equivalent to .dsp in VC6.0
As far as I'm concerned ,if you have the .vcxproj file , you can safely delete the .dsp and .dsw files?
So I just made some c++ application, using NotificationIcon sample from Microsoft as a reference, and thus I'm stuck with the NotificationIcon.exe output file. The name is really lame and I'd like to change it. I've tried renaming the exe, renaming the solution, the project - whatever else - and my programm just exited with code 0x00 after building. What else should I try?
I tried to do the same thing, but there were a few steps I had to follow in VS2019 just to get set up. If you are not in a similar state, the rest of the answer might not apply.
Downloading the sample: I had to install the Windows 7 SDK, as the download page didn't seem to exist anymore. I'm not sure if you found it elsewhere, in which case you might be starting from different sources.
Converting the .vcproj file to .vcxproj. Visual Studio no longer supports .vcproj, and opening the solution triggered this conversion automatically.
Now, once I have a .vcxproj file, there are two routes to setting the name of the exe:
Right-click the project in VS, click Properties, and find the Target Name field. This defaults to $(ProjectName) so I would have expected that renaming the .vcxproj would have renamed the .exe file.
Edit the .vcxproj file directly, adding <TargetName>Foo</TargetName> into the section that starts with <PropertyGroup Label="Globals">
In visual Studio 2010, I want to make all of the projects in one solution have the same configuration such as the include directory,the lib directory? I know there is a thing called property manager that can do this, but it makes other solutions have the same configuration.
Is there some ways to deal with it:Only let the projects in the same solution have the same configuration and don't affect other solutions?
What you can do is make your own .props file. If you open the .vcxproj file with a text editor, you can find some lines down the file something like this:
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
That imports (or includes or calls) some other .props file. Look for that file and use a text editor to open it, here it is in C:\Program Files\MSBuild\Microsoft.Cpp\v4.0. This gives you and idea of how .props files are structured.
Now, you can make your own .props file and in it set the include and lib paths like you want them (maybe set additional settings as well) and finally you have to add an <Import.../> line in your .vcxproj files manually. Don't worry, VS will not remove it, even if you make changes to the project.
Helpful web sites for .props programming:
Visual C++ Team Blog: http://blogs.msdn.com/b/vcblog/ (look around there, it's a treasure trove)
A guide to .vcxproj and .props file structure: http://blogs.msdn.com/b/visualstudio/archive/2010/05/14/a-guide-to-vcxproj-and-props-file-structure.aspx
Often when working in VS2010 I find that I have a list of namespaces I want in all files. For example
using Common.Logging;
Is there a way I can configure this, preferably at a project or solution level?
There really isn't something built-in to do that. You can edit the Class.zip file in C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplatesCache\CSharp\Code\1033 to change the usings in the default class created by "Add Class".
You might want to consider using a custom snippet instead of "add class" if you want something project/solution specific.
Is there a way to compile a .vbproj or .csproj project file directly, just like Visual Studio does?
When you compile in Visual Studio, the "output" window shows the actual call to the compiler, which normally looks like:
vbc.exe [bunch of options] [looooong list of .vb files]
I would like to programatically call "something" that would take the .vbproj file and do whatever Visual Studio does to generate this long command line. I know i could parse the .vbproj myself and generate that command line, but I'd rather save myself all the reverse engineering and trial-and-error...
Is there a tool to do this? I'd rather be able to do it in a machine without having Visual Studio installed. However, if there's a way to call Visual Studio with some parameters to do it, then that'll be fine too.
I looked briefly at MSBuild, and it looks like it works from a .proj project file that i'd have to make especially, and that I'd need to update every time I add a file to the .vbproj file. (I did look briefly at it, so it's very likely I missed something important)
Any help will be greatly appreciated
MSBuild is the easiest way to go. For instance:
msbuild /property:Configuration=Release MyFile.vbproj
MSBuild can also take your solution file and use it to do the compile.
You can use either MSBUILD or CSC. MSBuild, which as you mentioned, does use your project and solution files. CSC will compile specific files, or all files in a specific directory tree.
You should also look at automating your builds with NAnt and/or CruiseControl.net.
Also, here is an example on how to compile your code without visual studio using CSC.
http://blog.slickedit.com/?p=163
Just so you know .vbproj and .csproj files are MSBuild. So everything that you've read, you can apply to those files directly.
Sayed Ibrahim Hashimi
My Book: Inside the Microsoft Build Engine : Using MSBuild and Team Foundation Build
In project solution folder:
msbuild wpfapp1.sln /p:BuildProjectReferences=true
MSbuild is usually located in:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319
(or something similar, depending on the version)
csc.exe compiles files, msbuild compiles projects and solutions
At the top of a .vbproj file is a . Add this line to the property group to suppress the VB runtime:
<NoVBRuntimeReference>On</NoVBRuntimeReference>
MSBuild does the rest. No need to use the command line if you have the IDE.