Provide hint to IntelliSense that a partial class should not be modified
<p>As of lately I'm using quite some code generation, usually in combination with partial classes. Basically the setup is as follows:</p>

<ul>
<li>Partial class containing generated code. Some of this code will call partial methods. The code is re-generated a lot of time. The code generator is in some cases a custom tool.</li>
<li>Partial methods are manually implemented in a separate file. </li>
</ul>

<p>The problem is that when I'm using Intellisense features like "generate method", they are for some reason generated in the file containing the generated code. Obviously I don't want that.</p>

<p>My question is: Is it possible to generate some hint that tells Intellisense it shouldn't touch certain 'cs' files (but instead the other partial class)?</p>

<hr>

<p><strong>Update</strong></p>

<p>In retrospect I should have noted that I'm using a custom tool to generate the code. It's not a EF or a simple transformation; there's quite a bit of logic involved in the code generation. Also, it generates a complete namespace and class structure with partial classes. The 'root namespace' is found by extracting it from the <code>csproj</code> file and then using the folder structure to figure out the absolute namespace (it's similar to how Linq2sql does this).</p>

<p>The answer suggested by xanatos (thanks!) works: intellisense sorts its operation on the name, then alphabetically sorts on the name and then picks the first item in the list. This means that you can generate a <code>zzzz.foo.cs</code> which (albeit a bit ugly) will work just fine. I've just ran some experiments and found out that the feature <code>find all references</code> returns the order that VS appears to use. As it turns out, it works like this:</p>

<p>Say you have a custom tool that works on the filename <code>foo.bar</code> and transforms it into <code>foo.cs</code>. The custom tool will generate the content as string and pass it back to Visual studio (that's just how custom tools work...). The result will be in a file called <code>foo.cs</code>. </p>

<p>Now, I was quite surprised to found that Intellisense does <em>not</em> sort it as <code>foo.cs</code> but rather as <code>foo.bar\foo.cs</code>. In other words: regardless of how you name the 'cs' output in your custom tool, you have to rename the base file <code>foo.bar</code> to something like <code>zoo.bar</code>.</p>

<p>While that might be a workaround, I'm hesistant to accept it as the answer, because I would have to give files in my project strange names (names have meaning...). Also, some of my custom tools have dependencies on their filenames, so that will also get broken... </p>

<p>Therefore, I'm still open for suggestions on how to fix this properly. </p>