Unity meta file stored in specific folder - c#

I'm having some problems versioning meta files in Unity. I have common code that I share between my different projects (as git submodules) and they affect some GameObject differently in each projects. Each projects generate different meta files from my common code. That's where the problem is.
If I version the meta files (in my common code), I end up with the same meta files in all my project which is obviously not what I want because the behavior might be different. One of the solutions I found would be to store the meta files related to my common code somewhere in every projects so they stay specific to one project and doesn't affect others. I can't find any information about this.
My question is : is there a way to store meta files in a specific folder and link them to the scripts of another folder?

Yes, you can refer below:
So you treat the different projects as submodules for the common code? If so, you can store meta files to the different projects’ subfolder, and these meta files can be controlled version separately.

Finally, what I did was : I now have a script that copies meta files into my specific project so I can commit them. Then, when you clone the repo, there is another script that copies them back into my submodule. That way, my scene loads correctly. It's not perfect, but it works.

Related

Backing up a solution/project to create a skeleton in c#

Maybe this is the wrong question. I don't understand the hierarchy/relationship between solutions and projects, so I'll describe my goal first. I have a forms application which works. I want to copy everything in it to another folder on the same PC with a different name which reflects the purpose of a new forms app I want to build. I want to use the old parent which I copied as a skeleton, a starting point. I've tried copying the whole WindowsFormsApplication1 and renaming it, but when it builds, it refers to stuff in the old parent folder. I want each of these to be totally self contained, not reference something above the new folder I just made with the skeleton.
Can someone describe the relationship between projects, solutions, the folder which gets created called WindowsFormsApplicationx and the .sln file? If this is too general, I'd be happy with just some step-by-steps to accomplish my goal.
Thanks for your patience,
Lamar
Thanks onlinecop, this helps but I’m still not all the way there.
When I created the forms application, it made a set of files and directories in the Studio2010/Projects directory:
WindowsFormsApplication2.sln
WindowsFormsApplication2.suo
WindowsFormsApplication2 (folder)
Bin (folder)
Obj (folder)
Properties (folder)
Form1.cs
Form1.Designer.cs
Form1.resx
Program.cs
WindowsFormsApplication2.csproj
WindowsFormsApplication2.csproj.user
I used Forms Designer to make a presentation layer, which although it doesn’t change much, it does change some.
I want to start with all of these and may or may not make changes to them but I will want to change all of their names.
Besides changing the names, most of my changes are in the Form1.cs and wherever Forms Designer keeps its changes. Since it is a graphical input and not text, I don’t know where it stores its stuff.
I’d like to do this without disturbing anything with the originals.
Almost none are unit tests, and most are new, addressing different applications so I don’t want to depend on a version control tool.
I’d like to not use them by reference, but instead by copy because I want the parents sequestered and unchanged.
So it would seem that I would want these to have completely different solutions, not projects inside of a solution….is this right?
Will the “Add Existing” do this for me, and where should I do it
As I’m reading the tutorials, my impression is that basically a solution is associated with an application and projects are sub-entities which might be incremental changes to host unit tests or debugging.
So since I want to make a completely different application, which I do not want to have confused with the parent, I’m thinking I want a new solution. But I want to use most of what I had in the parent so how can I create a new solution and populate it with the contents of the old source files and rename them? I’d like to not have them called Forms1.cs and WindowsFormsApplication2…..more something descriptive of what they are, like NeutronMigrationAnalysis…
If I’m asking the wrong question, it might become clearer if I understood when I should create a new solution instead of a single one with a gazillion projects in it.
Thanks!
Lamar
A solution contains multiple projects.
Let's say that you create a Unit Test. That test will run methods that you've created in a different project, just to ensure that those methods work correctly. So within this solution, you actually have two projects: one which is your normal forms app, and one that is a Unit Test which you, as a developer, can see but that end users won't.
The folders are merely hierarchal in nature: It helps you keep your projects separate, and files in places easy for you to find.
So take your original forms project, within your master solution. Your solution file (usually a .sln file) defines that you have a single project within it, and the directory where it's stored. It usually keeps track of other general or global information as well.
The forms project contains its own project file (usually a .csproj file), and is usually found within whatever subdirectory it was initially started in. That will define all the files that you want included, all of the special build options, the logical layout of your folders, files, and resources, and so on.
When you want to recreate a skeleton project, you will usually create a new, empty project. Then, copy all of the source files into it from your form project and "Add existing..." the files so they are seen by this project. Doing it this way will prevent the .csproj file from being copied from the original project and keeping all those old parent folder files/references.

Using Resources (resx) Inside a ClassLibrary, that can be changed without recompiling

I need to make a ClassLibrary, to contain different Resource Files (resx). This needs to be done, so I can reuse these resources on multiple projects.
After reading for quite a while on how to achieve this, I'm still nowhere near close to an answer.
Note that i need to achieve this in a way that I don't have to recompile the proyect if I want to change a value
Is there a simple way to achieve this that I'm missing?
Hate to be the bearer of bad news, but I'm afraid you're trying to use RESX files for something other than what they're designed to do. RESX files are compiled into .resources files, which are then embedded into the assembly during the build. In other words, if you don't recompile, you won't see any changes that are made to the resx file reflected in the module.
The benefits of RESX files extends far beyond providing compiled cultural/language text tightly coupled to a deployed solution. They have the potential to provide a simple and flexible set of content managed outside the software development process. Some views here:
What are the benefits of resource(.resx) files?
Yes you can work with your RESX files without having to compile them. See here:
Edit ASP.NET MVC 3 resx files in deployment server without recompiling
Yes you can share RESX files between different projects and even roll your own resource manager. You can maintain alternate sets of resources, serving up alternate content depending on for example the user context. I have been involved in a project where we implemented something along these lines to great affect, in my case the solution was used to provide white labeling. Some detail to get you started here:
http://msdn.microsoft.com/en-us/library/aa905797.aspx

What is the right approach in Storing content images in TFS or share folder for usage in multiple websites? [duplicate]

This question already has answers here:
How to handle shared projects in team foundation server source control structure
(2 answers)
Closed 5 years ago.
We have to store lot of images with nested folder structure levels which is shared by many ASP.NET websites.What is the right approach? Should i Store content images in TFS or share folder? We also want to maintain multiple versions of the same image in future.
If you want to maintain multiple version of the same image in the future then storing content images in TFS would be better than using a shared folder.
In order to support multiple versions of files with a shared folder then you will need differentiate the different file versions by changing the image name (e.g. put version number at the end) or change the path to the image (e.g. put version as a folder name). This means you need to update all of the reference URLs to these images in the appropriate ASP.Net websites.
Alternatively, by storing the images in TFS the various ASP.Net websites can reference the single shared path in TFS to the images and use workspace mappings to keep the URL references the same. When the time comes where there are different versions of the file that need to be referenced, you can branch the image (or entire folders) and simply change the workspace mappings for the appropriate ASP.Net websites. No need to update all references to the images.
I recommend the Microsoft Team Foundation Server Branching Guidance (see here) as a source of branching information to find a strategy that works best for you.
It depends on your specific situation of course, but I don't care for storing large binary files in version control systems. TFS in my experience really bogs down when you try and load/pull a bunch of binary files.
Two alternatives I can think of are:
storing the Photoshop or master versions of this files in TFS somewhere and regenerating the images from these as needed.
Maintaining a separate history folder structure which contains old versions of the files.

Compile two versions of C# program automatically

I have to make the same program for two different companies (different logo, different name).
I would like to have this done automatically when I do a release.
I am thinking to use a resource file or a satellite assembly, but I am not sure how to proceed.
Which way do you think is the best?
Thanks.
EDIT:
The differences are only one image and one string.
I would like to
have everything generated in one click.
We might get more clients in
the future.
I must also add that I use SmartAssembly to merge all my dependencies into one exe file.
You could create a class library that contains 99% of the code, and then have two projects which each reference the common library with the 1% that differs for each company. Then a build of the whole solution will generate an executable for each company. Use this if the differences between what each company wants is just enough that you need to have [slightly] different code.
Alternatively, you could make the sections that vary dependent on data, not code. In this case, it might mean getting the logo from a file, rather than embedding it in the executable, and having a configuration xml file with the company name. This would allow you to have just a single executable for both companies.
Resource string in separate assembly would be the easiest distribution.
But honestly, I'd have it be a customization feature.
Last thing you want is to maintain everyone's logo changes due to: legal reasons, copywrite cases, whimsical artistic license, etc.
Which is short for.... have them provide a formatted image, and have them assign the company name during installation and store that off in the registry or in a meta file of some type (XML, manifest, etc.)
The best I can think of it a batch script.
Get your project to reference files (images (logo), text (company name), etc). i.e. C:\MyProject\Resources. So that when the project builds it complies them into the application/installer etc.
This way, you can write a script (.bat file) which copies in the resources needed per company.
Step 1 - Delete all files in the Resources folder
Step 2 - Use MSBuild.exe to build you project
Step 3 - Copy the files needed from the bin/release folder to a directory (i.e. C:\Release\CompanyA)
Step 4 - Change the variables in the script to load the details for the next company. And repeat from step 1, so it copies over the needed resource files and rebuilds.

c# / asp.net compiling project

me and a friend are working on some software in which custom variables need to be inserted into the code for each customer. Whe thought about using a seperate text file but for portability and security we want to include the variables into the .exe.
I have looked at tutorials like this one :
http://www.c-sharpcorner.com/UploadFile/dommym/5598/
or this one :
http://support.microsoft.com/kb/304655
to use asp.net to get the client's data, insert it into the source and then compile it. But these articles only talk about single file sources and our main project has multiple .cs files. So my question was : how would I compile a whole project instead of just one file ?
You can use embedded resource files for this.
You can reference the embedded strings from anywhere in the project.

Categories

Resources