Unity Project doesn't have solution file - macos

I just started learning unity and I created a project. But my project doesn't have a sln file included in. Every time I create a C# script and open it in Xamarin Studio I can't have any intellisense.
Is it normal not to have sln file in unity project?
If not, how can I add solution file to project?
Why that happened?

If "Open C# Project" doesnt create the .sln file, try updating your external tools first.
In Unity, go to Edit > Preferences, and make sure that Visual Studio is selected as your preferred external editor.
This created the sln file for me.

I finally found the answer.
I closed Xamarin and inside Unity went Assets > Sync MonoDevelop Project Doing this created the two .sln projects: -csharp.sln and .sln

For people looking for answers on newer versions of Unity you may have to build your C# project.
To do this go into File > Build Settings then select the option Create Visual Studio Solution. Then build that and your file explorer will ask you for which folder you want your visual studio solution to be placed into. Then Visual Studio should behave correctly.

For people looking for answers on newer versions of Unity you may have to build your C# project.
First install windows build also in unity hub then select target platform to windows. and now you can see visual studio solution checkbox.
To do this go into File > Build Settings then select the option Create Visual Studio Solution. Then build that and your file explorer will ask you for which folder you want your visual studio solution to be placed into. Then Visual Studio should behave correctly.

Like the post by SSchmid suggests, go into preferences and have Visual Studio as your preferred editor.
I was having a sync issue and the Solution wasn't showing the name of the unity project, ultimately interrupting intellisence.
Found in my settings that the code editor was set to General and not Visual Studio specifically.
Setting it to VS solved it for me.

A screenshot to help those who are too lazy to read.

Related

Building a Folder in Visual Studio

I'm working in Visual Studio 2017. I wanted to open a folder of files, so I clicked File -----> Open ------> Folder and selected the folder containing all my files.
When I view the Solution Explorer, I can see all of my programming files. However, I am unable to build my project and run it. Is there any way to build and run a folder in Visual Studio? I've tried selecting the .cpp file that I wanted to build specifically, but there's still no build/debug option.
In fact, under the Debug menu, the F5 Start option is grayed out. Any solutions?
I think you have to create a Visual Studio project first, and then add those files to the project. What you are doing right now is just using VS as an editor and viewer.

Asset Catalog doesn't open in visual studio

I have a xamarin project that it didn't have any problem in visual studio. I don't know why but now I couldn't open the asset catalog to add new images for iOS in visual studio.
Can any body help me please?
I had the same problem and my solution was:
Exclude Assets.xcassets folder from project.
Uncheck readonly mark from Assets.xcassets.
Restart visual studio
I have had issues with the Asset Catalogs in Visual Studio, the issue for me was two things that both caused the Asset Catalogs not to open:
1 Missing/wrong entry in the .csproj file:
In the Contents.json there was specified a file (i.e. image#2x.png) however there was no entry in the .csproj file, this also includes cases where there was an entry in the csproj file but it was the wrong path:
Solution
Add the following (or edit the appropriate) line to the csproj file:
<ImageAsset Include="Resources\Assets.xcassets\image.png.imageset\image#2x.png">
<Visible>false</Visible>
</ImageAsset>
2 Slashes/Backslashes (seriously?!?)
In the csproj file for the iOS project, the ImageAsset tag for the image was with the wrong kind of slashes (which is probably why it sometimes works with Xamarin Studio on MacOS / Linux)
This will look like this when it does not work:
<ImageAsset Include="Resources/Assets.xcassets/image.png.imageset/image#2x.png">
<Visible>false</Visible>
</ImageAsset>
Solution
Reverse the slashes
<ImageAsset Include="Resources\Assets.xcassets\image.png.imageset\image#2x.png">
<Visible>false</Visible>
</ImageAsset>
I solved this problem by removing duplicates in my .csproj file.
By reading Peter's answer it helped me resolve this problem which I have been struggling for quite some time.
I had to create other assets files to hold new images since I couldn't reuse/open the assets files in Visual Studio any longer.
For instance, I had this as a duplicate:
<ImageAsset Include="Resources\Media.xcassets\LaunchImages.launchimage\Contents.json">
<Visible>false</Visible>
</ImageAsset>
Everything is working as it should now.
I had this issue.
Am using Xamarin Forms in Windows.
My fix:
Click 'Show All Files' in top menu bar of Solution Explorer
My 'Assets.xcassets' file was grayed out
Right-click on that file and selected 'Include in project'
Did a Clean, then a re-build, and all is well
Asset catalogs are supported by Visual Studio but if you need reliable support, manage your asset catalogs in Xamarin Studio and don't edit with Visual Studio.
There are so many issues with Visual Studio (Xamarin Forum) If you want a stable solution open solution in Visual Studio for Mac (former Xamarin Studio) , edit asset catalogs, save and open solution in Visual Studio to work again.
Works for me over a year stable now, but I wish there was a better solution for this.
In my case, it was the ios.csproj file got a little bit corrupted though the app is still compiled and running well. Luckily I have the other iOS app with the editor opened normally. Through comparing, I had seen some redundant entries of json files and png file listed in csproj, as siblings of AppDelegate.cs in the same ItemGroup. Removing these redundant entries in csproj and restarting VS 2017 had resolved the problem and the Assets.xcassets editor is opened normally again.

Unity3d generating an empty .sln file

I'm following the Hololens Developer 100 course from Microsoft. All goes well until I get to building. I follow the instructions exactly here and click build. It asks me to select a folder and I create a folder called "App" (per the instructions) and select that folder. When I finally hit build Unity seems like it's working fine but then two things go wrong:
1) The .sln file that's generated is not in the App folder, but in the parent project folder. The App folder is empty
2) When I open the .sln file, it's empty. The tutorial asks me to edit Package.appxmanifes, but I can't because it doesn't seem to have built.
Is there a configuration somewhere that's not correct? Perhaps Unity and VS aren't talking to eachother correctly? More Importantly, how do I fix it?
I had the same problem, for me it was that I didnt have the Windows 10 SDK installed as part of Visual Studio 2015 with Update 3, in the instructions there is a bit that says:
"If you choose a custom install, ensure that Tools (1.4) and Windows 10 SDK (10.0.10586) is enabled under Universal Windows App Development Tools node. All editions of Visual Studio 2015 Update 3 are supported, including Community."
If your hololens build completes successfully a file explorer window will pop open at the project level. If it fails you should find errors in the console tab of Unity.
The SLN file that is at the project level is a solution file that you can open in visual studio to edit unity code and attach to the unity editor to do real time debugging while running your solution in the editor. In fact if you click on a "CS" file in the project tab of Unity this is the solution that opens in visual studio.
The SLN file you are looking for is in the App folder. Once you open the SLN in visual studio set the configuration to Release and x86, and you should be able to target your build at either a "Remote Device" which is the hololens, or the hololens emulator if you have that installed.

Type Script is not generating JavaScript in my Visual Studio Community edition 2015

I am using Visual Studio Community edition 2015 for development, I have added *.ts file to my project but its not automatically compiling. Also it does not show JavaScript preview pane. This post How do I enable the preview panel for TypeScript files in Visual Studio 2015? says that it's not supported anymore. That's fine, but why it's not compiling?
I referenced Missing Typescript Options in Web Essential for Visual Studio 2012
It says Split panes have been reintroduced in the latest version of web essentials http://vswebessentials.com/features/typescript but I can not see it
I do have typescript exe in following folder
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.5
I do have settings in Project Properties as follow
I do have settings as follow in Visual Studio
I see comment in http://www.typescriptlang.org/ as below
"Visual Studio includes TypeScript in the box, starting with Visual Studio 2013 Update 2. You can also edit TypeScript in VS Code, WebStorm, Atom, Sublime Text, and Eclipse"
What may be issue?
Solution
My "typings" file for jquery was out dated, I upgraded it and it resolved other errors and build was success, then JS files got generated.
Below post helped
JQuery definition screwed up with TypeScript 0.9
I can not close this question because I am still not able to get 'Preview Pane"
I regularly encounter this issue in VS 2015 and VS 2013. My solution is not a pretty one, but it works for me...
Close Visual Studio
Go to your scripts folder, delete all JavaScript files that have corresponding TypeScript files (only necessary to do this for TypeScript files that you have created for your project)
Open Visual Studio, clean, and build
If this doesn't work, open each TypeScript file, change one character, Save, re-build... hopefully the file will re-compile.
If this still doesn't work, open a Node.JS command prompt, change directory to the scripts directory, run;
tsc "yourfile.ts"
If this doesn't work, you've got bigger problems.
Make sure that you highlight the project in the solution explorer and then click the icon at the top that says "show all files" after you have compiled the project. You will then see the .js and maybe a .js.map file (greyed out). Select the files and then right click and 'include in project' and things should be good from there.
Some false-errors in my ts caused the issue, fixed by uncheck "Do not emit outputs if any errors are reported"
(The false error is from an outdated DefinitelyTyped file, the generated js file does not have any error.)
Maybe not having the option to expand the .ts file and see the generated .js can cause a confusion here.Try to compile your solution. Click on Show All Files and you must see all the .js generated in the same folder of your .ts files. Include your .js in the project if you want to have them visible as part of the solutions. Hope this helps
I know you say you added the .ts file but did you right-click and select 'include in project'. This will add it to the list of files that Visual Studio will check for TypeScript transpiling.
You need install Web Essential then restart the Visual studio -> clean Solution -> Rebuild it should work.

Copy/Move Visual Studio Projects/Solutions To Another Computer

So I have a handful of Visual Studio projects that I need to move to another computer. Is it as simple as a copy and paste or will that mess something up? Both machines will have the same version of Visual Studio installed, so that shouldn't be an issue.
Is there an export function that I've overlooked?
If the Visual Studio version is the same, you can just copy the project folder.
Till the time you are moving your solution file and associated files you should be good.
In case you are using any source control update your solution from there.
Hope you have the same VS version and any addon frameworks you have
You can directly copy the project to the projects folder. This worked perfectly for Visual C++ projects for me (and also some other projects). But when I copied my Cordova App from one PC to the other (Both had Visual Studio 2015), I wasn't able to open the project. Whenever I tried to open the project, trying both the ways - directly from the Project file and the open option in Visual Studio, it at first opened but when I tried to open a file, it just got hung and didn't respond.
This problem may occur because Cordova apps have some configuration files that might be different for different PCs. I am not sure that this is the reason for the problem.
A solution that I used was that I created a new Project and copied the files to the project folders (excluding the configuration files).
Can you save the file to cloud? if so then you could potentially upload the file to cloud and download the file to the new

Resources