Send a solution as a single archive file - c#

It's my first time sending a solution, so I have no experience with it.
The requirement is to send a solution as a single archive file containing only source code files.
I will quote for precision:
"Send a fully buildable single solution and source code files only, excluding all binaries".
What should I do?

Follow these steps -
From build menu select "Clean Solution". This will empty the bin folders
Delete all obj folders in all project folders. If you wish you can also remove bin folders, not mandatory though, as they should already be empty after step 1.
Delete packages folder from your solution directory, to remove downloaded nuget packages.
Now you should have a source only solution folder.
Now archive the full solution folder and you are good to go.

Related

Adding file expressions to gitignore file causes source files to be flagged as deleted

I just started a new Visual Studio project that uses Git as source control. I needed to create a .gitignore file because all my *.dll and *.pdb files were showing up as modified files when I did 'git status'. Even after adding the .gitignore and adding *.dll and *.pdb in the file, the 'git status' command still showed the files.
I read somewhere in SO that all I needed to do is execute:
git rm -r . --cached
But when I did that, 'git status' now shows all my .cs files as deleted!
What do I do now? In Visual Studio I see the deleted icon next to each .cs file but it also shows me the deleted files in the Staged section. Plus, it shows the .cs files as 'added' in the Changes tab.
Can someone explain this. I'm not a Git expert.
Thanks,
If files show up as modified it's because the files were already part of the previous revision and so when you told git to remove them from cache, then they would be deleted in terms of how the new revision relates to the previous one. Adding the files to .gitignore will only work for files that git is not already tracking. So, if you allow the files to be "deleted" from the revision and commit, you will be good because they won't be added on revisions after the next... however if you move forward a few revisions and then decided to checkout one of these revisions that have those files, git will probably refuse to do it because it would overwrite the ones you had on the working tree.... which leads me into the following comment: you should get rid of those files on the revisions where they are already committed so that the files are not on the history of the branch.

Nuget post build event - adding files to path inside .nupkg

I'm posting this here since I haven't been able to get any help from nuproj's github page.
I have some files I need to write to a specific path in my .nupkg file. After a successful build, I would like to place several files into a specific path (runtimes/win7-x64/native) instead of the default 'lib/net45' folder.
Right now, I have to open the .nupkg file (I use Nuget Package Explorer) and manually create the (runtimes/win7-x64/native) folder structure then add the appropriate files. Note - these files have to be in this specific path in order for them to work in my project.
Basically, how do I go about using nuproj to handle this for me and eliminate the need for me to do it manually? I've attached an image to better illustrate my question (the part in red is what I'm trying to automate).
You could edit the nuspec file and set the folder path for the target.
How to add a folder to a nuspec file
And then create the .nupkg file with the edited nuspec file in command line.
http://www.hanselman.com/blog/CreatingANuGetPackageIn7EasyStepsPlusUsingNuGetToIntegrateASPNETMVC3IntoExistingWebFormsApplications.aspx
And then you could add the command line to the post-build event.

Distributing open-source C# .NET code - what parts of the solution to check in?

I'd like to check in some C# .NET code to a new repository I've created on GitHub.
Usually we code in PHP/Python, in which case we'd just check in all of the .php or .py scripts and be done with it.
For my C# project, there's all of these extra files:
.sln
.csproj
obj/
bin/
To make this useful to other people, do I check all of those files in too? Or are these files specific to my computer, and shouldn't be in git/svn?
The gitignore file will usually be set up to ignore the obj/ and bin/ folders but you should upload the .sln which is the solution file and the .csproj which is the project file.
On github you can automatically create a .gitignore file based on the language you have coded in.
I think, yes, you should check-in *.sin and *.csproj files.
Pay attention that, these file are xml based files. when you add any other new item, you need to check-in these files too.
GitHub has reasonable .gitIgnore for .NET
key files I tend to ignore
# User-specific files
*.suo
*.user
*.sln.docstates
*.sln.cache
[Bb]in
[Oo]bj
localConnectionStrings.config
The localConnectionStrings.config is good for websites where you can set web.config like:
<connectionStrings configSource="localConnectionStrings.config" />
This stops everyone overwriting everyone else's local dev database connection string when they commit (if that's how you work).
If you are not committing the bin folder, setting Nuget Package Restore is useful too.

Is there a simple way to turn off including multiple language packs when using Nuget?

I'm using nuget and am downloading the AjaxControlToolkit. The problem I have is that I don't want 20 extra folders to be created in the bin directory for different languages. Each folder only has a single file named 'AjaxControlToolkit.resources.dll' in it. I don't need the extra folders as our app will never be used with anything but English.
The only way that I've been able to omit the files is to follow this:
http://blogs.msdn.com/b/webdev/archive/2010/04/22/web-deployment-excluding-files-and-folders-via-the-web-application-s-project-file.aspx
where you have to manually add a line to the actual project file. I feel like there should be a better way to do this.
EDIT:
This is the line that I currently add to my .csproj file:
<ExcludeFoldersFromDeployment>Bin\ar;Bin\cs;Bin\de;Bin\es;Bin\fr;
Bin\he;Bin\hi;bin\it;bin\ja;bin\ko;bin\nl;bin\pl;bin\pt;
bin\ru;bin\tr-TR;bin\zh-CHS;bin\zh-CHT</ExcludeFoldersFromDeployment>
No you cannot switch this "feature off" Nuget simply downloads the archive package and places the files where thee package information file says the files are to go.
You need to manually omit these files yourself - or, build your own AjaxToolKit from their source with the extra languages omitted in advance.
I had the same problem (similar answer here) and I haven't found a better way to do it either, I pursued the same method you mentioned however for some reason "ExcludeFoldersFromDeployment" didn't seem to work for me, but I found a alternative way to do the same thing though:
<ItemGroup>
<FluentValidationExcludedCultures Include="be;cs;cs-CZ;da;de;es;fa;fi;fr;ja;it;ko;mk;nl;pl;pt;ru;sv;tr;uk;zh-CN;zh-CHS;zh-CHT">
<InProject>false</InProject>
</FluentValidationExcludedCultures>
</ItemGroup>
<Target Name="RemoveTranslationsAfterBuild" AfterTargets="AfterBuild">
<RemoveDir Directories="#(FluentValidationExcludedCultures->'$(OutputPath)%(Filename)')" />
</Target>
(Basically I put custom build events to clear out the extra files by deleting them after the build is run...)
tldr: i deleted ja de ru folders that resides in mySolution/packages/offending_lib_v1.2.3/.
now it wont copy satellies(ja,de ) into my debug folder, when i build.
long:
there is packages folder in the same folder with your mySolution.sln file.
go in packages folder.
find that thirdparty-that-creates-ja-de-ru-on-Build.dll.
search every folder inside . delete ja de ru folder.
done!.
delete ja de ru from bin/debug (residue from last build)
now when you build or debug, se ja de ru folders wont be cretated in your bin/debug folder.
note: if you update that nuget package, that folder will be recreated. you have to do it again.
How to Find Your Solution Folder.
in visual studio > solution explorer > MySolutionName (first at the top) > rightClick > open in explorer . (that is the folder)

How to send source code - very common question

I wanted to know what part of the project I need to copy for my USB for example in order to get the source code of the project. Do I need to copy the whole folder? Or do I need only the .sln file? Or..?because I've tried to copy the .sln file and when I try to open it with the other computer, it says that it can't open it for some reason.
Thanks in advance.
You need the whole folder. Also, if you have third party references, you'll need those assemblies as well.
You need to copy the entire folder. The source code of a c# visual studio project is the .sln, .csproj, .cs, etc and also the external dependencies, dll:s, etc.
If you view the .sln file in a text editor you can see the references it has. The open up the project files (.csproj) listed in the .sln and see the files they reference.
You have to copy each file because there are many dependencies, like forms, windows, etc.
You need whole folder..
If you just need the source code, you could copy the whole folder. If you're looking for the code, look for the C# (.cs) files within the folder, and open them with notepad++ or something later on.
If you want the project, just copy the whole project folder over.

Categories

Resources