<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mattias Cibien</title>
    <description>The latest articles on DEV Community by Mattias Cibien (@mattiascibien).</description>
    <link>https://dev.to/mattiascibien</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F320510%2F0520f77f-9f6a-4356-95db-db3e5f8226f8.jpeg</url>
      <title>DEV Community: Mattias Cibien</title>
      <link>https://dev.to/mattiascibien</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mattiascibien"/>
    <language>en</language>
    <item>
      <title>Rename a C# Project</title>
      <dc:creator>Mattias Cibien</dc:creator>
      <pubDate>Mon, 20 Jan 2020 10:50:19 +0000</pubDate>
      <link>https://dev.to/mattiascibien/rename-a-c-project-5f1n</link>
      <guid>https://dev.to/mattiascibien/rename-a-c-project-5f1n</guid>
      <description>&lt;p&gt;One of the problems beginners face when using Visual Studio happens when they try to rename a project since there will be a lot of leftovers in the process. This can be a problem even for professionals if they find out that the project name cannot be used, for example, in patents or copyright situations. Today we are going to fully rename a Visual Studio Project.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: This guide works with every version of Visual Studio and every kind of .NET Project.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Step 1: Solution Name and Project Name
&lt;/h2&gt;

&lt;p&gt;Renaming the solution is actually the simplest part of the process. Just click on the solution item in &lt;strong&gt;Solution Explorer&lt;/strong&gt; twice (but do not double click) to get an editable field and then type the new name.&lt;/p&gt;

&lt;p&gt;In most of the cases your project name will match your solution name so just repeat the steps on the project item instead of the solution.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Folder Name
&lt;/h2&gt;

&lt;p&gt;Renaming the project actually does not change the folder your project is contained. When you do the first step you will have this situation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;root&amp;gt;
|- NewName.sln
|- OldName
   |- NewName.csproj (or vbporj, vcxproj...)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In order to get the new name on the project folder you have to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Rename the folder itself&lt;/li&gt;
&lt;li&gt;Open the sln file with a text editor like notepad and do a Find&amp;amp;Replace to replace the old name with the new name.&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: You can also remove the wrong project inside Soluton Explorer and add the correct one back.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Step 3: Executable or Library Name
&lt;/h2&gt;

&lt;p&gt;Executable (or Library) Name is actually pretty easy to do: just right-click on your project in &lt;strong&gt;Solution Explorer&lt;/strong&gt; and choose &lt;strong&gt;Properties&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In the application ta you will see the &lt;strong&gt;Assembly Name&lt;/strong&gt; text box. Just change these and you are ready to go.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Namespaces
&lt;/h2&gt;

&lt;p&gt;You may not want to keep the namespaces containing the name of your application, especially if you are using a name that you cannot use.&lt;/p&gt;

&lt;p&gt;To do this, first of all, change the &lt;strong&gt;Default Namespace&lt;/strong&gt; in the project properties like you did in Step 3. and then you can use &lt;strong&gt;Find&amp;amp;Replace&lt;/strong&gt; to change any reference to the old name in the new one. &lt;/p&gt;

&lt;p&gt;Alternatively you can rename the namespace in one of your files and then use the refactoring tool (the little box appearing under the namespace when you edit it) to replace any reference.&lt;/p&gt;

</description>
      <category>visualstudio</category>
      <category>csharp</category>
      <category>dotnet</category>
    </item>
    <item>
      <title>Upgrading from Visual C++ 6.0: The $(InputFile) macro</title>
      <dc:creator>Mattias Cibien</dc:creator>
      <pubDate>Mon, 20 Jan 2020 09:46:04 +0000</pubDate>
      <link>https://dev.to/mattiascibien/upgrading-from-visual-c-6-0-the-inputfile-macro-1mlf</link>
      <guid>https://dev.to/mattiascibien/upgrading-from-visual-c-6-0-the-inputfile-macro-1mlf</guid>
      <description>&lt;p&gt;When trying to compile code that used to run under Visual C++ 6.0 you actually have to face some quirks which resides in custom build tools. One of these is the &lt;code&gt;$(InputFile)&lt;/code&gt; macro producing linking errors like &lt;code&gt;cannot find input file '.\debug\.obj'&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;As the geek I tend to be, I like to do a lot of crazy things including compiling old games with the modern compiler.&lt;/p&gt;

&lt;p&gt;Quite some time ago, when I was compiling the code of &lt;a href="https://github.com/id-Software/Quake"&gt;Quake&lt;/a&gt; under Visual C++ 2015, I faced the same problem I had with older versions of the IDE: when the linker tries to link the output files of the Assembler, if fails with an error code similar to this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Error: cannot find input file '.\debug\.obj'
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The problem arises since the macro &lt;code&gt;$(InputFile)&lt;/code&gt; is not available anymore in modern Visual C++ versions and therefore it produces an empty string as output. The conversion process, moreover, does not manage to convert the macro occurrences in the Outputs property of the Custom Build Tool.&lt;/p&gt;

&lt;p&gt;Fixing this is as simple as opening the &lt;strong&gt;Properties&lt;/strong&gt; of the files, and looking into the &lt;strong&gt;Outputs&lt;/strong&gt; of the custom build tool and replace the occurrences of &lt;code&gt;$(InputFile)&lt;/code&gt; with the new &lt;code&gt;%(FileName)&lt;/code&gt; macro which achieves the same effect. A screenshot of the final result can be seen in the image.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dRXYSz_b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/93nsa985e34vxxwoqwsj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dRXYSz_b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/93nsa985e34vxxwoqwsj.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope that this trick will help you in bringing your old code into the new age.&lt;/p&gt;

</description>
      <category>c</category>
      <category>cpp</category>
    </item>
  </channel>
</rss>
