Visual Studio 2017 enterprise can not add reference - visual-studio-2017

When I want to add a reference in a project in Visual Studio 2017 Enterprise. I get the following error:
"The operation could not be completed"
I have tried cleaning and rebuilding solution, restart computer, delete bin and obj folder and all .suo files. Also there is no error in my Web.config file.

So I got help from microsoft support.
Open Visual Studio Command Prompt as administrator
Goto the path of your visual studio installation, standard is: C:\Program Files (x86)\Microsoft Visual Studio\2017\
Select your installation type and goto \Common7\IDE\PublicAssemblies
Run command: gacutil -if Microsoft.VisualStudio.Shell.Interop.8.0.dll
Run command gacutil -if Microsoft.VisualStudio.Shell.Interop.11.0.dll
This fixed it for me

I have tried the below steps and it worked for me.
Select the project in which you want to add the reference, then right click on it, Unload the project.
Again go to the same project, right click and then you can see the option of Edit the project. Click on it and for reference click on this link-
Project_Name.csproj file(C#)
Now manually include the namespaces or any project reference present in the same solution which you want to use in the current project. For reference, click on this link- Add the references:See Highlighted
In order to create the Project UID(Unique ID)- {1140F306-2341-4D3D-BEC7-9CCA3C2AC00E},
Go to Tools -- Create GUID -- Select GUID Format i.e. Registry Format and then click on copy and then paste it into your .csproj file. For reference click on this link-
GUID Tool
Then save the .csproj file and then right click on the project in which you have done changes and Reload the project.
After following the above steps, right click on the references and you can see the namespace or project reference which you have given in .csproj file
I hope, the above solution will work for others as well.

Related

I Don't Know How To Use/Run These Files That Are In A Github C++ Library I'm Trying To Add To My Project?

https://github.com/gladosconn/ecdsa_cxxI have been trying to get this library into my project (C++ using Visual Studio 2022, in Windows) because I need to use the ecdsa signature algorithm, I have copied all the files in src folder to a folder called "ecdsa" in the src folder inside my project, and I didn't do anything with the test folders (I think that I don't need them since they're just tests), but then there are these files (.ytml) ,(.txt) ,(.py), I have no idea what am I supposed to do with them or where to put them, but I sure I need them because the program isn't working, it's giving me this error Cannot open include file: 'secp256k1.h': No such file or directory Libraries.Also I have done everything in the requirements section, my compiler supports C++11, and I have installed openssl, and I have CMake installed.This is my first time using anything from Github so I'm sure what to do.
In Visual Studio, right-click on your project in the Solution Explorer pane. From the menu that pops up, choose the 'Properties' item. It is usually at the very bottom. A dialog box will appear.
In the left pane of the dialog box, expand the options Configuration Properties > C++ > General. Now, in the right pane of the dialog box, probably at or near the top will be an item labeled 'Additional Include Directories`. Add the full path to the folder where you copied the source files from GitHub.
You may need to explicitly add ALL the files you downloaded from GitHub into your Visual Studio project.
Try compiling again.

Multiple file compilation in visual C++ 2010

I have a very specific question in regards to visual C++ 2010 express. I have looked everywhere but can't find instructions on how to compile several source files. I have programmed on Unix at the command line and am trying to learn visual C++ 2010. I am using a header file that contains the function declarations and global variables. I don't know if this is the correct venue to ask this question but if anyone knows of some place where I can get the answer I would be grateful
Thanks,
Ral
If you have a project that you build from the command line with a makefile, then the Visual Studio development environment will not recognize your project. To open and build your project using Visual Studio, first create an empty project containing the appropriate build settings using the Makefile Project Wizard. You can then use this project to build your project from the Visual Studio development environment.
The project displays no files in Solution Explorer. The project specifies the build settings, which are reflected in the project's property page.
The output file that you specify in the project has no effect on the name that the build script generates; it declares only an intention.
Source: Creating a Makefile Project (VS2013)
On the menu: File->New->Project
On the dialog:
select Win32 Console Application,
enter Name ( like you did in the -o in unix) in the bottom,
and press OK
On the next dialog: Press next.
On the next dialog:
unmark Precompiled headers
mark Empty project
press Finish
Now find the Solution Explorer tree. You have Solution name and a project with the same name in it.
Right click on the project (not solution)
choose Add->Existing Item
and select your files, (you can copy them to the opened folder and then choose them)
press Add
Now you can try to compile.

How to setup Glew and Glut in Visual Studio 2012

By reading question you would get the idea about description.
Steps I done so far:
download glut from internet
copy glut.dll to windowsvow64 (I'm using x64).
Copy glut header files to C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\GL
Copy glut.lib to C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib
and done the same for glew and glfw. I edited additional libraries (glew.lib; glut.lib; etc)
But so far, its not compiling a simple program mentioned in this website.
Here are the errors
error LNK2019: unresolved external symbol _glfwInit referenced in function _main
(and many more are like this)
To add a reference in Visual Basic
In Solution Explorer, double-click the My Project node for the project.
In the Project Designer, click the References tab.
Click the Add button to open the Add Reference dialog box.
In the Add Reference dialog box, select the tab indicating the type of component you want to reference.
Select the components you want to reference, and then click OK.
To add a reference in Visual C#
In Solution Explorer, right-click the project node and click Add Reference.
In the Add Reference dialog box, select the tab indicating the type of component you want to reference.
Select the components you want to reference, and then click OK.
To add a reference in Visual C++
In Solution Explorer, select the project.
On the Project menu, click Add References.
Note In Visual C++ 2005, click References on the Project menu, and then click Add New Reference.
In the Add References dialog box, click the tab that corresponds with the category that you want to add a reference to.
Note In Visual C++ 2005, click the Browse tab in the Add References dialog box.
Click Browse, locate the component that you want on your local drive, and then click OK. The component is added to the Selected Components field.
Note In Visual C++ 2005, locate the component that you want on your local drive.
To add the selected reference to the current tab, click Add.
Note In Visual C++ 2005, click OK to close the dialog box and add the component in the References list box on the Properties Page dialog box of the project.
More about this you can find HERE
First of all, add your dll's to C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin
If you have the includes and libs in the directories above then that should be fine.
Now right click on your project and select Properties
Go to linker and within this, select Input
make sure you have listed the required libraries in here like your glew.lib, freeglut.lib and the following which is recommended on the glfw website:
glfw3.lib, opengl32.lib (I'm assuming you're using glfw3)
See here for more info:
http://www.glfw.org/docs/latest/build.html
You need to specify the libraries for example glut.lib and the others to the project, The compiler cannot scan all libraries looking for the functions you are invoking; only does that for the standard library. So in VS from the project Menu select properties, then for the linker input add the libraries you are using to additional dependencies.

How do I create an executable in Visual Studio 2013 w/ C++?

I can't find the exe file for my Hello World program that succeeded to work, and the program did not open as soon as it said it worked. I tried going to my documents and checking my project's folder. It was completely empty. Thanks for any and all help.
All executable files from Visual Studio should be located in the debug folder of your project, e.g:
Visual Studio Directory: c:\users\me\documents\visual studio
Then the project which was called 'hello world' would be in the directory:
c:\users\me\documents\visual studio\hello world
And your exe would be located in:
c:\users\me\documents\visual studio\hello world\Debug\hello world.exe
Note the exe being named the same as the project.
Otherwise, you could publish it to a specified folder of your choice which comes with an installation, which would be good if you wanted to distribute it quickly
EDIT:
Everytime you build your project in VS, the exe is updated with the new one according to the code (as long as it builds without errors). When you publish it, you can choose the location, aswell as other factors, and the setup exe will be in that location, aswell as some manifest files and other files about the project.
Click BUILD > Configuration Manager...
Under Project contexts > Configuration, select "Release"
BUILD > Build Solution or Rebuild Solution
Just click on "Build" on the top menu and then click on "Publish ".... Then a pop up will open and there u can define the folder which u want to save the .exe file and by clicking "Next" will allow u to set up the advanced settings...
DONE!
Do ctrl+F5 to compile and run your project without debugging. Look at the output pane (defaults to "Show output from Build"). If it compiled successfully, the path to the .exe file should be there after {projectname}.vcxproj ->

LINK : fatal error LNK1104: cannot open file 'MSVCRTD.lib'

I'm a novice C++ developer. I encontered the error message indicates "LINK :fatal error LNK1104: cannot open file 'MSVCRTD.lib'" while I'm trying to debug every single project in Microsoft Visual C++ 2010 Express. I searched on Stack overflow and Google for any possible resolution, but I couldn't find exact and precise answer. What I have understood is that the "msvcrtd.lib" file should be in "\Microsoft Visual Studio 10.0\VC\lib", but that file is not there in my case. What should I do?
For the poor souls out there who are struggling with this, after an hour of research I found a solution for my Visual Studio Enterprise 2017:
First, lets find where is your library file located:
With windows explorer, go to your directory where Visual Studio is installed, (default: C:\Program Files (x86)\Microsoft Visual Studio) and do a search for msvcrtd.lib
I found mine to be in here:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\lib\onecore\x86
Quick Fix (for one project only):
Right click on your project, click on properties, navigate to Linker, add that path to Additional Library Directories
Permanent Fix (for all projects)
Open a project
navigate to View > Property Manager (it could be under Other Windows)
Expand all folders and multi select all "Microsoft.cpp.Win32.user" & "Microsoft.cpp.64.user"
Right click and go to properties
Navigate to VC++ Directories
Add the path to default Library Directories
Go to your project properties, select Linker from left. Add this to "Additional Library Directories":
"(Your Visual Studio Path)\VC\lib"
For example:
C:\Program Files\Microsoft Visual Studio 10.0\VC\lib
I came across this problem when compiling a sample app using VS2017
Hope this will help
There is a check box that says "Inherit from parent or project defaults" in some of the property dialogs in Project Properties. Make sure that check box is checked for your Include and Library directories property windows and of course for your Additional Dependencies window.
If you use VS2017, please read it. Or just ignore this answer...It may be invalid for other VS version.
Do not trust anyone who told you to add lib path.
Here's suggestions:
[BEST] You just need to install these via VS_installer (most of us just need x86/x64 version below)
VC++ 2017 version version_numbers Libs for Spectre [(x86 and x64) | (ARM) | (ARM64)]
Visual C++ ATL for [(x86/x64) | ARM | ARM64] with Spectre Mitigations
Visual C++ MFC for [x86/x64 | ARM | ARM64] with Spectre Mitigations
[NAIVE] or disable Spectre Option for every Solution
(Why We are so hard to global disable it)
[LAUGH] Or never use VS2017
This is VisualStudioTeam's fault and Microsoft is guilty.
Why?
You can't make a global configuration to disable /QSpectre, and IDK when and why VS2017 enable it in one day. So the best way is install Spectre? ahhha?
For VS 2019, Spectre Mitigation is enabled by default.
So the right way to fix the issue would be to install VC++ Libs for Spectre.
But, to quickly resolve the issue, you may disable Spectre Mitigation
Project Properties -> C/C++ -> Code Generation -> Spectre Mitigation -> Disabled
https://devblogs.microsoft.com/cppblog/spectre-mitigations-in-msvc/
I ran into this issue. The file existed on my machine, it was in the search path. I was stumped as the error result is really unhelpful. In my case I had turned on Spectre mitigation, but had not downloaded the runtime libs for Spectre. Once I did the download all was right with the world. I had to get this installed on my CI build servers also, as these libs are not installed with VS by default.
I have solved this problem, you need install all spectre lib.
Vistual Studio Installer->Modify->Component->Any spectre lib.
This solution can be adapted to any project.
For me this issue happens after installing the (Windows Driver Kit): https://learn.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk
Uninstalling it fixes the problem. Just posting here as a related issue for people looking for solutions: After installing WDK VC++ is broken
Scenario:
Windows 10 with Visual Studio 2017 (FRESH installation).
'C' project (LINK : fatal error LNK1104: cannot open file 'MSVCRTD.lib').
Resolve:
Run 'Visual Studio Installer'.
Click button 'Modify'.
Select 'Desktop development with C++'.
From "Installation details"(usually on the right-sidebar) select:
4.1. VC++ 2015.3 v14.00(v140) toolset for desktop.
Version of 'toolset' in 4.1. is just for example.
Click button 'Modify', to apply changes.
Right-click 'SomeProject' -> 'Properties' ->
'Linker' ->
'General' ->
'Additional Library Directories': $(VCToolsInstallDir)\lib\x86
(!!! for x64 project: 'Additional Library Directories': $(VCToolsInstallDir)\lib\x64 !!!)
it is also worth checking that MSVCRTD.lib file is present in "C:\Program Files\Microsoft Visual Studio 10.0\VC\lib" for x64 and in C:\Program Files(x86)\Microsoft Visual Studio 10.0\VC\lib for 32 bit. Sometimes VS might not be installed properly OR these files might get deleted accidentally.
I just had this error, in my case rebuilding the project while doing nothing else worked for me.
Here's my situation
Visual studio crashed and I had to re-install and my new installation path is different than the previous one. then I had this error
the error showed that the library is located at
D:\program\Microsoft Visual Studio\...
while it should be
D:\program files\Microsoft Visual Studio\...
as I said I just rebuilt it and it worked for me and if you have a multi-solution project you have to rebuild the whole-solution
I solved the problem by adding #using <mscorlib.dll> in the main file
This indicates that Visual Studio wasn't able to find the lib (Library) directory which contains msvcrtd.lib.
IMPORTANT: This lib directory also contains linkers required during the compilation process.
So, all you need to do is override the Library Directory location. You can do so with the help of Environment Variables.
I referred to this StackOverflow Post for help. As per the answer posted, the Environment Variable LIB refers to the path where the Linker Libraries are located. Why is this method better? Because this will apply to all the projects instead of just a particular project. Also, you don't need to download anything extra. It just works...
Follow the steps below to achieve this:
STEP-1: Search for "msvcrtd.lib" in the search bar.
STEP-2: Click "Open File Location" (available in context menu)
STEP-3: Copy the address of the directory from the address bar.
STEP-4: Search "Environment" in the taskbar and click on "Edit the system environment variables".
STEP-5: Click on "Environment Variables..." button.
STEP-6: Under "System variables" section, click on "New..." button. A dialog would pop up.
STEP-7: In the dialog box, enter the following:
Variable name: LIB
Variable value: [The directory you copied in "STEP-3"]
And press "OK"
Now, you are all done!
The above answer was not quite accurate for me. I have VS2010 Ultimate installed and the file in question is not in my Visual Studio 10.0\VC folder. Rather I found it in the Visual Studio 9.0\VC folder. So if that's the case for anyone, follow the lead to change the Linker but use the Visual Studio 9.0\VC folder instead. It worked for me.
For Visual Studio 2017
Go to your project properties, select Linker from left. Add this to "Additional Library Directories":
C:\Program Files (x86)\Microsoft Visual Studio\Shared\14.0\VC\lib
I got a slightly different error
LNK1104 cannot open file 'MSVCURTD.lib'
Note it is msvcUrtd (not msvcrtd), but the file is not found on my system.
Solved it by setting the following options:
Project Properties
General
Character Set: Not Set
Common Language Runtime Support: Common Language Runtime Support (/clr)
Hope that helps.
In VS2017 (Community/Enterprise/Ultimate/Professional):
Add the path(s) of the folder(s) which include your desired ".lib" file(s) in the following path in VS:
(Right Click)Project(in Solution Explorer)->Properties->Configuration Properties->Linker->General->Additional Library Directories
If there are more than one ".lib" file use ';' to separate them otherwise click on the edit box corresponds to "Additional Library Directories" then click on "" in drop down menu and add all desired ".lib" files in newly opened window one by one and in a easy to handle manner.
I ran into this using Visual Studio 2017. I tried the solutions suggested here with explicitly adding paths to where the 'MSVCRT.lib' file was located. But I felt this probably wasn't the correct approach because previously for the past several weeks this had not been a problem with my project.
After trial and error, I discovered that if I left an empty or blank value in the Linker --> Input section, it would give me the error about LNK1104: cannot open file 'MSVCRT.lib'. Eventually I figured out that I should leave this value there instead.
On the Visual Studio project, right-Clicking on the project item in the Solution explorer panel (not the Solution itself, which is the topmost item), then select Properties. From there do the following:
Linker --> Input : %(AdditionalDependencies)
This additional information might be helpful, if you got into the situation the same way I did. I have discovered that I should not put any non-system library paths in the Linker --> Input section. With my project I was trying to compile with external .lib files. Previously I had a value in this input section like: $(ProjectDir)lib; %(AdditionalDependencies) but this lead to other problems. I discovered the correct place (it seems so far) to put paths for referencing external .lib files in a C/C++ project in Visual Studio 2017 is here:
VC++ Directories --> Library Directories : $(ProjectDir)lib; $(LibraryPath)
Note the $(LibraryPath) value will include extra values such as inherited from parents. My folder project contained a folder called 'lib' which is why I had the first value there before the semicolon.
I have included the following path
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x86
and
C:\local\boost_1_64_0\lib64-msvc-14.1
To
project properties-> linker-> Additional Directories
Click here : Image shows linking of boost and MSVC2017