DotNet\Microsoft.DotNet.Props" was not found - visual-studio

I have a project .sln which i want to build inside Visual studio community 2019, but when i do so , i get this error:-
Severity Code Description Project File Line Suppression State
Error MSB4226 The imported project "C:\Program Files (x86)\Microsoft
Visual
Studio\2019\Community\MSBuild\Microsoft\VisualStudio\v16.0\DotNet\Microsoft.DotNet.Props"
was not found. Also, tried to find "DotNet\Microsoft.DotNet.Props" in
the fallback search path(s) for $(VSToolsPath) - "C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v16.0" . These search paths are
defined in "C:\Program Files (x86)\Microsoft Visual
Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe.Config". Confirm
that the path in the declaration is correct, and that the
file exists on disk in one of the search
paths. C:\c\tree\master\cloud\src\Helper
Utilities\Microsoft.Legal.MatterCenter.HelperUtilities\Microsoft.Legal.MatterCenter.HelperUtilities.sln C:\c\tree\master\cloud\src\Helper
Utilities\Microsoft.Legal.MatterCenter.HelperUtilities\Microsoft.Legal.ProjectCenter.UpdateProjectName\Microsoft.Legal.ProjectCenter.UpdateProjectName.xproj 8
Although i have installed .net core SDK, and i have this version for it:-
C:\WINDOWS\system32>dotnet --version
6.0.301
so why i am getting this error?

Related

How to build Lua with Visual Studio 2019?

I am trying to build Lua (version 5.3.5) with Visual Studio 2019. For this, I am following the instructions given here. The steps that I have followed are as follows:
Set up environment variables as mentioned below
UTIL_DIR = C:\Program Files\utility
LUA_DIR = C:\Program Files\lua\5.3
LUA_CPATH = ?.dll;%LUA_DIR%\?.dll
LUA_PATH = ?.lua;%LUA_DIR%\?.lua
SDK_DIR = Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133
INCLUDE = %SDK_DIR%\include;%SDK_DIR%\include\usr
LIB = %SDK_DIR%\lib;%SDK_DIR%\lib\usr
Created the folders required, as mentioned in the environment variables
C:\Program Files\utility
C:\Program Files\lua\5.3
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\usr
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\lib\usr
Added C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin to the environment path variables
Downloaded lua-5.3.5 from here, untarred it and stored in C:\dev\
Added the build.bat file given in this image in C:\dev\lua-5.3.5\src\folder with the 5.1s replaced by 5.3s
In the command prompt, executed the command C:\dev\lua-5.3.5\src>build
I am getting error for every line of build.bat. The entire error screen is shown here.
Please tell me what is going wrong and how to resolve that.
**P.S. - ** I think my SDK_DIR variable is not pointing to the correct folder.
However, I don't know what the correct folder should be. There are
many bin, include and lib directories in Microsoft Visual Studio\2019\Community\.

Cannot open file 'pgort.llib' after adding /GENPROFILE flag

I'm trying to follow the instructions here to add PGO for my project. After I added the /GENPROFILE flag, I start getting the link error:
LINK : fatal error LNK1104: cannot open file 'pgort.lib'
After debugging it a bit, I believe the problem is that my Library Directories (found under VC++ Directories tab) has a value of $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64) which is evaluating to:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\lib\spectre\x64
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\atlmfc\lib\spectre\x64
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\VS\lib\x64
C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x64
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\VS\UnitTest\lib
C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\um\x64
C:\Program Files (x86)\Windows Kits\NETFXSDK\4.7.2\lib\um\x64
It looks like the .\spectre\x64 paths don't have the pgort.lib library, but the non-spectre path does:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\lib\x64
What do I do to fix this? I find it hard to believe that if I'm using the spectre binaries (which I am not even sure how/why I am in the first place) that I can't optimize my project.
BTW, I tried this on a machine with Enterprise VS installed and it's the same. So this isn't specific to Community edition.
I ended up updating my build configuration/scripts to dynamically update the LibraryPath to add the appropriate, architecture-specific version of $(VC_LibraryPath_VC_x64_Desktop) when compiling for PGO.

MSBuild with VS 2017 BuildTools set wrong $(VSInstallDir) at build time

I am seeing some weird behavior with the latest 15.8.2 Visual Studio 2017 Build Tools. After installing the tools and ensuring that it has installed all workloads and components, I attempted to build our master solution from a batch file with the following command:
msbuild %~dp0\..\..\Master.sln /verbosity:quiet /ds /p:Configuration=Debug;Platform=x64 /m /fl1 /fl2 /fl3 /flp1:LogFile="%~dp0\MSBuild.log";Verbosity=normal /flp2:LogFile="%~dp0\ProjectWarnings.log";WarningsOnly /flp3:LogFile="%~dp0\ProjectErrors.log";ErrorsOnly
One of the very first projects fails with the following error:
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\TextTemplating\Microsoft.TextTemplating.targets(340,5): error : System.IO.FileNotFoundException: Could not find a part of the path 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\140\Microsoft.SqlServer.TransactSql.ScriptDom.dll'.
If you'll notice, the path that can't be found is looking for the "Enterprise" directory, which obviously doesn't exist because we installed the Build Tools. The .dll in question is there in the correct directory, just under the "BuildTools" folder and not "Enterprise". In the project itself, we have this line for the above .dll:
<HintPath>$(VSInstallDir)\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\140\Microsoft.SqlServer.TransactSql.ScriptDom.dll</HintPath>
When looking at a developer command prompt on the system with just the Build Tools installed, running set, the variable VSInstallDir maps correctly to the BuildTools folder:
VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\
My question is this: where in the world is MSBuild getting the "Enterprise" directory from? We are not referencing it in ANY project, instead using $(VSInstallDir) when necessary. I have grepped the entire BuildTools directory for references to "Enterprise" and I'm finding nothing in .targets files or .props (or really any other files) that would indicate the variable would resolve to "Enterprise" rather than "BuildTools".

Visual Studio Team Services build process cannot find CSharp targets file

I'm trying to set up a build process in Visual Studio Team Services, and I've done so by following the steps for UWP projects using an agent on my box, but I keep getting the following build errors:
C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v12.0\Microsoft.Windows.UI.Xaml.CSharp.targets(7,3): Error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v12.0\10.0.10240.0\Microsoft.Windows.UI.Xaml.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
I checked out the path the build is complaining about and the problem is in the 10.0.10240.0 in the path:
C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v12.0\10.0.10240.0\Microsoft.Windows.UI.Xaml.CSharp.targets
The target file is located in
C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v12.0\Microsoft.Windows.UI.Xaml.CSharp.targets
Here is how the declaration in the project file looks like (I don't think it is erroneous and I don't see where this weird 10.0.10240.0 version comes from in the path):
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
Any suggestions on what could be wrong and how can I fix that?
The Universal Windows Platform was introduced in Windows 10. Visual Studio has support for UWP apps as of Visual Studio 2015. You need to use VS2015 to create a UWP project, and install VS2015 on your build agent machine.

Error Code -1073741515 When Using EDITBIN

I'm using EditBin to increase the stack size of an application I'm writing. I have this in the post-build event command line for Visual Studio:
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\editbin.exe" /STACK:268435456 "$(TargetPath)"
When I build my project, I get this error:
Error 470 The command ""C:\Program
Files (x86)\Microsoft Visual Studio
10.0\VC\bin\editbin.exe" /STACK:268435456 "[Target Executable]"" exited
with code -1073741515.
I have both of the following in my PATH environment variable:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin
The command also works when I run it manually with cmd.exe. Does anyone know what the problem is here?
I had the same issue, how I resolved it:
Ran msbuild.exe <my.sln> /t:<mytargetproject> from a VS2010 command prompt, where <my.sln> is your solution name and <mytargetproject> is the project you are trying to build. For e.g. msbuild.exe helloworld.sln /t:mainproj.
When you do this or at least when I ran this, a dialog box popped up and said "foo.dll" cannot be found, I added the path of that dll to my "PATH" environment variable and the problem was solved! See ChrisF's comment to the question, as it says, the error is that some dll/component is missing.
From the dll name it complained about, I believe this is not contained to VS2010 libs/dlls, for me it was a third-party dll (which I am using and supposed to be available during the build) it was complaining about.
The best solution is to run the vcvarsall.bat located in the root of the visual studio install folder(C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC). That sets up the search folders for all MSVC compiler related tools.
I got this to work for now by copying mspdb100.dll into the same directory as editbin.exe, but this is not an optimal solution because every developer on my team will need to do the same thing.

Resources