Github Visual Studio Pull : Will it include the Project's references? - github

Github Visual Studio 2022 Git Pull : Will it include the Project's references?
Using Visual Studio 2022 with Git. When pulling from a hosted repository into my local machine, will that also automatically set the same project references in my local machine as it is in the hosted repositories?
What should be the expected behaviour?
Thank you
I tried but I see other references than other users on other machines.

The project references should be defined in the .csproj file (or .vbproj, etc). This file should be included in ones source control repository.
You may need to perform a nuget restore if the references are fetched from a package manager (i.e. https://nuget.org), especially if someone else modified the references and pushed them to your remote in GitHub
For example, someone else on your project updates a reference to a newer version and pushes it up to GitHub. You then perform a git pull on the branch that these changes were made on, and suddenly you have new references or possibly see errors all over your code. When this happens, you almost certainly need to perform a nuget restore to get the new package references.

Related

Pushing Xamarin forms to Github

I'm trying to push my xamarin forms project to github .
I've tried the regular method following the github instruction & using command line but xamarin forms project usually are big in size so that it won't be pushed throw the CMD and it recommends the Git LFS instead.
however, I found that we can push the project to github
https://devlinduldulao.pro/how-to-use-git-and-github-in-xamarin-development/
using the GitHub Extension for Visual Studio and I have installed it but the second step is to add the solution to source control.
but I cannot find the latter option in my menu
so can anyone help me with this problem, all I need to do is to push my project to github if there any other option than the one I have provided in the article above please mention it.
thanks in advance.
If its trying to push a lot, then you are missing a .gitignore file. Put this in the root folder of your solution.
Here is a github list of useful gitignore files.
A good one to use for this purpose is VisualStudio.gitignore.
At minimum, have these lines in your .gitignore file:
[Bb]in/
[Oo]bj/
.vs/
bin and obj are the main folders containing results of building. These are re-creatable from source files, so should not be in repo.
.vs is where visual studio keeps all its user-specific files (such as .suo).
This question seems to be more a git problem than a Xamarin problem. Xamarin.Forms projects aren't bigger than other projects - but you have to ensure you excluded all the build output from the beginning (using a .gitignore-file for .NET projects) - otherwise you commit binaries and your nuget-feed.
Seeing this menu structure, it seems, you already are working with git (at least with a local repo without remote). So you should check your git repo settings and add github as remote: https://learn.microsoft.com/en-us/visualstudio/version-control/git-settings?view=vs-2022

After adding submodule, nuget restores all packages to submodule packages directory in Azure Devops Build

Scenario: We wanted to move some code over to a new repo (NewSln), so we created that new repo, and then added the code back as a submodule in the original repo (OldSln). Had to modify a few references to point to the new version, but was able to get the build to work locally.
Issue: After doing this, the Azure Devops build failed on the msbuild building step due to
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\Fody.6.5.2\build\Fody.targets. and other similar issues. We had not made any changes to those references
I noticed that the restore step was restoring the packages to the submodule directory. For example, I saw this line
2022-02-10T23:52:45.1474898Z Adding package 'AcisExtensionSDK.1.0.4.1061' to folder 'C:__w\1\s\NewSln\packages'
I confirmed that this submodule is only used by the larger repo and not the submodule, yet it is being restored to \NewSln\packages\ rather than \packages\
Debugging effort so far: I can see the references that are showing up as missing on the build locally, and the build is working locally, with nothing obvious to me as why it fails on dev ops. I also see various stack overflow posts about the opposite issue, where the nuget restore doesn't import the references for the submodule repo, but I found nothing for the case where only the submodule repo is restored.
Is there anything that could cause this and what would be the way to route the packages being restored back to the appropriate package?

When I add a solution to source control in VS 2019 Azure Devops only the startup project gets added - how do I add the others?

I am working on a solution that has 14 projects (so far) in it. I added the solution to Azure Devops source control and can see that the solution and the startup project have the little locks in the solution explorer, also I can see the startup project files in the devops repo, but I can't see how to add the other projects. Obviously I messed up somewhere, since ideally the repo would contain a folder for the startup project rather than the files themselves, but I don't know how to "undo" the source control and reset my solution back to its original state.
Can someone tell me how to either fix the source control so that the master branch contains all of the projects in sub-folders (as per the visual studio folder structure) - i.e. how to move the startup project files in the devops repo to a sub-folder and how to add the other projects to their own sub-folders, or, failing that, how to undo the source control so that all of my solution files are back on my local hard disk?
Any advice will be appreciated.
You mentioned that you are using git. So when you DO NOT have local changes which are not pushed to your git server, that means everything is "synced".
Make a backup of your folder, just copy & paste everything!
You can just delete the .git folder. So you have no "link" to the git server anymore.
You can the link the "folder" again to your git server, with sth. like:
git remote add origin https://YOURNAME.visualstudio.com/YOURPROJECT.git
Other option is check your .gitignore file, maybe some of your projects are excluded.
When you are working with Visual Studio, can can also create a new empty solution and add the projects one by one. Also be sure that there is NO Filter in Project Explorer in Visual Studio.
You can also check your git changes, with git log or git status from any terminal or command line tool.

Recover code repository in Github?

I recently inherited a project that used to be setup with Github for version control. However, due to lack of communication from the original developer, I'm left with code base that lives on the production. Question I have is if it's possible to recover a code repo in Github given that I have the .git folder that contains all git related files?
If there's an existing .git folder, it's probably an existing git repository. You could just follow the instructions for adding an existing project to Github and get it that way.

Is there a better way to keep your own copy of a customized open source project?

I use an open source project to host a site (OrchardCMS) which is available in a GIT repository via CodePlex. I have made a few customizations to the source code that are specific to my implementation and I want to keep preserved and under source control. However the challenge arises when there's a new release of the source engine.
My changes certainly won't go into the blessed repository everyone uses.
Currently I'm using two repositories. I use the CodePlex OrchardCMS repository to get the latest changes from the engine the community uses (and that I contribute some bug fixes to).
I then have my own copy which contains my changes. For this, I am using my own source control (hosted TFS from Microsoft). When an update to the core engine comes out, I XCOPY all the files from the current source to my self-maintained repository and commit them to my project.
However this seems like there should be a better option. Any opinions?
You can use git to have an alternative solution.
You can clone the git main repo and keep it updated with the new relases, and you can keep your local modifications, that aren't to be shared with anyone, on a local branch.
When a new release came out, you simply update your master branch in your git repo an then you can rebase or merge your local modications on top of it.