Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - More on the renaming of MyApp to something more descriptive - anotherpainful bug

 
 
Old 01-31-2006   #1 (permalink)
Jason Dolinger


 
 

More on the renaming of MyApp to something more descriptive - anotherpainful bug

Ok, this is an even more frustrating one. I'd like to put my main
Application class in a different package than the one which it was
originally created in. For example, I create a new solution in VS.
Let's say that the namespace is MyNamespace and the files are MyApp.xaml
and MyApp.xaml.cs.

Now I'd like to put them into a namespace called CorrectNamespace, and
also put them in a matching folder hierarchy. I create a folder called
CorrectNamespace and drag MyApp in there. I also drag Window1.xaml in
there. Then I go into the source files and rename the namespaces
accordingly (which I shouldn't even have to do!).

A build and run attempt will give you the following error currently:

Error 2 Program 'C:\Documents and Settings\jdolinger\My Documents\Visual
Studio\Projects\WPF
Demos\DefaultNamespace\DefaultNamespace\obj\Debug\DefaultNamespace.exe'
does not contain a static 'Main' method suitable for an entry point
DefaultNamespace

This is because now that I moved MyApp, the VS/WPF does not recognize it
as an application, it thinks it's a window, which is the previous bug I
reported on. So as the fix to that, I fix the markup in the .csproj
file to change it from a "Page" tag to "ApplicationDefinition."
However, any further attempts to run the program result in this error:

Error 1 Source file 'C:\Documents and Settings\jdolinger\My
Documents\Visual Studio\Projects\WPF
Demos\DefaultNamespace\DefaultNamespace\obj\Debug\MyApp.g.cs' could not
be opened ('The system cannot find the file specified. ') DefaultNamespace

VS is clearly looking for MyApp.g.cs right under the Debug folder,
rather than "Debug\CorrectNamespace\MyApp.g.cs"

I can track this to the following line in the .csproj.FileList.txt file:

C:\Documents and Settings\jdolinger\My Documents\Visual
Studio\Projects\WPF
Demos\DefaultNamespace\DefaultNamespace\obj\Debug\MyApp.g.cs

I can temporarily fix the problem by deleting that file, or removing
that line from the file, but it always gets regenerated after a single
run, and I start getting the error again.

Can anyone at MS provide a workaround for this one, or some further
explanation?

Regards,
Jason

My System SpecsSystem Spec
Old 01-31-2006   #2 (permalink)
Daniel Marley [MSFT]


 
 

RE: More on the renaming of MyApp to something more descriptive - anot

Regarding not automatically renaming the namespaces inside a source file
after moving the file to a different folder, that is by design. Namespace and
folder structure don't need to match.

Regarding the issue with the .csproj.FileList.txt file having the wrong
path, I haven't been able to repro that. If you could provide the full
project, I can investigate the issue further.

--
--
- Daniel Marley [MSFT]
--
This posting is provided "AS IS" with no warranties, and confers no rights.


"Jason Dolinger" wrote:

> Ok, this is an even more frustrating one. I'd like to put my main
> Application class in a different package than the one which it was
> originally created in. For example, I create a new solution in VS.
> Let's say that the namespace is MyNamespace and the files are MyApp.xaml
> and MyApp.xaml.cs.
>
> Now I'd like to put them into a namespace called CorrectNamespace, and
> also put them in a matching folder hierarchy. I create a folder called
> CorrectNamespace and drag MyApp in there. I also drag Window1.xaml in
> there. Then I go into the source files and rename the namespaces
> accordingly (which I shouldn't even have to do!).
>
> A build and run attempt will give you the following error currently:
>
> Error 2 Program 'C:\Documents and Settings\jdolinger\My Documents\Visual
> Studio\Projects\WPF
> Demos\DefaultNamespace\DefaultNamespace\obj\Debug\DefaultNamespace.exe'
> does not contain a static 'Main' method suitable for an entry point
> DefaultNamespace
>
> This is because now that I moved MyApp, the VS/WPF does not recognize it
> as an application, it thinks it's a window, which is the previous bug I
> reported on. So as the fix to that, I fix the markup in the .csproj
> file to change it from a "Page" tag to "ApplicationDefinition."
> However, any further attempts to run the program result in this error:
>
> Error 1 Source file 'C:\Documents and Settings\jdolinger\My
> Documents\Visual Studio\Projects\WPF
> Demos\DefaultNamespace\DefaultNamespace\obj\Debug\MyApp.g.cs' could not
> be opened ('The system cannot find the file specified. ') DefaultNamespace
>
> VS is clearly looking for MyApp.g.cs right under the Debug folder,
> rather than "Debug\CorrectNamespace\MyApp.g.cs"
>
> I can track this to the following line in the .csproj.FileList.txt file:
>
> C:\Documents and Settings\jdolinger\My Documents\Visual
> Studio\Projects\WPF
> Demos\DefaultNamespace\DefaultNamespace\obj\Debug\MyApp.g.cs
>
> I can temporarily fix the problem by deleting that file, or removing
> that line from the file, but it always gets regenerated after a single
> run, and I start getting the error again.
>
> Can anyone at MS provide a workaround for this one, or some further
> explanation?
>
> Regards,
> Jason
>

My System SpecsSystem Spec
Old 01-31-2006   #3 (permalink)
Jason Dolinger


 
 

Re: More on the renaming of MyApp to something more descriptive -anot

Daniel Marley [MSFT] wrote:
> Regarding not automatically renaming the namespaces inside a source file
> after moving the file to a different folder, that is by design. Namespace and
> folder structure don't need to match.
>
> Regarding the issue with the .csproj.FileList.txt file having the wrong
> path, I haven't been able to repro that. If you could provide the full
> project, I can investigate the issue further.
>


Thanks, Daniel. Could you contact me with an address to send you the code?
My System SpecsSystem Spec
Old 01-31-2006   #4 (permalink)
Daniel Marley [MSFT]


 
 

Re: More on the renaming of MyApp to something more descriptive -

As we followed up via email, I confirmed the issue in the December CTP bits,
and it appears that issue is addressed in current private bits.

--
--
- Daniel Marley [MSFT]
--
This posting is provided "AS IS" with no warranties, and confers no rights.


"Jason Dolinger" wrote:

> Daniel Marley [MSFT] wrote:
> > Regarding not automatically renaming the namespaces inside a source file
> > after moving the file to a different folder, that is by design. Namespace and
> > folder structure don't need to match.
> >
> > Regarding the issue with the .csproj.FileList.txt file having the wrong
> > path, I haven't been able to repro that. If you could provide the full
> > project, I can investigate the issue further.
> >

>
> Thanks, Daniel. Could you contact me with an address to send you the code?
>

My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
MyApp.exe.config vs MyApp.config .NET General
Renaming A DVD Drive? Vista General
Renaming a file Vista file management
Renaming Bug Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46