I created a source code repository with a branch, the source and branch are working fine, checking for pending changes everything went up to the repository with no problem.
It is assumed that uploading everything to the repository without problems should download without errors, but when a team member gets the project from the server, it fails to compile.
Mistakes go through this:
Why when obtaining the project some dlls are not loaded?
This is the repository you create with TFS (Azure DevOps).
How can I force that when downloading the repository it downloads with all the dlls?
On laptop everything works fine, this happens when someone else gets the project from server.
No sure how you add those reference into your project.
But if you do use nuget, then just simply restore the nuget packages
Right click on your solution
Click on Restore NuGet Packages
Related
Currently, I'm doing my second day of my first internship at a smaller company where I have to build something in C#. Except from Unity, I've never used C# before so I'm kinda new in using it. I'm currently using it on Linux Ubuntu 20. So forgive me for this most likely beginner question.
I'm using dotnet-sdk to build calling "dotnet clean; dotnet build; dotnet ~/pathToDLL/etc/etc". I've finally got something working now, So I cloned the empty git repository from the company and used the mv command to move my directory with some working code to the git repo. Now, when I try to build it it gives the following errors:
/snap/dotnet-sdk/107/sdk/5.0.102/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(241,5):
error NETSDK1004: Assets file '/home/oscar/
Tacho/card_reader/obj/project.assets.json' not found.
Run a NuGet package restore to generate this file.
[/home/oscar/Tacho/card_reader/card_reader.csproj]
It gives more or less the same error twice.
/snap/dotnet-sdk/107/sdk/5.0.102/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(241,5):
error NETSDK1004: Assets file '/home/oscar/
Tacho/card_reader/obj/project.assets.json' not found.
Run a NuGet package restore to generate this file.
[/home/oscar/Tacho/card_reader/card_reader.csproj]
For most users reading this error, this is probably an easy fix. But as I said, I've zero experience using C# on Linux (or Windows) outside of the context of Unity. So any explanation and fix will be very much appreciated!
Oscar
solved
There was a space somewhere in the directory I copied my working code to. I removed this space (and everything before it) for this question because there was company sensitive information there which my boss didn't want to see end up on the internet. Because of the space (in the git repo name) Linux obviously had errors executing commands. Thanks to everyone for the help.
The error seems to indicate that a NuGet package is missing some files. NuGet is a popular library distribution system that is also built into Visual Studio. Even an empty repository may be referencing the package as a dependency or your own code may be using that it. If you are using Visual Studio you can do the following:
Enable package restore by choosing Tools > Options > NuGet Package Manager. Under Package Restore options, select Allow NuGet to download missing packages.
In Solution Explorer, right click the solution and select Restore NuGet Packages.
Your company might be using a private NuGet server though, so you will want to make sure you are connected to any VPN services. Also do not be shy about asking a co-worker about this issue. This is likely part of configuring your environment properly and not something you are expected to 'just know' as a new intern.
I've had to reformat my hard drive. I've restored my Visual Studio projects but now I need to reconnect them to their corresponding GitHub repositories.
Unfortunately, information about that connection does not appear to have been saved with my projects.
How can I re-establish the connection between my project and the GitHub repository? Preferably, without having to recreate everything or lose any work.
I have a lot of projects I will need to reconnect to their repositories.
Note: I'm just using build-in Visual Studio commands to manage my repositories.
Note 2: I added one project to source control and it now shows every file as being added. I'm not sure if this was a mistake.
Update:
So, I added my project to source control, and tried to publish the project to GitHub. I think this overwrites everything and I lose all my current history. But I'm not seeing other options. But this gives me an error.
Error encountered while pushing branch to the remote repository: rejected Updates were rejected because the remote contains work that you do not have locally. This is usually caused by another repository pushing to the same ref. You may want to first integrate the remote changes before pushing again.
But the Pull command is disabled and says The current branch does not track a remote branch.
In order for the solution to remember your GitHub settings, you need to save the hidden .git folder.
My regular backup procedure did not copy this folder, although I was able to retrieve the old one.
Since I had re-added the project to source control, I could easily undo this by deleting the new .git folder. And I was able to copy of the original .git folder in its place. And when I loaded the project, all the repository settings were as they were before and Visual Studio recognized any new changes I had made.
So I made a .net core web api project and pushed it to a git repo. After pulling down the repo and attempting to run the IIS express server locally, I'm getting the error
Unable to run your project. The "RunCommand" property is not defined.
If I create a new web api project on this computer, it works fine. So it's only the project that I've pulled from git that won't work. Is there some command I need to run to make it...I don't know, update for this computer?
I've done almost nothing to this project. I added one new controller and that's it. Everything else is the default project settings.
The exact project is:
Templates -> .NET Core -> ASP.Net Core Web Application
.NET Framework 4.5.2
Edit: I've compared the new project I created with the one I cloned and everything looks the same. So I'm baffled.
Make sure that the OutputType of the project is set to Exe and that the project file starts with <Project Sdk="Microsoft.NET.Sdk.Web">.
Both are important to give VS:
The command to run when executing the project
Turn on the capabilities to generate and use a Properties/launchSettings.json file.
If your app doesn't launch, i suggest deleting a Web.config file (if exists) and Properties/launchSettings.json, then re-open the solution.
I needed to delete the
bin, obj, and .vs directories.
I just need to ignore those directories with gitignore and I won't have this issue anymore.
I created the MVC application and build the solution in my local machine and it builds without error then I have uploaded that MVC application into TFVC. But, if i take a new workspace from the other developer machine or going for the Branching feature in TFVC, we have been endup with all the reference dll's which was showing deleted like below screen shot and the solution does not build successfully. We are not sure what its causing the issue. Please help us to resolve this issue. Thanks in advance.
Update
Actual problem i am facing here is, I run update-package -reinstall command in the Package Manager Console, it removed all the existing dll's and restored back all the dll and build successfully. But, After successful Build, I have checked-in the pending changes into TFS. But again if I am taking the new workspace from another developer machine, i am still endup with the same build error and missing reference like above screen shot again i have to go for the Nuget Package Restore. Is it a Correct approach? Appreciate your thoughts on this.
right click on the solution and select restore nuget package this may solve your issue then clean and build
check dot net framework version in both tfs and local version
you can also try
update-package -reinstall command to reinstall all referenced packages.
I think you should try restoring missing NuGet packages, check that the option is checked in VS Settings > NuGet.
Today I ran in to a problem that took me a little while to figure out because of my apparent misunderstanding of how the Enable NuGet Package Restore worked within source controlled projects in TFS. So to start out with let me explain the issues that I have spent the last week or so troubleshooting.
On our TFS server, I created a build definition for continuous integration. When the source code is checked-in, the build server begins compiling the source and then fails due to not being able to fetch NuGet packages. I thought initially that it was due to Enable NuGet Package Restore being disabled, so I switched it on at the solution level and re-committed my code. The builds continued to fail. Without having admin access to the Virtualized Instance of the build server, and the admin being swamped lately I let moved on and decided I'd deal with it in a couple of weeks when my Sprint and his Sprint lightens up. Getting the build server up and running is not a must at the moment. I did however remove my local mapping to the branch in TFS, delete the local directory, re-map the source code and perform a fresh get and re-compiled the source without any problems. The NuGet packages downloaded just fine.
Today however we had a new-hire join the team. He pulled a fresh copy from TFS and encountered some SlowCheetah (for transforming our WPF App Configs) NuGet failures. We spent a good chunk of time today trying to figure out why his wasn't pulling down the files properly. After a little while, I right clicked on his solution and noticed that the Enable NuGet package Restore option was available. Even though on my solution, I had enabled it, his solution did not have it set up. I enabled it and immediately his solution compiled without error.
So now down to the primary question, if I enable the solution to restore packages why do I have to re-enable it on another box? I was under the assumption that by making sure Allow NuGet to download missing packages during build option is enabled in settings on all of the boxes, Visual Studio would automatically download the NuGet packages missing from my TFS source code. This confuses me and I would appreciate some clarity on how NuGet should work (and be restored) when packages are used in a project stored in TFS. We are not including any of the packages with our TFS check-ins because I though this feature was supposed to automatically work for the project.
Lastly, I am wondering if this is why my build server is failing to run my build definition. I am getting the NuGet errors and am not sure how to tell the build definition to download the NuGet packages. Is this something I need to do by modifying the build template, adding a sequence to download NuGet packages prior to running MSBuild or something?
Thanks in advance.
Edit 1 I would like to also mention that the NuGet .targets file is included in the TFS branch as well.
This is called Package Restore Consent and for the IDE you need to do it per user. There is a way to override per machine, but its easier per user.
For servers you can use the EnableNuGetPackageRestore environment variable with a value of 'true'
Find out more on: http://docs.nuget.org/docs/reference/package-restore