Issue with VS 2015 Project/Solution build definition in TFS 2010 Server - tfs

I'm getting an issue with TFS 2010 Build Definition which is not copying dlls properly for project in VS 2015. Initially I had an issue like all the compiler dlls are putting together in bin folder and I'm getting application level errors. Once I moved compiler dlls (csc.exe, .config,.CodeAnalysis.dll,...) Roslyn folder inside bin folder (Project\bin\Roslyn), application working successfully. My Roslyn folder is creating outside my project root directory.
Folder structure:
......\Build\Roslyn
......\Build\_PublishedWebsite\project_folder\bin
I have created a post build command to move this Roslyn inside bin and its moved successfully. but still a copy of files under Roslyn are available in bin too and its failing my application to work properly.
Any help. Please let me know if you need more info.

As a temporary fix,
I have added post build command to remove the files and it's working successfully.
if exist "$(WebProjectOutputDir)\bin\MicrosoftCodeAnalysisdll" del /F "$(WebProjectOutputDir)\bin\MicrosoftCodeAnalysisdll"

Related

.Net-Core Proj - MSBuild failing to copy to output folder

Trying to build to .NET-Core Project from TFS, the build is failing because the following command`s not working, failing to copy built files to output folder. The command is working fine for a .Net Framework project, not working only for .Net Core Project. Kindly check.
It works fine with basic command:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin>MSBuild.exe "C:\TFSFolder\Builds\GUID\DotnetCoreProject.sln" /p:OutDir="C:\TFSFolder\Builds\39\b\DotnetCoreProject\\"
Non-working Command:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin>MSBuild.exe "C:\TFSFolder\Builds\GUID\DotnetCoreProject.sln" /nologo /nr:false /t:"Clean" /dl:CentralLogger,"C:\TFSFolder\Builds\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.126.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId=2c81e6a8-374d-4a65-91ba-418b04505e77|SolutionDir=C:\TFSFolder\Builds\GUID\"*ForwardingLogger,"C:\TFSFolder\Builds\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.126.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /p:OutDir="C:\TFSFolder\Builds\39\b\DotnetCoreProject\\" /t:Restore /p:platform="any cpu" /p:configuration="release" /p:VisualStudioVersion="15.0" /p:_MSDeployUserAgent="TFS_fa1cf861-541e-47b2-b0f3-8c684de5500a_build_22138_1486294"
It just need to copy built files to the output folder path mentioned. I could only guess that the dll mentioned isnt supported, kindly check and help.
It looks like you are only restoring and cleaning the project because you specify /t:Clean and /t:Restore.
Use -restore -t:Rebuild instead.
Also note that you normally don't want the output directory contents of a .NET Core project for deployment but rather its publish output. For this use the Publish target on the project instead:
-restore -t:Publish theproject.csproj -p:PublishDir=artifact\location

References don't show up in Visual Studio 2017 after creating a .NET Standard branch

I'm working with Visual Studio 2017 on the open-source project https://github.com/SpiegelSoft/XamarinForms.Reactive.FSharp
I recently created a branch called dotnet-standard, which, as its name suggests, is a migration to .NET Standard. However, after creating this branch and checking back in to the master branch, which is a PCL rather than a .NET standard library, the project will no longer build.
First of all, the references are not visible. All I can see in Visual Studio is a .NET node (see screenshot).
The build fails in the first instance with
Xamarin.Forms targets have been imported multiple times. Please check your project file and remove the duplicate import(s).
This is odd because the same fsproj file was working before I created the new branch.
When I delete the Xamarin.Forms import line in my fsproj file and then perform a git reset --hard, the error message changes to
Your project is not referencing the ".NETPortable,Version=v4.5,Profile=Profile259" framework. Add a reference to ".NETPortable,Version=v4.5,Profile=Profile259" in the "frameworks" section of your project.json, and then re-run NuGet restore.
But the IDE won't even let me a a project.json file. Something has clearly gone very wrong with my Visual Studio settings.
Does anyone have any obvious tips before I reinstall Visual Studio?
As alluded in the comments, VS / MS Build can trip up on previously generated files - often in the various obj folders.
To get back to a ‘clean’ state (the same as when you first clone a repo), run git reset —hard to revert any uncommitted changes and git clean -xfd to remove any untracked files and folders.
Assuming your .gitignore file is configured correctly, this last step should remove all temporary files.

Error: The imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Default.props" was not found

I have migrated a VS2008 solution to VS2013. My solution contains VC++ projets.
I have set the tools platform to v120_xp for each project
My solution compile on my computer and compile on my builds server in VS2013
My builds server is a Windows2008 R2 with VS2008, VS2010 and VS2013 and a build controler of TeamFoundationServer 2010.
When i launch the build with the build controller, the build fails with :
The imported project "C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Default.props" was
not found. Confirm that the path in the declaration is
correct, and that the file exists on disk.
In the V110 directory this file doesn't exist but it exist in the V120 directory.
I have checked the registry :
HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersion\12.0
the VCTargetPath are corrects
Have you an idea to help me?
I have edited the registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions\12.0\11.0
and
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\12.0\11.0
to use the V120 directory
Now my server build the solution, but i don't understand why MSBuild use the key
ToolsVersions\12.0\11.0 and not the key ToolsVersions\12.0\12.0
Parhaps it's due to the v120_xp platform toolset
The true answer is that MSBuild subtracts 1 from the .sln Visual Studio Version. Since you do not have VS 2012 install or you have not installed it, the v11.0 folder is not found. It is all explained by Sayed Ibrahim Hashimi:
http://sedodream.com/PermaLink%2cguid%2ca5894bad-f2a1-441a-a5b2-74f16c6cf8aa.aspx
I came across the same problem in 2015 though, with Windows 10 and Visual Studio 2015 RC (fresh install)
To correct the issue I tried several solutions based on my research ie installing "VS Windows SDK" which didn't do anything different to resolve my problem, I then on another recommendation installed GitHub in order to download MSBuild which is now excluded from VS, I ultimately downloaded and installed "VS Tools for Windows 10" this didn't give me the same error in the end, without having to change registry keys
Installing VS 2012 on your build server should create the necessary targets files for you.
I was able to get past this by changing $(VCTargetsPath) to $(VCTargetsPath12) in the project file.
This feels like a temporary workaround rather than a permanent solution, since once we move to the next version of Visual Studio we'll have to find all the references to $(VCTargetsPath12) and replace with the new target path.

Visual Studio - could no resolve this reference

I created an ASP.NET MVC project in Visual Studio 2012 on my laptop, did a bit of work on it without issues, then checked it into source control. I've checked it out on my main desktop machine (a completely fresh Git clone), and it won't compile stating that various references are missing (one of which being entityframework.dll). Looking back on my laptop, those DLLs are in my project's "bin" folder (which I didn't add to source control for obvious reasons). On my laptop, if I rename my bin folder, then I get the same compile errors. Am I incorrect in not committing certain DLL files that are in my bin folder? Surely those DLLs should be copied into the bin directory at compile time?
The desktop probably can't find the folder to copy from.
You should add the references using NuGet (if you aren't already) and include the packages folder in source control. (or enable package restore)
You should look as to where the library references are stored in your project file. If the project is referencing copies in your bin directory then you have your project setup incorrectly.
You should maintain a libraries directory in your source control tree that id checked in like any other dependency.
The bin directory should be output only.

TFS does not build projects correctly

HI
I am trying to build my solution using TFS but it seems to skips the projects which have dependencies.
e.g Proj B depends on Proj A , then it builds only Proj A and not Proj B.
Also if i try to build the projects individually instead of the solution then it does not create the release folder. It says that the output path is not found.
Any help is much appreciated
thanks
Is the SLN file in question converted from an older version of Visual Studio?
I've found that sometimes, like when you upgrade from a VS2003 SLN file to a VS2008 SLN file, it fails in MSBuild (which is what TFS is doing essentially).
Try making a new SLN file in VS2008 (or whatever version you're using) with the same project and see if that fixes it...
If you right-click the solution, one option you'll have is dependencies. Make sure that the projects are correctly setup there, even though they may reference each other the dependencies on the solution itself may not be complete or accurate...and this is what MSBuild uses.
Have a look in the configuration manager and make sure that the build you are running has those projects selected to build.
It may be you are running the Debug configuration for your local build and then running Release on the TFS server and it's not configured the same.

Resources