Hello!
Using Visual Studio 2013 with Visual Studio 2013 Tools for Unity.
It works great, except that it keeps clearing the default namespace I am setting in the Visual Studio project settings.
Set default namespace in Visual Studio for projects UnityVS.Unity.CSharp, UnityVS.Unity.CSharp.Editor, and UnityVS.Unity.CSharp.Plugins.
Change a C# class and save.
Go to Unity. Unity performs a recompile.
Go back to Visual Studio. It says that the project has changed on disk. Reloading the project shows that I have no default namespace.
I was wondering if anyone has dealt with this before and figured out how to get the default namespace to stick.
coeing
November 13, 2014, 1:35pm
3
Hi there,
I’m working a lot with ReSharper and it generates the namespaces itself if the project is set up correctly. Therefore I’m also very interested in this issue, as the Default Namespace of the generated projects is reset every time, so the generated namespaces are something like Assets.* which is annoying to fix every time.
@GarthSmith : Did you find any way to keep a specific default namespace?
Cheers
Christian
coeing
November 13, 2014, 1:43pm
4
jbevain
November 14, 2014, 11:11am
6
Hey guys,
I’m the dev lead for the Tools for Unity.
Project specific configuration including namespace configuration is definitely planned for 2.0.
You can hack it in today with a Editor script:
using System;
using UnityEngine;
using UnityEditor;
using SyntaxTree.VisualStudio.Unity.Bridge;
[InitializeOnLoad]
public class NamespaceProjectHook
{
private const string Namespace = "Foo.Bar";
static NamespaceProjectHook()
{
ProjectFilesGenerator.ProjectFileGeneration += (string name, string content) =>
content.Replace("<RootNamespace></RootNamespace>", string.Format("<RootNamespace>{0}</RootNamespace>", Namespace));
}
}
4 Likes
jbevain:
Hey guys,
I’m the dev lead for the Tools for Unity.
Project specific configuration including namespace configuration is definitely planned for 2.0.
You can hack it in today with a Editor script:
using System;
using UnityEngine;
using UnityEditor;
using SyntaxTree.VisualStudio.Unity.Bridge;
[InitializeOnLoad]
public class NamespaceProjectHook
{
private const string Namespace = "Foo.Bar";
static NamespaceProjectHook()
{
ProjectFilesGenerator.ProjectFileGeneration += (string name, string content) =>
content.Replace("<RootNamespace></RootNamespace>", string.Format("<RootNamespace>{0}</RootNamespace>", Namespace));
}
}
Oh thats awesome thanks jbevian, congrats on the Microsoft aquire BTW
1 Like
coeing
November 17, 2014, 12:43pm
8
jbevain:
Hey guys,
Project specific configuration including namespace configuration is definitely planned for 2.0.
You can hack it in today with a Editor script:
Great to hear, thanks for your help! The delegate looks like a nice way to add some more personal additions if required
1 Like