Asp.net Core项目在VSTS中无法签入bin文件夹内DLL文件求助
Hey there, let's work through why your bin folder DLLs aren't checking into VSTS and how to fix this. First off, a quick note: usually, bin/obj folders are excluded from version control because they're build artifacts that can be regenerated, but if you have a specific need to check them in, here's what to do depending on your version control system in VSTS:
If you're using TFVC (Team Foundation Version Control)
- First, check the ignore settings: Open Team Explorer, go to Settings > Source Control > Ignore Items. Look for rules like
bin/or*.dllthat might be blocking your files. If you find them, you can either remove the rule temporarily or add an exception for your specific DLLs. - Next, manually add the DLL to source control: In Solution Explorer, find the DLL in your bin folder, right-click it, and select Add to Source Control. VSTS should now recognize the file as part of your pending changes.
- Finally, confirm it's included when checking in: Open the Check-in window. If the DLL is in the Excluded Changes section, click Promote to move it to Included Changes. Add a check-in comment, then complete the check-in.
If you're using Git
- Start by editing your
.gitignorefile: Head to your project root and open.gitignore. You'll see lines likebin/,obj/, or*.dllthat tell Git to ignore these files. To check in the entire bin folder, comment out thebin/line by adding a#at the start. If you only need specific DLLs, add an exception rule after the ignore line, like:
(Exception rules have to come after the ignore rules they override, so make sure the order is right.)!bin/Debug/YourCritical.dll - Stage and commit the DLL: Open your Git terminal or tool, run
git add bin/Path/To/Your.dllto stage the file, then commit it withgit commit -m "Add required DLL from bin folder". - Push to VSTS: Finish up by pushing your commit to the remote repo with
git push.
A quick best practice note
While checking in build artifacts is possible, it's usually not recommended. These files can be regenerated by building the project, and adding them bloats your repo. Consider using NuGet for dependencies, or setting up a CI/CD pipeline in VSTS to build the DLLs automatically when needed. That way, your repo stays clean and you don't have to manage these files manually.
内容的提问来源于stack exchange,提问作者methababu

