Build Fails Missing File Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props - visual-studio

I have a brand new Visual Studio 2015 project stored in a TFS Git repo. I've configured a build using the standard Default Git build template. The new project builds locally just fine, but fails during the TFS Build with the following error:
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props.

When TFS first creates your Git repository, it includes a default .gitIgnore file which "hides" certain files from your your (Pending) Changes window. One of the wildcard based exclusions in the default .gitIgnore file specifically excludes any files from being checked in under any folder that includes "build/" which includes this specific file. For now, I've commented out that exclusion in the file, and now it shows up in my (pending) Changes window.

Related

Exclude appsettings.json file from GitHub Repo

I have an existing Visual Studio project file (appsettings.json) that contains sensitive data that I do not want to publish to GitHub.
A repository is not currently created but I would like to create one without including the appsettings.json file.
I know that I can use the .gitignore file to exclude files after the initial push, but at this point the sensitive file would already have been pushed.
Moving forward, I can create the repository from the start of the project, but how should this be handled for an existing project without a repository?
I know that I can use the .gitignore file to exclude files after the initial push
Actually, you can use it before the initial push, even before the initial add to the index.
Simply create in VSCode a .gitignore at the root folder of your project, with as a content:
/.vscode/appsettings.json
(assuming this setting file was created automatically in the .vscode/ folder of your VSCode workspace for this project)
Then add and commit: you won't see that file in your first commit, than you can then push.
In visual studio,
Goto the solution explorer
Right click the file you want to git ignore
Goto "Git"
Then select "Ignore and untrack item"
I did the above to my appsettings.json and this is the entry i found in the .gitignore at the end of the file.
/MyProject.WebApi/appsettings.json
Here, "MyProject.WebApi" is inside the main directory.

Am trying to compile my project in visual studio 2015 it is showing "File not found in any active repository" even though the file is in repository

Visual Studio keeps spamming my output window with the following:
File not found in any active repository
Am seeing the file in the repository path but while compile my project it is showing File not found in any active repository but actually the file is there in repository.
How do I go about fixing this?
It also gives correct path in output window (which is outside of repository)
Try below
right-click on the untracked files > add Team Explorer > Changes > Untracked Files > Add

Team Foundation Server Build errors....NuGet?

Im having build errors after building my Visual Studio Core repository from Team Foundation Server. My build order is Get Sources -> NuGet Restore, Build Solution, Publish Artifact
NuGet restore points to my NuGet.config file.
Looking at the error, it seems to me that my NuGet files are not being compiled. My Nuget files are pointing to a location in my file system. I can compile and run my program on VS but i cant successfully build using TFS.
Example errors:
project.assets.json not found, run a nuget restore to generate this file.
- After looking, I found the file in the same location it said not found?
The type or name space "System" could not be found
- Im getting this error for all 8 NuGet packages????
The NuGet.config can't be pointing to your file system if you expect the restore to work on a machine other than yours. It has to be pointing to a location that the build server can access.
I'd recommend setting up a Package Management feed containing your packages.

How do I set Visual Studio to build a NuGet package?

How can I get Visual Studio to build a NuGet package for my library component on build?
I’m using a Portable Class Library as the example project.
Ensure the NuGet.exe file in .nuget folder is latest.
Default values come from AssemblyInfo.cs, so clean that up.
Add a NuGet package reference if you do not reference any, preferably something simple like JSON.NET. Often, PCL projects have no external dependencies, in which case no NuGet refs and without any NuGet refs, the required MSBuild config won't get set properly, so we need to add a 'dummy'.
Enable NuGet Package Restore.
Edit the NuGet.targets file and ensure BuildPackage is true.
<!-- Property that enables building a package from a project -->
<BuildPackage Condition=" '$(BuildPackage)' == '' ">true</BuildPackage>
Edit your .csproj file and add this to the first, default PropertyGroup
<BuildPackage>true</BuildPackage>
Rebuild your project and then search in the Output for nupkg and confirm creation and location of the package file.
Remove the dummy NuGet package reference and build again and check the Output.
To further customize the package creation, you can stick a MyProjectName.nuspec file next to your .csproj file.
See http://docs.nuget.org/docs/reference/nuspec-reference for more on the NuSpec format. You can also pull one from an existing package (its just a zip file) and have a nose around, see how it was done.
Add a post-build event like this:
$(SolutionDir)\.nuget\nuget.exe pack "$(MSBuildProjectFullPath)" -p Configuration=Release -o "$(MSBuildProjectDirectory)\bin\Release" -symbols"
And download and place nuget.exe in the .nuget folder alongside your solution file.
You can use nuget update -self to keep the .exe fresh.
Note
nuget.exe pack has a bug currently where it'll see a packages.config file and try to look for the packages it mentions in your solution but it fails to find them if the packages folder is in a strange place, e.g. if your solution file isn't a level up from the project.
To workaround this, add another post build event to copy the packages folder into the project folder.
The repositorypath config setting seems to do nothing for me.
See GitHub reports:
https://github.com/NuGet/Home/issues/5316
So funny. I was having problems with my usual way of auto-building a package on build when I arrived at this new way. So I looked for a suitable SO question to answer with my new post-build method when I came across my own question here!

Teamcity restore a deleted build configuration

Is there a way in teamcity to restore a deleted build configuration. I found Restore just deleted project which is about restoring a deleted project but can't find any information about restoring a deleted build configuration. I am using Teamcity 8.0.6
TeamCity 9, locate your data directory and you'll find a trash folder, like so:
D:\TeamCity\Data\config\_trash
Take a copy of the whole thing to some other folder, just in case.
Move the effected project folders from config\_trash to config\projects.
Remove the suffixed .projectNN from each project folder.
You may see critical errors in the main web portal while this is happening.
Restart TeamCity just for good measure.
The previous versions of build configuration setting are stored in /config/projects/buildTypes folder in different *.xml.N files. To restore setting replace *.xml file with *.xml.N file.
Also since TeamCity 9 it is possible to store all project setting in VCS.
Another option, available since 9.0 is to place project settings in version control (Git, Mercurial, or Subversion and Perforce since 9.1), and then restore removed files using VCS commands.

Resources