Where is the log file located? I'm doing a build and I can't find where that file is. Everything online says it's $IntDir, but it looks like it's only for CPP projects, not .NET. This is Visual Studio 2017 on a regular .NET console project. I can't locate the file anywhere. If I choose to do "detailed" in the output, it's far too large. I'd like to get detailed info in the log file only.
I know you can do things via msbuild directly, but I'm trying to figure out what Visual Studio is doing that's different from what I'm doing via MSBuild directly so I can replicate what VS is doing.
Unfortunately, there is no log file for managed projects - you can save a file from the output pane.
You may also be interested in using the MSBuild Log Viewer, which has a VS plugin that lets you save binary-format MSBuild logs from Visual Studio, then open them in the viewer.
Related
I am making a program that involves looking for a program's directory. I was making this in visual studio, until today, where I decided to try visual studio code.
Immediately I ran into an issue, with the program not being able to find a file that it should open. I am using Path.GetDirectory() to find the location of the program and using that and combining it with the path to a text file in order to open the said text file
After doing a bit of testing, I found that in vs code the directory it uses to run the program to the directory in visual studio. (Visual Studio uses the location of the .exe file while Visual Studio Code uses the program.cs file directory)
So does anyone have any ideas as to why visual studio code uses a different directory compared to the visual studio? And is there a way for the program to always look for the .exe file over the .cs file
Well, I'm not sure why it is that these are the defaults, though I imagine it is because VS Code is more focused on quick development, while Visual Studio is more focused on production development, but I do know how to change them. In Visual Studio, right click (or Alt+Enter) on the project, go to the Debug tab, and change the working directory field.
In VS Code, go ahead and change the "cwd" field in launch.json to whatever you want it to be. You can use these variables in there.
Visual Guide for Visual Studio:
For the software at work we have multiple projects in a solution. Most of the project we can just build the solution and then publish artifacts of the web project that we need. API and Auth projects are slightly different though. Our currently deployment process is manual and for the API (STARS.API.csproj) and Auth (STARS.Auth.csproj) project when would go into Visual Studio 2017 and right click the project and click publish, select a profile and then publish. Once that is done we take the Publish Output and drop those files on our server.
We are trying to move to a automated process through TFS and I am using the Visual Studio Build task in a build definition. However when I try to run this through TFS, an error saying that the publish profile cannot be found:
Validating PublishProfile(TFSProfile.pubxml) settings. C:\Program
Files (x86)\Microsoft Visual
Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\Web\Microsoft.Web.Publishing.targets(4368,5):
Error : The value for PublishProfile is set to 'TFSProfile.pubxml',
expected to find the file at
'C:\agent_work\4\s\STARS\Source-dev\STARS.Web\Properties\PublishProfiles\TFSProfile.pubxml'
but it could not be found.
It is looking for publish profile in a different project folder.
Visual Studio Build Task:
I feel that I can approaching this completely wrong. I am just trying to replicate the process on publishing the project through Visual Studio 2017 manually.
Please let me know if you require more information.
I suggest you start using the pre-defined build variables. $(Build.SourcesDirectory) will map to C:\agent_work\4\s, and from there you can create a full path to the TFSProfile.pubxml, where ever it might be in your source tree. Use this full path in the MB Build Arguments, PublishProfile property, e.g.
/p:PublishProfile=$(Build.SourcesDirectory)\STARS\Source-dev\STARS-API\TFSProfile.pubxml
Another problem you may have is that in the Solution field you are not specifying a solution (.sln) but a project (.csproj). I suspect that MSBuild is picking up the solution associated with that csproj, and building the whole solution, which is why it is looking for a publish profile in STARS.Web. Have you created a publish profile for STARS.API?
I am relatively new to programming and only have some experience with Python and MATLAB but was given an assignment in which I have to run and test a sample program using .NET. I'm set up with Windows 7 via VMWare running on my Macbook Pro and obviously I've got Visual Studio on the desktop.
I have a zip file of the sample program but am having trouble opening it correctly in Visual Studio. Inside the file there is a Microsoft Visual Studio Solution with the same name as the test program. When I open that I get error messages saying certain file paths are not found (which I assume means that I'm not opening the program correctly).
There are also:
a couple XML configuration files
a Visual C# Project File
Visual C# Source files
other folders entitled 'bin', 'obj', 'Properties'
Again, I know this might be a very rudimentary solution but I have been struggling with it for a few days and was hoping I might be able to find a solution here. Thanks!
If you have extracted it correctly, by double clicking on .sln file should launch the application on visual studio.
You can create new solution and import files and references.
I have a few classes with the same namespace, and I want to put all of them in a dll file, and use it in other places.
I read the guide on Microsoft's website:
http://msdn.microsoft.com/en-us/library/3707x96z(v=vs.80).aspx
They suggested this:
To build the file [myDllName].DLL, compile the two files [myClass1].cs and
[myClass2].cs using the following command line:
csc /target:library /out:[myDllName].DLL [myClass1].cs [myClass2].cs
I wrote it in a cmd window and got an error that there is no such command as csc.
Plus, how it will find my files without a path?
So what is the right way of doing it? Where should I write it?
I saw some posts here with Library classes.. but not sure how it can help me.
My classes are in a different solution, and I just want to use it as an external dll, and not within the same solution.
In this case, Microsoft's guide seems perfect, if it will work.
If you use the Visual Studio Command Prompt window, all the necessary environment variables are set for you. In Windows 7, you can access that window from the Start menu by opening the Microsoft Visual Studio Version\Visual Studio Tools folder. In Windows 8, the Visual Studio Command Prompt is called the Developer Command Prompt for VS2012, and you can find it by searching from the Start screen.
source
You can run the vsvars batch file from a command prompt and it will set paths for you, for that instance of cmd.exe
Mine is here:
>"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\vsvars32.bat"
Why don't you just create a separate 'Class Library' project in your solution in Visual Studio?
You can than easily add it as a project reference to all other projects that need it.
You can create Solution Folders in VS to logically group projects.
Make sure csc.exe is in your PATH environment variable.
You should have a vsvars32.bat that was installed with Visual Studio. You can run that to automatically add it to the path, or dig down in regedit to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP
Look through the subtrees in there for your framework version, and for an InstallPath key. That should tell you what directory to look in.
You can then use that, and:
WHERE /r "the_directory_you_found" csc.exe
to find the path. Add that to your system environment variables, and you should be able to find it.
As for the path of the class files, either run the command from the directory they're in, or specify the path when specifying the class files.
If you have Visual Studio installed, you could try creating a 'Class Library' project; Or you can run csc.exe by Launching "Visual Studio Command Prompt".
If you don't have Visual Studio installed but have .net framework installed. You can run csc.exe from the framework installation directory.
Installation directory path for .net Framework 4.0 :
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319
I was recently asked by a co-worker if it was possible to automatically output the contents of these windows into a text file automatically each time the solution is built.
I have been using Visual Studio .NET since the original release. I have not witness a way to do this, I also never had the need, so I simply could have glanced over it.
There must be a way to tell csc.exe and MSBuild to output to a file.
I forgot to mention this is a Visual Studio 2005 C# project.
In 2010 (assuming it's the same for all others) each project generates a %name%.log text file in it's own directory by default. The solution does not though, so you may need to concatenate all these files or something similar.