Visual Studio 2017 MSBuild failed to build Azure Functions - azure

I have created azure functions using Visual Studio 2017(Professional Edition), I can successfully build the azure function within visual studio,
But I have a requirement where I have to build and create package without visual studio 2017, so I have tried to build the azure functions from MSBuild 2017 referring the link : https://blogs.technet.microsoft.com/livedevopsinjapan/2017/09/12/build-and-deploy-azure-functions-without-using-visual-studio-2017/
MSBuild Command :
"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\msbuild.exe" "Telemetry.sln" /nologo /nr:false /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="WebApp.zip" /p:DeployIisAppPath="Default Web Site" /t:"Telemetry:Clean;Build";"Telemetry_Test:Clean;Build" /p:platform="any cpu" /p:configuration="release" /p:VisualStudioVersion="15.0"
Executed above command and it failed to build azure functions
C:\..\MyFunctionAppTest>"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\msbuild.exe" "MyFunctionAppTest.sln" /nologo /nr:false /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="WebApp.zip" /p:DeployIisAppPath="Default Web Site" /t:"MyFunctionAppTest:Clean;Build" /p:platform="any cpu" /p:configuration="release" /p:VisualStudioVersion="15.0"
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 12/11/2017 6:57:19 AM.
Project "C:\..\MyFunctionAppTest\MyFunctionAppTest.sln" on node 1 (MyFunctionAppTest:Clean;Build target(s)).
ValidateSolutionConfiguration:
Building solution configuration "release|any cpu".
Project "C:\..\MyFunctionAppTest\MyFunctionAppTest.sln" (1) is building "C:\..\MyFunctionAppTest\MyFunctionAppTes
t\MyFunctionAppTest.csproj" (2) on node 1 (Clean;Build target(s)).
C:\..\MyFunctionAppTest\MyFunctionAppTest\MyFunctionAppTest.csproj : error MSB4236: The SDK 'Microsoft.NET.Sdk' spec
ified could not be found.
Done Building Project "C:\..\MyFunctionAppTest\MyFunctionAppTest\MyFunctionAppTest.csproj" (Clean;Build target(s)) -
- FAILED.
Done Building Project "C:\..\MyFunctionAppTest\MyFunctionAppTest.sln" (MyFunctionAppTest:Clean;Build target(s)) -- F
AILED.
Build FAILED.
"C:\..\MyFunctionAppTest\MyFunctionAppTest.sln" (MyFunctionAppTest:Clean;Build target) (1) ->
"C:\..\MyFunctionAppTest\MyFunctionAppTest\MyFunctionAppTest.csproj" (Clean;Build target) (2) ->
C:\..\MyFunctionAppTest\MyFunctionAppTest\MyFunctionAppTest.csproj : error MSB4236: The SDK 'Microsoft.NET.Sdk' sp
ecified could not be found.

Make sure to install the .NET Core workload in MS Build installation:
If it doesn't help, check other comments in this issue.

Related

Visual C++ 2017 link error due to -Ot flag?

I am trying to get a Visual Studio 2017 project to link, but I'm stuck on the following linker error:
LINK : fatal error C1007: unrecognized flag '-Ot' in 'p2'
I've read questions on what the cause could be, but I couldn't come to a solution for my project.
The details are that, due to an external component we have no control over (component A), this Visual Studio 2017 project is forced to use the v14.13 version of the C++ toolchain, i.e. not the latest one (v14.14). However, the latest release of another external precompiled static lib we have no control over either (component B), is built with the v14.14 version (I checked via a dumpbin extract of the debug version of the lib). Switching my project over to the v14.14 toolchain indeed makes the link error go away on component B, but this unfortunately isn't a solution for me due to component A. Taking an earlier version of component B isn't desirable either, since we need the functionality in the latest release...
However, what strikes me, is that the /Ot ("optimize for speed") flag has been around since the middle ages... Why wouldn't v14.13 recognize it? Or is it just an (awkwardly manifested) matter of a mismatched obj file layout due to the version differences? And, probably related, what does the 'p2' stand for anyway?
Update
I've checked the linker output by using the /verbose flag, and all seems normal (3600 lines of Searching <lib>, Found <function>, Referenced in <obj> and Loaded <lib>).
Right up until the end that is, where I get the following 6 lines:
1> Searching C:\PathToExternalLib\TheirStatic.lib:
1> Found UsedFunctionName
1> Referenced in MyOwnStatic.lib(MyOwnCompileUnit.obj)
1>LINK : fatal error C1007: unrecognized flag '-Ot' in 'p2'
1>LINK : fatal error LNK1257: code generation failed
1>Done building project "MyProject.vcxproj" -- FAILED.
And that's that.
When visiting the command line setting of the link properties of the project, the only thing listed is (broken up in separate lines for convenience):
/OUT:"MyProject.dll"
/MANIFEST
/NXCOMPAT
/PDB:"MyProject.pdb"
/DYNAMICBASE "C:\PathToMyStatic.lib"
/IMPLIB:"MyProject.lib"
/DLL
/MACHINE:X64
/PGD:"MyProject.pgd"
/MANIFESTUAC:"level='asInvoker' uiAccess='false'"
/ManifestFile:"MyProject.prm.intermediate.manifest"
/ERRORREPORT:PROMPT
/NOLOGO
/LIBPATH:"C:\PathToExternalStaticLib"
/LIBPATH:"C:\PathToAnotherExternalStaticLib"
/TLBID:1
So no trace of any -Ot flag there as well...?
I had this problem. LINK : fatal error C1007: unrecognized flag '-Ot' in 'p2'
while building a project with Visual Studio 2015.
I had to rebuild any library or sub library the project linked to which were built with Visual Studio 2017.
Once I rebuild the dependent libraries with Visual Studio 2015 the first project was able to link against them.
project
--------\
---------lib1(unable to rebuild lib1 until its dependencies were also rebuilt with VS2015
--------------\lib_linked_by_lib1_which_was_build_with_VS2017_and_had_to_be_rebuilt
--------------\another_lib_which_had_to_be_rebuilt_for_lib1_with_VS2015
--------\lib2
--------\lib3

MSB4062 in Visual Studio 2017 while Compiling a starter Visual C++ project

I am getting the following build error while compiling my project. The whole error can be seen below
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(181,5): error MSB4062: The "GetOutOfDateItems" task could not be loaded from the assembly C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.Build.CppTasks.Common.dll. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask
This error happens every time I start building the project(even the basic Visual C++ project on VS2017). Please help !

Installshield LE TFS Build succeeds but does not produce output

I have a solution in Visual Studio 2012 which contains multiple projects - a web application, some class libraries, a couple of database projects and an Installshield LE 2013 project.
If I build the solution for Release, locally, the ISLE project creates and outputs a setup.exe and associated msi etc. However, if I build the solution with Release configuration through TFS 2013 build automation, the build succeeds, produces outputs for all projects and drops them in the drop location with the exception of the ISLE project. No setup.exe and no .msi files are created on the build machine. The tail end of the build log is included below on Detailed mode:
I modified my islproj file to include an AfterGet target as suggested by This Post to avoid the -2200 error described there, and you can see this target in the log in case you are wondering why it's there...
How can I ask the build agent to actually compile my installer?
....omitted other projects build logging....
Task "MSBuild"
Global Properties:
Configuration=SingleImage
Platform=
BuildingSolutionFile=true
CurrentSolutionConfigurationContents=<SolutionConfiguration>
<ProjectConfiguration Project="{0D638421-Bxx3-43BC-A6F1-8992DB9770C8}" AbsolutePath="C:\Builds\1\PROJECTNAME\PROJECTNAME Release Build\src\PROJECTNAME\Trunk\PROJECTNAME\PROJECTNAME\PROJECTNAME.csproj" BuildProjectInSolution="True">Release|x86</ProjectConfiguration>
<ProjectConfiguration Project="{A31FE3AA-Fxx6-4AAB-B934-750C0F1C6013}" AbsolutePath="C:\Builds\1\PROJECTNAME\PROJECTNAME Release Build\src\PROJECTNAME\Trunk\PROJECTNAME\PROJECTNAME.Reports\PROJECTNAMEReportsLibrary.csproj" BuildProjectInSolution="True">Release|x86</ProjectConfiguration>
<ProjectConfiguration Project="{D8CD6EA6-5xx2-44E2-B3C1-954E1DF99303}" AbsolutePath="C:\Builds\1\PROJECTNAME\PROJECTNAME Release Build\src\PROJECTNAME\Trunk\PROJECTNAME\PROJECTNAME.Database\PROJECTNAME.Database.sqlproj" BuildProjectInSolution="True">Release|x86</ProjectConfiguration>
<ProjectConfiguration Project="{BA6453AD-DxxB-466C-9579-BF631B75C2E8}" AbsolutePath="C:\Builds\1\PROJECTNAME\PROJECTNAME Release Build\src\PROJECTNAME\Trunk\PROJECTNAME\PROJECTNAMEImport.Database\PROJECTNAMEImport.Database.sqlproj" BuildProjectInSolution="True">Release|x86</ProjectConfiguration>
<ProjectConfiguration Project="{951766F3-1xx0-40A4-80D7-1FEDDD922A4E}" AbsolutePath="C:\Builds\1\PROJECTNAME\PROJECTNAME Release Build\src\PROJECTNAME\Trunk\PROJECTNAME\PROJECTNAME.Tests\PROJECTNAME.Tests.csproj" BuildProjectInSolution="True">Release|x86</ProjectConfiguration>
<ProjectConfiguration Project="{45370F77-9xx5-4689-8236-B6DBECE591D9}" AbsolutePath="C:\Builds\1\PROJECTNAME\PROJECTNAME Release Build\src\PROJECTNAME\Trunk\PROJECTNAME\PROJECTNAME.Setup.Full\PROJECTNAME.Setup.Full.isproj" BuildProjectInSolution="True">SingleImage<ProjectDependency Project="{0D638421-Bxx3-43BC-A6F1-8992DB9770C8}" /><ProjectDependency Project="{147B816F-2xxA-4FA9-873E-47615DCFAFFA}" /><ProjectDependency Project="{A31FE3AA-FAF6-4AAB-Bxx4-750C0F1C6013}" /></ProjectConfiguration>
<ProjectConfiguration Project="{147B816F-2xxA-4FA9-873E-47615DCFAFFA}" AbsolutePath="C:\Builds\1\PROJECTNAME\PROJECTNAME Release Build\src\PROJECTNAME\Trunk\PROJECTNAME\PROJECTNAME.Setup.Files\PROJECTNAME.Setup.Files.csproj" BuildProjectInSolution="True">Release|x86</ProjectConfiguration>
</SolutionConfiguration>
SolutionDir=C:\Builds\1\PROJECTNAME\PROJECTNAME Release Build\src\PROJECTNAME\Trunk\PROJECTNAME\
SolutionExt=.sln
SolutionFileName=PROJECTNAME.sln
SolutionName=PROJECTNAME
SolutionPath=C:\Builds\1\PROJECTNAME\PROJECTNAME Release Build\src\PROJECTNAME\Trunk\PROJECTNAME\PROJECTNAME.sln
9>Project "C:\Builds\1\PROJECTNAME\PROJECTNAME Release Build\src\PROJECTNAME\Trunk\PROJECTNAME\PROJECTNAME.Setup.Full\PROJECTNAME.Setup.Full.isproj.metaproj" (9) is building "C:\Builds\1\PROJECTNAME\PROJECTNAME Release Build\src\PROJECTNAME\Trunk\PROJECTNAME\PROJECTNAME.Setup.Full\PROJECTNAME.Setup.Full.isproj" (10) on node 1 (default targets).
10>Building with tools version "3.5".
10>Target "AfterGet" in project "C:\Builds\1\PROJECTNAME\PROJECTNAME Release Build\src\PROJECTNAME\Trunk\PROJECTNAME\PROJECTNAME.Setup.Full\PROJECTNAME.Setup.Full.isproj" (entry point):
Using "Exec" task from assembly "Microsoft.Build.Tasks.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "Exec"
Command:
attrib -r "C:\Builds\1\PROJECTNAME\PROJECTNAME Release Build\src\PROJECTNAME\Trunk\PROJECTNAME\PROJECTNAME.Setup.Full\PROJECTNAME.Setup.Full.isl"
Done executing task "Exec".
10>Done building target "AfterGet" in project "PROJECTNAME.Setup.Full.isproj".
10>Done Building Project "C:\Builds\1\PROJECTNAME\PROJECTNAME Release Build\src\PROJECTNAME\Trunk\PROJECTNAME\PROJECTNAME.Setup.Full\PROJECTNAME.Setup.Full.isproj" (default targets).
9>Done executing task "MSBuild".
9>Done building target "Build" in project "PROJECTNAME.Setup.Full.isproj.metaproj".
9>Done Building Project "C:\Builds\1\PROJECTNAME\PROJECTNAME Release Build\src\PROJECTNAME\Trunk\PROJECTNAME\PROJECTNAME.Setup.Full\PROJECTNAME.Setup.Full.isproj.metaproj" (default targets).
1>Done executing task "MSBuild".
1>Done building target "Build" in project "PROJECTNAME.sln".
1>Done Building Project "C:\Builds\1\PROJECTNAME\PROJECTNAME Release Build\src\PROJECTNAME\Trunk\PROJECTNAME\PROJECTNAME.sln" (default targets).
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:02:02.06

Cmake Visual Studio 2013 error

I am trying to run a simple program through cmake gui and I receive the following output. I am not really sure what the problem is and forgive me, because I am quite new to this. I have also uninstalled and installed visual studio 2012 and 2013 to see if that would make a difference. I am using Visual Studio 2013 as the compiler and get the following configuration error.
My environment is :
Windows 7 enterprise 64 bit
Cmake gui 2.8.12.2
Visual Studio 2013 Professional
The C compiler identification is MSVC 18.0.21005.1
The CXX compiler identification is MSVC 18.0.21005.1
Check for working C compiler using: Visual Studio 12
Check for working C compiler using: Visual Studio 12 -- broken
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "C:/Program Files (x86)/Microsoft Visual Studio
12.0/VC/bin/cl.exe" is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/PM&R/Desktop/CMakeFiles/CMakeTmp
Run Build Command:C:\PROGRA~2\MSBuild\12.0\Bin\MSBuild.exe
cmTryCompileExec3676669247.vcxproj /p:Configuration=Debug
/p:VisualStudioVersion=12.0
Microsoft (R) Build Engine version 12.0.21005.1
[Microsoft .NET Framework, version 4.0.30319.18444]
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 3/31/2014 2:27:43 PM.
Project
"C:\Users\PM&R\Desktop\CMakeFiles\CMakeTmp\cmTryCompileExec3676669247.vcxproj"
on node 1 (default targets).
C:\Users\PM&R\Desktop\CMakeFiles\CMakeTmp\cmTryCompileExec3676669247.vcxproj(60,85):
error MSB4025: The project file could not be loaded. An error occurred
while parsing EntityName. Line 60, position 85.
Done Building Project
"C:\Users\PM&R\Desktop\CMakeFiles\CMakeTmp\cmTryCompileExec3676669247.vcxproj"
(default targets) -- FAILED.
Build FAILED.
"C:\Users\PM&R\Desktop\CMakeFiles\CMakeTmp\cmTryCompileExec3676669247.vcxproj"
(default target) (1) ->
C:\Users\PM&R\Desktop\CMakeFiles\CMakeTmp\cmTryCompileExec3676669247.vcxproj(60,85): error MSB4025: The project file could not be loaded. An error occurred while parsing EntityName. Line 60, position 85.
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.02
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
Configuring incomplete, errors occurred!
See also "C:/Users/PM&R/Desktop/CMakeFiles/CMakeOutput.log".
See also "C:/Users/PM&R/Desktop/CMakeFiles/CMakeError.log".
Try to generate build system in the folder C:/Tmp to test if the problem is related to corrupted cache or path issues. To build it to the folder stated in the question:
Check that you do have write permission in "PM&R" personal folders
Remove cmake cache when you change the generator

Release Build Linker Failure

I just finished my project and tried building it in Release for the first time. I've had previous issues with the Windows 7 SDK and the Common7 stuff located in program files(ie they were missing and I had to install them from msdn).
The build is complaining :
1>LINK : fatal error C1350: error loading dll 'msobj110.dll': dll not found
1>Block.obj : fatal error LNK1000: unknown error at 00A14372; consult documentation for technical support options
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Yet I looked at :
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE
I have the same folder under C:\Program Files..., and IDE is almost empty; doesn't have the ms libraries.
How can I know where Visual Studio picks these dll from? I'm using VS2012.

Resources