Running transformation: Cannot retrieve ProjectItem for ScaffoldingGeneratorCommand.tt

67 views
Skip to first unread message

Dan

unread,
Feb 21, 2009, 3:04:24 PM2/21/09
to S#arp Architecture
Grabbing the latest from svn this morning, I got a S#arp project
created from the template with no errors. I have installed T4 and
follow the directions to modify ScaffoldingGeneratorCommand.tt and
Save.

However, I get an error in the Error List window:
Running transformation: Cannot retrieve ProjectItem for c:\dev\test
\tools\CrudScaffolding\ScaffoldingGeneratorCommand.tt

The log file is uininteresting:
Opened solution for addition of generated files
Closed solution after addition of generated files

It also appears that no files actually got generated (searching the
file system and also looking at the unincluded files in the VS
explorer).

This is on XP SP3 (32 bit) and VS2008.

Note: This is on the one computer that generated the project from the
template, in case anyone was following my other post.

Anyone see this before? Any ideas on what I'm doing wrong? I'm
assuming this works for others.

Billy

unread,
Feb 21, 2009, 9:10:31 PM2/21/09
to S#arp Architecture
This is strange error and one that I have not seen before. Does it
work if you revert ScaffoldingGeneratorCommand.tt back to its original
state, uncomment the "Run" line and give it a try?

Billy

Leonidas

unread,
Feb 22, 2009, 8:29:06 AM2/22/09
to S#arp Architecture
I essentially have the same issue. I have nearly the same environment
as Dan too. I have found I can only generate the original
ScaffoldingGeneratorCommand.tt right out of the box. Any editing at
all of that file causes the error Dan reported. Even if I back out the
changes to revert to the original form. It seems once you get the
error, you are doomed. I have tried many variations of saving the
solution and reloading, etc.

Dan

unread,
Feb 22, 2009, 9:46:36 AM2/22/09
to S#arp Architecture
I restored the original tt and uncommented the generator line. I also
deleted the suo file before opening the solution back up. Saving the
generator, here is what happens:
* Generates Worker.cs, WorkersControllerTest.cs, and WorkerTest.cs
* Prompted me to Reload/Ignore test.Core and test.Tests during the
generation
* Did not move WorkersControllerTest.cs to the test.Tests project. The
Organization folder got created, but not included in the project, but
the cs file did not move over (it still exists under the tt template).
* All of the created files still exist under the tt template
* It gave me this stack trace in the Error List window

After doing this once, I get the same error/behavior I reported at the
beginning of this thread.

Error 1 Running transformation: System.IO.IOException: The process
cannot access the file because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String
maybeFullPath)
at System.IO.__Error.WinIOError()
at System.IO.File.Move(String sourceFileName, String destFileName)
at
Microsoft.VisualStudio.TextTemplating4992C1AD830950F1366E9C893CC252D4.GeneratedTextTransformation.ScaffoldingGenerator.GenerateControllerAndTests
() in c:\dev\test\tools\CrudScaffolding\Templates
\ScaffoldingGenerator.tt:line 150
at
Microsoft.VisualStudio.TextTemplating4992C1AD830950F1366E9C893CC252D4.GeneratedTextTransformation.ScaffoldingGenerator.RunCore
() in c:\dev\test\tools\CrudScaffolding\Templates
\ScaffoldingGenerator.tt:line 39
at
Microsoft.VisualStudio.TextTemplating4992C1AD830950F1366E9C893CC252D4.GeneratedTextTransformation.Generator.Run
() in c:\Program Files\T4 Toolbox\T4Toolbox\Generator.tt:line 68
at
Microsoft.VisualStudio.TextTemplating4992C1AD830950F1366E9C893CC252D4.GeneratedTextTransformation.TransformText
() in c:\dev\test\tools\CrudScaffolding
\ScaffoldingGeneratorCommand.tt:line 45 C:\dev\test\tools
\CrudScaffolding\ScaffoldingGeneratorCommand.tt 1

Billy

unread,
Feb 23, 2009, 7:11:24 AM2/23/09
to S#arp Architecture
Thank you for the details Dan. Although I cannot reproduce, this
error report should be enough for me to do some experimenting with to
see if I can proactively remedy a file lock, if encountered.

Billy

Dan

unread,
Feb 23, 2009, 2:41:00 PM2/23/09
to S#arp Architecture
Big news on my end. I uninstalled Developer Express' CodeRush and
Refactor from my IDE and tried again, and the experience is MUCH
better. No more errors and I can run the scaffolding multiple times.
Uninstalling the DevEx stuff also fixed my other report about the
Access Denied during a new project.

I'll contact DevEx to let them know about the potential T4
incompatibility. I'll try Resharper next, but I'm betting that will be
ok. I'll report back if it's not.

In the meantime, here are my latest findings:

* I get prompted a lot to Reload/Ignore. I thought I read somewhere in
this group that this wasn't supposed to be happening any more. Is it
supposed to?

* I finally get the FULL set of files being created. Yay! :) I get
Create.aspx, Edit.aspx, Index.aspx, Show.aspx, WorkerForm.aspx, and
the 4 cs files (compare to the 3 cs files that were getting created
before). They are placed in the right projects, too. However, they
aren't getting deleted from the scaffold project. I thought I read
that this wasn't supposed to be happening any more. Are those files
supposed to be deleted automatically?

Thanks for your help so far.

Dan

Billy

unread,
Mar 4, 2009, 12:47:38 AM3/4/09
to S#arp Architecture
Hi Dan,

VS will always prompt you to reload since the projects themselves were
modified. Unless I'm mistaken, it is not possible to squelch this
behavior.

Concerning the removal of the moved artifacts from the CrudScaffolding
project, I've been unable to find a resolution for this. With that
said, having them "hang out" on CrudScaffolding doesn't hurt anything
as the project isn't included in the build process. They might be a
little unsightly to look at, dangling there under the generator.tt
file, but they shouldn't be causing any harm.

Billy
> > > Error   1      Runningtransformation: System.IO.IOException: The process
> > > cannot access the file because it is being used by another process.
> > >    at System.IO.__Error.WinIOError(Int32 errorCode, String
> > > maybeFullPath)
> > >    at System.IO.__Error.WinIOError()
> > >    at System.IO.File.Move(String sourceFileName, String destFileName)
> > >    at
> > > Microsoft.VisualStudio.TextTemplating4992C1AD830950F1366E9C893CC252D4.Gener­atedTextTransformation.ScaffoldingGenerator.GenerateControllerAndTests
> > > () in c:\dev\test\tools\CrudScaffolding\Templates
> > > \ScaffoldingGenerator.tt:line 150
> > >    at
> > > Microsoft.VisualStudio.TextTemplating4992C1AD830950F1366E9C893CC252D4.Gener­atedTextTransformation.ScaffoldingGenerator.RunCore
> > > () in c:\dev\test\tools\CrudScaffolding\Templates
> > > \ScaffoldingGenerator.tt:line 39
> > >    at
> > > Microsoft.VisualStudio.TextTemplating4992C1AD830950F1366E9C893CC252D4.Gener­atedTextTransformation.Generator.Run
> > > () in c:\Program Files\T4 Toolbox\T4Toolbox\Generator.tt:line 68
> > >    at
> > > Microsoft.VisualStudio.TextTemplating4992C1AD830950F1366E9C893CC252D4.Gener­atedTextTransformation.TransformText
> > > () in c:\dev\test\tools\CrudScaffolding
> > > \ScaffoldingGeneratorCommand.tt:line 45 C:\dev\test\tools
> > > \CrudScaffolding\ScaffoldingGeneratorCommand.tt 1
>
> > > On Feb 21, 8:10 pm, Billy <wmccaffe...@gmail.com> wrote:
>
> > > > This is strange error and one that I have not seen before.  Does it
> > > > work if you revert ScaffoldingGeneratorCommand.tt back to its original
> > > > state, uncomment the "Run" line and give it a try?
>
> > > > Billy
>
> > > > On Feb 21, 1:04 pm, Dan <dmi...@wi.rr.com> wrote:
>
> > > > > Grabbing the latest from svn this morning, I got a S#arp project
> > > > > created from the template with no errors. I have installed T4 and
> > > > > follow the directions to modify ScaffoldingGeneratorCommand.tt and
> > > > > Save.
>
> > > > > However, I get an error in the Error List window:
> > > > >Runningtransformation: Cannot retrieve ProjectItem for c:\dev\test
> > > > > \tools\CrudScaffolding\ScaffoldingGeneratorCommand.tt
>
> > > > > The log file is uininteresting:
> > > > > Opened solution for addition of generated files
> > > > > Closed solution after addition of generated files
>
> > > > > It also appears that no files actually got generated (searching the
> > > > > file system and also looking at the unincluded files in the VS
> > > > > explorer).
>
> > > > > This is on XP SP3 (32 bit) and VS2008.
>
> > > > > Note: This is on the one computer that generated the project from the
> > > > > template, in case anyone was following my other post.
>
> > > > > Anyone see this before? Any ideas on what I'm doing wrong? I'm
> > > > > assuming this works for others.- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages