How to define where msbuild looks for packages? - msbuild

I'm trying to build a solution from command line. This involves 3 steps:
nuget install
nuget restore
msbuild
I am using a NuGet.Config files that specifies where the nuget packages are cached to, and also where the restored packages are added.
The command nuget restore does not work, nor does it provide a helpful error message other than 'the solution can't be built'. Another answer on StackOverflow helpfully recommended to run the msbuild command and see what the error is.
It would seem that files installed via nuget are not found during msbuild (or apparently nuget restore). This is the log from msbuild for every single assembly other than what is found in GAC:
Primary reference "NTRPRS.NLog.Slack".
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\bin\Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "NTRPRS.NLog.Slack". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\Avesta\Services\Dashboard\src\Avesta.DashboardService.csproj]
For SearchPath "{HintPathFromItem}".
Considered "..\..\..\..\AppData\Roaming\NuGet\packages\NTRPRS.NLog.Slack.5.0.4\lib\net45\NTRPRS.NLog.Slack.dll", but it didn't exist.
For SearchPath "{TargetFrameworkDirectory}".
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\NTRPRS.NLog.Slack.exe", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\NTRPRS.NLog.Slack.exe", but it didn't exist.
For SearchPath "{Registry:Software\Microsoft\.NETFramework,v4.5,AssemblyFoldersEx}".
Considered AssemblyFoldersEx locations.
For SearchPath "{AssemblyFolders}".
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\NTRPRS.NLog.Slack.exe", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft.NET\ADOMD.NET\130\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft.NET\ADOMD.NET\130\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft.NET\ADOMD.NET\130\NTRPRS.NLog.Slack.exe", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft SQL Server\130\SDK\Assemblies\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft SQL Server\130\SDK\Assemblies\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft SQL Server\130\SDK\Assemblies\NTRPRS.NLog.Slack.exe", but it didn't exist.
Considered "C:\Program Files\IIS\Microsoft Web Deploy V3\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "C:\Program Files\IIS\Microsoft Web Deploy V3\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "C:\Program Files\IIS\Microsoft Web Deploy V3\NTRPRS.NLog.Slack.exe", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft SQL Server\140\SDK\Assemblies\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft SQL Server\140\SDK\Assemblies\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft SQL Server\140\SDK\Assemblies\NTRPRS.NLog.Slack.exe", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\NTRPRS.NLog.Slack.exe", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft.NET\ADOMD.NET\140\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft.NET\ADOMD.NET\140\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft.NET\ADOMD.NET\140\NTRPRS.NLog.Slack.exe", but it didn't exist.
For SearchPath "{GAC}".
Considered "NTRPRS.NLog.Slack", which was not found in the GAC.
For SearchPath "{RawFileName}".
Considered treating "NTRPRS.NLog.Slack" as a file name, but it didn't exist.
For SearchPath "bin\Debug\".
Considered "bin\Debug\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "bin\Debug\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "bin\Debug\NTRPRS.NLog.Slack.exe", but it didn't exist.
How can I specify to msbuild where assemblies installed by nuget are? Also.... why is nuget restore failing? The message I get from nuget restore is:
C:\<path>\src>nuget restore
Error parsing solution file at C:\<path>\src\<name>.sln: Exception has been thrown by the target of an invocation.
The project file could not be loaded. Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
The system cannot find the file specified. C:\<path>\src\<name>.sln
using:
MSBuild auto-detection: using msbuild version '15.7.177.53362' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\bin'.
As far as I can tell, the nuget error output is completely nonsensical. The absolute path C:\<path>\src\<name>.sln absolutely does exist.

This is a problem that only surfaced after 15.7.0 of Visual Studio / MSBuild.
NuGet already has an open issue for this problem: https://github.com/NuGet/Home/issues/6918
The current workaround is to install .NET 4.7.1 until the problem is fixed, because that will install the missing library in the Global Assembly Cache.

Related

"Restore failed" for Rider's Template Project

I have a problem with my brand new instance of JetBrains Rider. After downloading it and creating the template project "ASP .NET Web Application" I get the following error message when trying to download NuGet packages:
Restore failed
Restore failed for 14 packages in 1 project
The log is
[Notification][Restore] Restore failed
Restore failed for 14 packages in 1 project
The packages/ folder does not exist.
I installed a couple of other programms (like the .NET Framework and even Visual Studio), I downloaded the nuget.exe and put it in the PATH environment variable. I moved the project around the hard drive because maybe Rider needs special permissions and even created the folder. Nothing helped so far.
When I type nuget restore manually, I get the following essage:
nuget : Errors in packages.config projects
At line:1 char:1
+ nuget restore
+ ~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Errors in packages.config projects:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Unable to find version '3.5.0.2' of package 'Antlr'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Antlr.3.5.0.2' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
Unable to find version '1.17.0' of package 'jQuery.Validation'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'jQuery.Validation.1.17.0' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
Unable to find version '3.3.1' of package 'jQuery'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'jQuery.3.3.1' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
Unable to find version '3.4.1' of package 'bootstrap'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'bootstrap.3.4.1' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
Unable to find version '1.1.3' of package 'Microsoft.AspNet.Web.Optimization'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Microsoft.AspNet.Web.Optimization.1.1.3' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
Unable to find version '5.2.7' of package 'Microsoft.AspNet.Mvc'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Microsoft.AspNet.Mvc.5.2.7' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
Unable to find version '3.2.7' of package 'Microsoft.AspNet.Razor'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Microsoft.AspNet.Razor.3.2.7' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
Unable to find version '3.2.7' of package 'Microsoft.AspNet.WebPages'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Microsoft.AspNet.WebPages.3.2.7' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
Unable to find version '2.8.3' of package 'Modernizr'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Modernizr.2.8.3' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
Unable to find version '1.0.0' of package 'Microsoft.Web.Infrastructure'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Microsoft.Web.Infrastructure.1.0.0' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
Unable to find version '1.6.0' of package 'WebGrease'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'WebGrease.1.6.0' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
Unable to find version '3.2.11' of package 'Microsoft.jQuery.Unobtrusive.Validation'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Microsoft.jQuery.Unobtrusive.Validation.3.2.11' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
Unable to find version '2.0.0' of package 'Microsoft.CodeDom.Providers.DotNetCompilerPlatform'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
Unable to find version '11.0.1' of package 'Newtonsoft.Json'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Newtonsoft.Json.11.0.1' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
How can I fix this error message and download NuGet packages in Rider?
It seems downloading the nuget.exe and putting it in the PATH environment variable was correct. Additional, I had to add this to C:\Users<username>\AppData\NuGet\NuGet.config:
<configuration>
<!-- stuff -->
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<!-- other stuff -->
</packageSources>
</configuration>
Then I called nuget restore and the 14 packages were successfully downloaded. I haven't found a manual detailing this steps yet, so I'm not sure if more is missing.

MSBuild fails to copy dlls from relative path

Solution Directory contains ExtraDlls And Project Directories.
In the Project.csproj file we have references of dlls in the ExtraDlls with relative path. The Dlls in the ExtraDlls directory are always available.
<Reference Include="xyx, Version=7.3.0.0, Culture=neutral, PublicKeyToken=<sometoken>">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\ExtraDlls\A.dll</HintPath>
</Reference>
<Reference Include="xyz, Version=7.4.0.0, Culture=neutral, PublicKeyToken=<sometoken>">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\ExtraDlls\B.dll</HintPath>
<Private>True</Private>
</Reference>
Using below batch file to publish web project. But it fails with below mentioned details.
SET MSBUILD_PATH="C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\\Bin"
SET PUBLISH_DIRECTORY="C:\publish\ProjectA"
SET PROJECT_DIR="C:\SolutionDir\ProjectDir"
SET PROJECT="C:\SolutionDir\ProjectDir\Project.csproj"
cd %PROJECT_DIR%
%MSBUILD_PATH%\MSBuild.exe %PROJECT% /p:DeployOnBuild=True /p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=FileSystem /p:DeleteExistingFiles=True /p:publishUrl=%PUBLISH_DIRECTORY%
PreBuildEvent:
copy "..\ExtraDlls\A.dll" "C:\SolutionDir\ProjectDir\bin\"
copy "..\ExtraDlls\B.dll" "C:\SolutionDir\ProjectDir\bin\"
The system cannot find the path specified.
The system cannot find the path specified.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1328,5): error MSB3073: copy "..\ExtraDlls\A.dll" "C:\SolutionDir\ProjectDir\bin\" [C:\SolutionDir\ProjectDir\Project.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1328,5): error MSB3073: copy "..\ExtraDlls\B.dll" "C:\SolutionDir\ProjectDir\bin\" [C:\SolutionDir\ProjectDir\Project.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1328,5): error MSB3073: " exited with code 1.
Already tried with changing root directory in batch file. i.e. when root directory set with one containing MSBuild.exe, still getting the same issue.
Setting References updated with $(SolutionDir) didn't help.
e.g. $(SolutionDir)..\ExtraDlls\B.dll
There are many more references from ExtraDlls but showing error only for above two. Tried with changing relative path to absolute path in project.csproj file but still same error. So looks like it is being referenced from somewhere else.
In the project.csproj file, in the PreBuildEvent section the code is added if SolutionDir is not available then use ..\ (which visual studio can understand I guess) but MSBuild was throwing error or actually checking path starting with .\ which doesn't exist.
While using MSBuild.exe command pass a property /Property:SolutionDir="Path to solution file directory" which resolves all references and now getting all ExtraDlls copied correctly.
e.g.
MSBuild /Property:SolutionDir=%SOL_DIR_PATH% %PROJECT_SLN_PATH%\%PROJECT_DIRECTORY_NAME%\%PROJECT_NAME% /p:DeployOnBuild=True /p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=FileSystem /p:DeleteExistingFiles=True /p:publishUrl=%PUBLISH_DIRECTORY%\%PROJECT_DIRECTORY_NAME%

WebRTC not building for Windows too

Like in this question WebRTC not building for Windows, I can't build WebRTC on a Windows 7 64-bit with VS 2015 but the issue is different.
The fetch and gclient sync go well without error. But when I run the gn gen out/WebRTC, then I get the below error
ERROR at //third_party/protobuf/proto_library.gni:229:15: File is not inside out
put directory.
outputs = get_path_info(protogens, "abspath")
^---------------------------------
The given file should be in the output directory. Normally you would specify
"$target_out_dir/foo" or "$target_gen_dir/foo". I interpreted this as
"//out/Default/gen/webrtc/rtc_tools/event_log_visualizer/chart.pb.h".
See //webrtc/rtc_tools/BUILD.gn:184:3: whence it was called.
proto_library("chart_proto") {
^-----------------------------
See //BUILD.gn:16:5: which caused the file to be included.
"//webrtc/rtc_tools",
^-------------------
Traceback (most recent call last):
File "D:/temp/webrtc-checkout/src/build/vs_toolchain.py", line 459, in <module>
sys.exit(main())
File "D:/temp/webrtc-checkout/src/build/vs_toolchain.py", line 455, in main
return commands[sys.argv[1]](*sys.argv[2:])
File "D:/temp/webrtc-checkout/src/build/vs_toolchain.py", line 431, in GetTool
chainDir
win_sdk_dir = SetEnvironmentAndGetSDKDir()
File "D:/temp/webrtc-checkout/src/build/vs_toolchain.py", line 424, in SetEnvi
ronmentAndGetSDKDir
return NormalizePath(os.environ['WINDOWSSDKDIR'])
File "D:\temp\depot_tools\win_tools-2_7_6_bin\python\bin\lib\os.py", line 423,
in __getitem__
return self.data[key.upper()]
KeyError: 'WINDOWSSDKDIR'
I tried to add the variables mentioned in the above question but it didn't helped.
Any help would be greatly appreciated.
You need set LIB and INCLUDE in envirnment variables (windows sdk).
And set PATH to the correct version of python (I think that 2.7.6) too.
So your envirnment variables should be:
LIB=C:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\ucrt\x64;
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\um\x64
INCLUDE=C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\shared;
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt;
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\um;
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\winrt
PATH=C:\src\depot_tools\python276_bin\
Please mark if it worked
libwebrtc
I'm using libwebrtc from https://github.com/cloudwebrtc/libwebrtc-build where that compile is wrapped inside a CMake custom call and I tried to modify LIB/INCLUDE but you probably refer to the Visual Studio IDE variables (which the command line does not have or where it does not work as I expected it).
My conservative solution now is to print this message before the libwebrtc compile:
if(NOT EXISTS "C:/Program Files (x86)/Windows Kits/10/Redist/ucrt")
message("============================== C:/Program Files (x86)/Windows Kits/10/Redist/ucrt missing ==========================")
message("C:/Program Files (x86)/Windows Kits/10/Redist/ucrt can not be found")
message(" normally it contains files like /DLLs/x64/ucrtbase.dll and is required for libwebrtc to build")
message(FATAL_ERROR "Please copy the directory C:/Program Files (x86)/Windows Kits/10/Redist/10.0.18362.0/ucrt into C:/Program Files (x86)/Windows Kits/10/Redist/")
endif(NOT EXISTS "C:/Program Files (x86)/Windows Kits/10/Redist/ucrt")
Another would be to patch https://github.com/nareix/webrtc.build/blob/69e87f529e935111b2b8c774ce283366fa2157d0/vs_toolchain.py#L212 to (pseudocode):
ucrt_dll_dirs = os.path.join("C:/Program Files (x86)/Windows Kits/10/Redist/10.0.18362.0/", 'DLLs', target_cpu)
But since that python code is checked out from the libwebrtc and potentially overridden periodically I go with the manual solution.
xcopy (manual copy of files)
xcopy /Y /E /I "c:\Program Files (x86)\Windows Kits\10\Redist\10.0.18362.0\ucrt" "c:\Program Files (x86)\Windows Kits\10\Redist\
alternate discussions
All solutions proposed in https://bugs.chromium.org/p/webrtc/issues/detail?id=7677#c24 also failed for me.
wish
I just wish that the python devs would have spent this another environment variable where we could pass in the directory to look into. Or even better, why did Microsoft create such a crappy infrastructure in the first place -> on UNIX one could use a concept as 'pkg-config' for custom library detection.

FAKE MSBuild step can't resolve references

I have a FAKE build script which will run perfectly fine if I build the project once using VisualStudio, but if I try and do a fresh build then it throws errors saying it can't find the namespace of both a number of nuget packages and my dependant visual studio projects.
I'm using FAKE's MSBuildRelease and passing in the .sln file like so:
Target "BuildWindowsProject" (fun _ ->
MSBuildRelease
""
"Build"
[ "./Source/My.Project.sln" ]
|> Log "Windows-Build: "
)
It's giving out a number of errors such as below, but these include both projects within the solution and external nuget packages.
The type or namespace name 'Caliburn' could not be found (are you missing a using directive or an assembly reference?)
I did notice that back in 2011 this was posted - MSBuild cannot find a reference but it's quite old and I can't find any more recent occurrences of the issue online.
It works just fine if I do a visual studio build first and then run my build script but this doesn't solve the problem for a build server. What am I doing wrong?
You have to perform deep diagnostic by yourself, because the question under consideration requires the source code to be published here. It also can depend on the environment where the script is running, in order to get you the right answer.
You have an option on MSBuild utility to pass verbosity level of output. Use the following switch value to get detailed information about how the references are resolved during the build:
msbuild ./Source/My.Project.sln /t:Build /v:d
Using this command, you can navigate to the steps called ResolveAssemblyReference and ResolveProjectReference. You can see all the paths, where it will search for assemblies, and if it is succeded:
4> Primary reference "System.Runtime.Remoting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".
4> Resolved file path is "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Runtime.Remoting.dll".
4> Reference found at search path location "{TargetFrameworkDirectory}".
4> For SearchPath "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\lib\amd64".
4> Considered "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\lib\amd64\System.Runtime.Remoting.winmd", but it didn't exist.
4> Considered "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\lib\amd64\System.Runtime.Remoting.dll", but it didn't exist.
4> Considered "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\lib\amd64\System.Runtime.Remoting.exe", but it didn't exist.
4> For SearchPath "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64".
4> Considered "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64\System.Runtime.Remoting.winmd", but it didn't exist.
4> Considered "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64\System.Runtime.Remoting.dll", but it didn't exist.
4> Considered "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64\System.Runtime.Remoting.exe", but it didn't exist.
4> For SearchPath "{TargetFrameworkDirectory}".
4> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Runtime.Remoting.winmd", but it didn't exist.
4> This reference is not "CopyLocal" because it's a prerequisite file.
4> The ImageRuntimeVersion for this reference is "v4.0.30319".
You also can examine which references were passed to the compiler if you look at commandline, which was generated by MSBuild and find out if there is a reference you are required in.
For cl:
4> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\CL.exe
...
/AI"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0"
...
/FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll"
/FUE:\YourProj\bin\Debug\Your.Proj.dll
/FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Configuration.dll"
...
/errorReport:prompt
YourSourceCodeFiles.cpp
/clr:nostdlib
For csc:
2> C:\Program Files (x86)\MSBuild\12.0\bin\Csc.exe
...
/reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\mscorlib.dll"
/reference:E:\svn\PRM\trunk\PRM30\bin\Debug\Prm.Base.dll
/reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\System.Configuration.dll"
/reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\System.Core.dll"
...
(most of parameters were omited for simplicity)

TeamCity won't publish project using MsDeploy

I have msbuild command to publish my project (WCF Service Application) that looks as follow:
msbuild FooBar.Service.csproj /p:DeployOnBuild=true;
DeployTarget=MsDeployPublish;
MSDeployServiceUrl=http://server.pl/MSDeployAgentService;
DeployIisAppPath="Foobar";
MSDeployPublishMethod=RemoteAgent;
UserName=Joe;
password=secret;
and this works from VS Command Prompt, all is published without any errors. Please note, that I'm not specyfing any Target.
But I want to create my Deployment Project using TeamCity (7.1.5). I have done simple project, and Configuration with one Build Step:
The problem is that, when I'm running this Task, msbuild compiles my site but without publishing it to remote server. Below is the build log:
[16:13:16]Checking for changes
[16:13:18]Publishing internal artifacts
[16:13:18][Publishing internal artifacts] Sending build.start.properties.gz file
[16:13:18]Clearing temporary directory: C:\TeamCity\buildAgent\temp\buildTmp
[16:13:18]Checkout directory: C:\TeamCity\buildAgent\work\2eecf7b45f277a61
[16:13:18]Repository sources transferred
[16:13:18]Updating sources: server side checkout
[16:13:18]Starting: C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.MsBuildBootstrap.exe /workdir:C:\TeamCity\buildAgent\work\2eecf7b45f277a61 /msbuildPath:C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
[16:13:18]in directory: C:\TeamCity\buildAgent\work\2eecf7b45f277a61
[16:13:20]Foobar.csproj.teamcity: Build target: Build
[16:13:20][Foobar.csproj.teamcity] CoreCompile
[16:13:20][CoreCompile] Csc
[16:13:20][Csc] C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE /highentropyva+ /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Microsoft.CSharp.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Configuration.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Drawing.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.EnterpriseServices.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Runtime.Serialization.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.ServiceModel.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.ServiceModel.Web.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Web.ApplicationServices.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Web.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Web.DynamicData.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Web.Entity.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Web.Extensions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Web.Services.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.Linq.dll" /debug+ /debug:full /optimize- /out:obj\Debug\Foobar.dll /subsystemversion:6.00 /target:library /utf8output Service1.svc.cs IService1.cs Properties\AssemblyInfo.cs "C:\TeamCity\buildAgent\temp\buildTmp\.NETFramework,Version=v4.5.AssemblyAttributes.cs"
[16:13:20][Foobar.csproj.teamcity] CopyFilesToOutputDirectory
[16:13:20][CopyFilesToOutputDirectory] Copy
[16:13:20][Copy] Copying file from "obj\Debug\Foobar.dll" to "bin\Foobar.dll".
[16:13:20][CopyFilesToOutputDirectory] Foobar.csproj -> C:\TeamCity\buildAgent\work\2eecf7b45f277a61\bin\Foobar.dll
[16:13:20][CopyFilesToOutputDirectory] Copy
[16:13:20][Copy] Copying file from "obj\Debug\Foobar.pdb" to "bin\Foobar.pdb".
[16:13:19]Targets was not defined in the build configuration.
[16:13:19]MSBuild command line parameters contain "/property:" or "/p:". It is recommended to define System Property on Build Parameters instead.
[16:13:21]Process exited with code 0
[16:13:21]Publishing internal artifacts
[16:13:21][Publishing internal artifacts] Sending build.finish.properties.gz file
[16:13:21]Publishing artifacts
[16:13:21][Publishing artifacts] Collecting files to publish: [C:\TeamCity\buildAgent\work\2eecf7b45f277a61]
[16:13:21][Publishing artifacts] Sending
[16:13:21]Build finished
I haven't looked through this in depth but noticed that in your command-line example you're specifying DeployIisAppPath, but looks like you're using DeployAppPath in your TeamCity script, which will just be ignored by MSBuild, I think.
Having the same issue for visual studio 2013 projects. another configuration just building and deploying fine
It's worth noticing that you're getting the following warning:
MSBuild command line parameters contain "/property:" or "/p:".
It is recommended to define System Property on Build Parameters instead.
What it's saying is that the best practice for passing numerous parameters to command-line based executions is to define parameters as System Properties rather than explicitly concatenate them in one long string.
As a suggestion for refactoring, I'd recommend you to define the parameters that you're passing through /p: prefix as System Properties (this can be done on Build Parameters section of your Build Configuration). In this case they will be passed to executions behind the scenes and will help you to avoid duplication, get easily maintainable and so on. It will also make the parameters list more clear and help you to find out if there is something wrong with the parameters you're passing to MSBuild that may cause the issue.