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.
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:
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.
I have a relatively large WinForms application that has been developed under Visual Studio 2013. I recently upgraded to Visual Studio 2015 on another computer and have been trying to get the project working under it.
My first issue/concern is that when I open the project for the first time in Visual Studio 2015 it does not ask me to "upgrade" the solution to Visual Studio 2015, it happily just opens the solution. I am used to having Visual Studio ask to "upgrade" the solution and create a new .sln file that is recognized as a, for example, Visual Studio 2013 solution instead of the old VS10 solution.
The actual issue I am facing is ~10 errors that seem to deal with cryptography. From what I can guess this has to do with the solution itself and what microsoft does with it in the background seeing as the most cryptography I use in the project is generating Guid.
An image of the errors
The one other issue I have is that, as I am not used to, I cannot double click on the errors them self to be lead to where Visual Studio thinks they are occurring. Thus I am not sure what is generating them or where to go from here.
Any suggestions?
This is a Windows 7 installation on an older model Lenovo Thinkpad. I do not have admin privileges on this computer either.
EDIT: So far I have tried to add <enforceFIPSPolicy enabled="false"/> to the file Visual Studio 15 settings at C\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Devenv.exe.config, though whenever I try to edit it (even after a fresh restart) the file is "always" opened by another program. So it seems I cannot edit the file to turn off FIPS for Visual Studio 15.
I am still open to suggestions or clues.
EDIT2: I have managed to get <enforceFIPSPolicy enabled="false"/> into the IDE settings with the help of IT (Using this article). Though this seems to do absolutely nothing, it seems that it is being ignored.
Another issue/clue here is that even if I create a brand new C# project in Visual Studio, when I try to compile I receive the same errors. So I have to assume that Visual Studio is using the SHA256 class somewhere "in the background". If I did have control over its usage I would try to implement #Kevin 's answer below.
I have found another possible solution on the web though I am not sure of its validity
VS 2012 now builds C# projects in a separate process that runs
msbuild. The entry you added to devenv.exe.config (that worked for VS
2010) won't be seen by this process. You should add the same entry,
namely
to the config file for msbuild; typically that's found at
c:\Windows\Microsoft.Net\Framework\v4.0.30319\msbuild.exe.config"
I will try to get this done when I have time for the .NET 4.5+ msbuild.exe.config files and report back.
The solution I went with is outline here.
<enforceFIPSPolicy enabled="false"/> was added to a few files, namely
C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild.exe.config
C:\Windows\Microsoft.Net\Framework\v4.0.30319\msbuild.exe.config
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Devenv.exe.config
Though I think the one that actually made it work was the first file.
You can't double click on the error and have it go to where the error is being thrown because it is being thrown inside the SHA256 class. If the FIPS compliance bit is set, any non-FIPS compliant .NET cryptography classes throw this error.
You have two choices to fix this...
First, you can just turn off the FIPS compliance bit on the machine where you are trying to run the app (not recommended).
Otherwise, you can update the code to use the FIPS compliant version of SHA256 (SHA256CryptoServiceProvider). This will require .NET Framework 3.5 or greater.
I am trying to create a VS extension and I need to know the currently executing project (for example, if someone is building a Xamarin.Android app and they have deployed it, I need the Xamarin.Android project). Further, I need to know the output directory of that project (so I can get some binaries from it). Can anyone help me with this?
I've tried using IVsSolution, and DTE2 (among other related things), but haven't found anything that tells me what is currently running.
Thanks
To know the output build folder of a project using automation (EnvDTE.Project), see:
HOWTO: Get the output build folder from a Visual Studio add-in or macro
To get the solution startup projects using automation see:
DTE.Solution.SolutionBuild.StartupProjects
Native VS services are somewhat more limited in this area than automation:
IVsSolutionBuildManager.get_StartupProject
The EnvDTE.Debugger object has properties to get the active process, etc:
Debugger Interface
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.