Building multiple exe from one project - c#

I have a unity project from which I want to export multiple exe files (build the project multiple times). The way I do this is by running in a loop and every time changing the part in the project I want to be different and then building the project.
The problem I'm having is that when I build the project automatically the scene gets destroyed and I can't access the gameobject in it and edit them one I go through the loop again.
I tried to come up with a solution to this problem by loading the scene again but that didn't fix it.
What do you suggest?
Thanks!

As I know, editing and building at the same time is impossible.
Here is an idea:
Copy the whole project to another folder.
Open both 2 projects with 2 unity instances.
Every time you make some change, copy the file from the first project to the second one.
Run your auto build code in the second one.

Related

Retrieve Only Modified Files After Visual Studio Publish (NB : More of a knowledge gathering)

First of all, i'am not looking for a code sample. I just want some directions on something am working on. I'am an intermediate C# developer and i'am developing something, something like a pet/side project [huh.., it's just a crappy form application :-)].
Currently am working on a ASP.NET MVC Web project. When our client request for a change, we make the change and publish the project, then we we copy only the modified/newly added files(.cshtml, .css, .js etc..) and bin files(.dll) (if there is any controller, model etc change during the development) and replace/add them to the server.
What i'am trying to achieve is, after publishing i run a form app and it list all the projects in TFS, then i can select a project and select any changeset associated with the project(usually the latest one or two changesets) and upon click next it finds the modified/newly created files (.cshtml, .css, .js etc..) and modified(modified on the day of publish) bin files(.dll) and copy to desktop in the same folder structure as publish folder as a single compressed file, it is kind of like automating the 'picking apples (or) files'.
I have almost completed the above however just to know is there any tools for this already available that i'am not aware of or is there some option in VS to perform this? Am just a developer and didn't know the endless possibilities of VS (which i'am excited each day while learning it..)
Also please note i don't want to publish all my files to server directly from VS which i'am already aware of.
[EDIT]
I know simply i can create a batch file to find modified files in a folder and do the needed (my rocket engineering solution above vs simply doing it..!! ). I just want to know is there something already in VS etc...

Excluding Library folder from Git for Unity project causes scene to be lost

I've gone through all the recommended steps to prepare a Unity project for a Git repository following the directions here:
Unity Git - Ignore Library
I've correctly setup the .gitignore file etc.
However when I clone my newly created Git repo on a different machine I noticed that my scene, assets etc. are missing. The scripts seem to be there.
I noticed that when I copy over the Library folder the missing things (scene, assets) come back.
I'm assuming that there is something in the Library folder that just can't be ignored or that the "forcing assets to text" just isn't working properly.
I'm using Unity 5.3.5f1.
I'm still fairly new to Unity/Git etc. so I may have overlooked something obvious but I've followed all suggested directions.
Any help would be much appreciated.
apparently Unity has changed the Library Folder many times in Unity 4.X that folder could be ignored. Now, it seems not.
I did some tests and the huge junk of files are for my in the ShaderCache and this folder seemed to be fine to delete. The other Folders should not be touched.
https://forum.unity3d.com/threads/26-581-bin-files-in-library-shadercache-folder-can-i-delete-these.326312/
Fell into same problem with Unity 2020.3
Some research showed that was needed files LastSceneManagerSetup.txt, CurrentLayout-default.dwlt for scene. And EditorSnapSettings.asset, EditorUserBuildSettings.asset for game window, game view and UI.
Maybe, I miss some other settings, so I saved files in Library root and replaced /[Ll]ibrary/ with:
/[Ll]ibrary/APIUpdater/
/[Ll]ibrary/Artifacts/
/[Ll]ibrary/BuildPlayerData/
/[Ll]ibrary/PackageCache/
/[Ll]ibrary/PackageManager/
/[Ll]ibrary/PlayerDataCache/
/[Ll]ibrary/ScriptAssemblies/
/[Ll]ibrary/ShaderCache/
/[Ll]ibrary/StateCache/
/[Ll]ibrary/TempArtifacts/
/[Ll]ibrary/UIElements/
Scenes are not entirely missing, as you can simply load them from Assets/Scenes. Their original order in the scene hierarchy, however, is lost.
I did even more tests than Jimmy and found out the only required things from Library are StateCache folder and LastSceneManagerSetup.txt file (less than 2 kB total in my case). Everything else located in Library folder can be safely removed.
Save these two:
StateCache/
LastSceneManagerSetup.txt

How can I run multiple programs sequentially, from one solution?

I have a Visual studio solution containing multiple programs, each of which contains it's own Class and Main Method. I need to set these programs up to run one after the other, as some of them access the same database tables, and I do not want there to be conflicts.
I have tried setting up dependencies and creating a new program with class dependencies, however, this does not seem to have worked, does anyone have an idea?
Right click on your solution > Properties > Common Properties > Startup project
Select "Multiple startup Projects" and change the value of the Action column from "None" to "Start" or "Start without debugging"
Visual Studio is a development tool. It is not a tool to orchestrate how your application should execute. Your application should also function when executed outside Visual Studio.
With that in mind you need to decide how to partition your application. Right now you seem to have several applications (console programs?) that need to execute one after the other. An easy solution is to create a batch file that executes each in turn. You can also create a separate application that execute each "child" application in sequence using the Process.Start method but why bother when you can create a batch file?
You might also consider merging your different applications into a single application that has a Main method that executes each task in sequence.
Without more information about your problem it is hard to give you specific advice.
You mentioned you have tried "Multiple Startup Projects" approach but did you set the order in which multiple projects run when you start the debugger?
To set the order in which multiple projects run when you start the debugger
Open the Solution Property Pages dialog box.
Select the Startup Project set under Common Properties.
In the pane on the right, select Multiple Startup Project.
Select a project, and then click Move Up to run that project earlier when you start the debugger, or click Move Down to run the project later.
Reference: How to: Modify Project Properties and Configuration Settings
You need run each program in separate Visual Studio instances.

merging two c# project-need to insert 1 into the other

here's the list of projects I have:
I need to insert the weather and maps into the PL.
I've tried several things and came up empty(I saw what was suggested to people who asked similar question but it didn't work for my situation).
any ideas?it's for a project I make and I need to submit it in a few days.
If you have resharper plugin installed in VS then you can select all the files and folder. Then press F6(or right click selection refactor->move).
Otherwise you would have to move all the files manually by dragging to one project to other.
If you're trying to merge the code bases, there's no easy way to do that. You'll just have to go one file or folder at a time, update the namespaces, resolve any conflicting names etc.
If you want to just use the functionality within your other projects, you can add a project reference to them from the consuming project. You can do this via References -> Right click -> Add Reference -> Solution Tab -> Tick the projects you want to reference -> Ok

New changes do not appear in bin debug

I have created a windows form application.
Few days ago I started making it look better by changing icons and images.
But the changes do not appear on my form. (imagelist and program logo .ico)
I have built/cleaned my application several times.
Is there something else I should clean?
Please make sure that in the solution's properties the project is actually marked for build. You can - for every project in the solution - check a box saying whether the project should actually be built or not.
Make sure you are compiling to Debug and not Release
Make sure you have the same platform (x86, x64, Any CPU) than before.
If still problems:
Clean solution
Delete bin and obj folders.
Rebuild
Also, its a good practice to have images and icons in resources. If you don't you can give it a try.
Update
Are you sure the app is compiling? You might have said to run even with errors and checked to not ask you again. Go to View menu -> Error list and see if there is any compiling error.
Any resources ( image files for example) must be added to the project and marked as copy to output folder ( always ) there is the option to copy if newer but since this is dependant on time stamps the first choice is more reliable.
Without this associated resource files will not end up in your build output folder.

Categories