Tagged: visual studio Toggle Comment Threads | Keyboard Shortcuts

  • danielsaidi 10:40 pm on July 24, 2011 Permalink | Reply
    Tags: clone, , copy, visual studio   

    Cloney – clone your .NET solutions in no time 

    When working with .NET, I sometimes find myself wanting to clone a solution. I am not talking about code duplication, although I know that cloning a .NET solutions also means duplicating code, but just hear me out.

    For instance, you may want to clone a similar project or a project stub, where you can reuse code that should not be extracted into a base library, a convenient, frequently used project structure, 3rd part component setup etc.

    If you have never felt this need, feel free to read on if you find the topic interesting 🙂

    In my opinion, the biggest problem with cloning a .NET solution by copying it to a new folder, is that you have to replace everything that has to do with the old namespace. For instance, if you have a solution called X, where X is the base namespace, X can contain several projects, such as X.Core, X.Domain etc. If you clone X and call the clone Y, the solution must be renamed along with all projects and everything that relates to the old X namespace.

    I therefore decided to create a small application that makes cloning a .NET solution a walk in the park. It is currently just a try-out beta that can can be downloaded at https://danielsaidi.github.com/Cloney or at http://github.com/danielsaidi/cloney

    With Cloney, you just have to point out a source folder that contains the solution you want to clone, as well as a target folder to where you want to clone the solution. When you then press “Clone”, Cloney will:

    • Copy all folders and files from the source folder
    • Ignore certain folders, such as bin, obj, .git, .svn, _Resharper*
    • Ignore certain file types, such as *.suo, *.user, *,vssscc
    • Replace the old namespace with the new one everywhere

    You then end up with a fresh, clean solution without a trace of old settings, version control-related folders and files etc.

    Feel free to download Cloney and give it a try. If you like it, let me know. If you hate it…well, I guess you should let me know that as well.

     
    • Adam Webber 3:50 am on December 27, 2014 Permalink | Reply

      Smart utility! Microsoft should simply buy out the program and install ‘Cloney’ in each instance of Visual Studio. I was able to simply name the target folder of destination. No pre-make directory required! Source folder was easy to navigate w built in finder. Once satisfied with name of folder source, and name of folder target, the program took over and performed the perfect clone. Saved me hours of porting over via add existing files, etc. Simply point to your My Websites directory, select the name of your source and assign the name to your target. Can’t get much simpler than that! 4-stars for easy of use … 5-stars if I experience no bugs when working on my new solution.

      • danielsaidi 5:40 pm on January 17, 2015 Permalink | Reply

        So happy to hear that Cloney worked so well for you. Was it a 5 star experience in the end? 🙂

    • Adam Webber 9:11 pm on January 18, 2015 Permalink | Reply

      Still working w new target … no bugz yet … Must be a winner!

    • Ray 6:01 pm on February 15, 2015 Permalink | Reply

      I have used Cloney again and again and it works like a charm every time. Thanks for sharing such a great utility. I love the simplicity and the fact that IT WORKS. Thanks again.

    • Will 5:00 am on February 19, 2016 Permalink | Reply

      Maybe I’m missing something, but It’s just copying the solution and changing the solution file name, but none of the project names or namespaces are changing. The solution is named X while the projects are named X.Web, X.Api..etc. I was expecting it to change the Solution to Y and the projects/namespaces to Y.Web, Y.Api. I checked the command line parameters and I didn’t see any switches to change project/namespaces. This is a VS2015 solution…could that be why?

      • danielsaidi 10:54 pm on March 1, 2016 Permalink | Reply

        Hi Will! No, in that case something is wrong. It replaces the solution name everywhere it appears – files, folders, namespaces, projects etc. So, if your solution is named Solution1 and has two projects – Solution1.Foo and Solution1.Bar, and you clone it to a folder called Solution2, the new solution should be named Solution2 and the projects Solution2.Foo and Solution2.Bar.

        It seems like you have named your projects in that matter and that you have read up on how the cloner works, but it really should not depend on any VS version, since it only sweeps through the file system. I will have a look whenever I find the time. Thanks for getting in touch!

  • danielsaidi 10:49 pm on June 27, 2011 Permalink | Reply
    Tags: , theming, visual studio, windows 7,   

    Visual Studio and WPF force Windows 7 to apply basic theme 

    Every time I open up my WPF projects in Visual Studio (2010) and open a XAML file, my computer switches from the nice semi-transparent theme to Windows 7 Basic.

    Does this happen to you too? If so, this is how to solve it:

    1. In the main menu, select “Tools/Options”
    2. Under “Environment/General”, uncheck “Automatically adjust…” and “Use hardware acceleration…”
    3. Enjoy the Windows 7 flashy theme 🙂
    Easy enough, right? Rumors says that R# is causing this issue, but I love JetBrains and their God-like skills way too much to even consider that to be true.
     
  • danielsaidi 7:26 am on May 27, 2011 Permalink | Reply
    Tags: badimageformatexception, , visual studio   

    How to handle BadImageFormatException in NUnit 

    While I have been developing the new version of my hobby project in .NET, everything has been working great all along…until now. Apparently, NUnit thinks that there is something wrong with one of my assemblies:

    BadImageFormatException

    So far, this assembly only contains two classes, so the easiest option would be to just delete it and create a new project and hope for the best…but, I have this thing for wanting to know what is causing this problem.

    However, my ambitions were laid to rest, since deleting the two projects and re-adding the classes solved all my problems.  I would have posted a solution here, but now we’ll never know what caused this problem in the first place.

    Or won’t we?

    After writing this blog post, Mikey posted a comment that pointed me in the right direction. I must have disabled one architecture, causing the test project to fail when using the project.

    Thanks Mikey!

     
    • Mikey 11:32 pm on October 19, 2013 Permalink | Reply

      I ran into this issue today — it turned out that the project I wanted to test was set to compile as X86, but my NUnit test project was set to ANY CPU — I set them both to ANY CPU and the issue went away.

  • danielsaidi 9:32 pm on April 4, 2011 Permalink | Reply
    Tags: ankhsvn, , , git Bash, git extensions, , tfs, visual studio   

    Embed Git Bash into Visual Studio 

    I have started using git with my private .NET projects. It works really well, but even though I use TFS and AnkhSVN, which are both graphical tools, I do not like to work with git through Git Extensions. I use the terminal when working with git in OS X, and that’s the way I like it.

    So, being a Git Bash kinda guy in Windows, I find it annoying to have the bash in a separate window when working in Visual Studio, when IDE:s like Aptana Studio embeds it so well. After a quick search, I found some people who shared this frustration (I may exaggerate a bit) here:

    http://coderjournal.com/2011/03/adding-git-command-line-to-visual-studio/

    Happy joy! I’ll try it out tomorrow and write a short comment about how it went. Stay tuned.

     
  • danielsaidi 1:38 pm on April 14, 2010 Permalink | Reply
    Tags: , , visual nunit, visual studio   

    Visual NUnit 2010 

    At work, I have a license for ReSharper, which is a really nice piece of software. Besides providing a lot of handy shortcuts and extensions to the Visual Studio environment, it also integrates NUnit in a very convenient way.

    At home, however, I have no ReSharper license and really see no point in installing it. One thing I really miss, though, is the NUnit integration. Sure, I can add NUnit as an external tool, but it’s not really smooth to work with (in my opinion).

    Today, I found the Visual NUnit 2010 extension for Visual Studio, which provides a nice NUnit view that is embedded within Visual Studio.

    Visual NUnit 2010 can be downloaded here:
    http://visualstudiogallery.msdn.microsoft.com/en-us/c8164c71-0836-4471-80ce-633383031099

    After installing Visual NUnit, you will find the Visual NUnit view under the View/Other views menu alternative. If you do, you are good to go.

    To make things even smoother, I pinned the Visual NUnit view to the bottom of Visual Stuio, which makes it instantly available as soon as I want to run my tests.

     
    • PärH 11:29 am on August 26, 2010 Permalink | Reply

      Nja, kan inte rekommendera Visual NUnit 2010 av två orsaker:
      – app.config läses inte in (Tracker item finns på sourceforge)
      – man måste själv komma ihåg att bygga innan man startar testerna

      ReSharper löser dessa två

      • danielsaidi 11:34 am on August 26, 2010 Permalink | Reply

        Visst är ReSharper bättre och smidigare och heeelt fantastiskt (produktplacering), men det kostar ju en del. Även om RS, CodeRush eller dylika plugins starkt är att rekommendera, är det ju trevligt med ett gratisalternativ, som jag ändå måste säga fungerar bra för egen del när jag pillar med mindre projekt.

    • Dave M. 12:56 am on December 14, 2010 Permalink | Reply

      I generally like Visual NUnit, except for the cases where it doesn’t work. One some of my projects, it works great. On other similar projects, I don’t get anything in the “Namespace” and “Fixture” droplists, so I can’t run my tests. It’s a bit frustrating. Have you ever encountered this problem and figured out how to resolve it?

      • danielsaidi 9:25 am on December 27, 2010 Permalink | Reply

        I have not been using Visual NUnit much after I wrote the blog post, since I shortly after returned to work and my ReSharper license…and with ReSharper, there is (if you ask me) no need to install Visual NUnit. Sounds frustrating though!

      • Nick Stinger 3:48 am on August 5, 2013 Permalink | Reply

        Seems you have to build the test project before the droplists will populate. That was my problem, at least, but it makes sense.

    • Alexander 12:47 pm on May 3, 2012 Permalink | Reply

      Tried that and think that MSTest is much better.
      (Just to name – it sorts run time column as strings)

    • Anurag 2:52 pm on November 18, 2012 Permalink | Reply

      Helped alot…thanks a ton 🙂

c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel