Reputation: 205
I have created a visual studio template which worked fine. But as soon I try to add a new project to my solution by using this new template I get the following error:
"The imported project "c:\users\xy\AppData\Local\Temp\Common\Shared\XY.projitems" was not found. Confirm
that the expression in the import declaration "..\..\Common\Shared\XY.projitems" is correct and that the
file exists on disk."c:\users\xy\AppData\Local\Temp\qfuczw4e.apk\Temp\MyTemplate1.csproj"
Background info:
My solution contains a shared project which is referenced in my project template
The import statement in *.csproj of my project template looks like this:
<Import Project="..\..\Common\Shared\XY.projitems" Label="Shared" />
The error message is very confusing to me. Anybody have a hint for me?
The project structure in which a new project will be created with the template is as follows:
Solution_XY
- SharedProject
- PluginsFolder
- Project_1
- Project_2
- Project_3
The projects created are located in a special project folder within the solution. So Project_1 to Project_3 need to have a reference to the SharedProject when created by the template.
Upvotes: 1
Views: 1462
Reputation: 710
I was having this same problem, and there is no answer on here for it. It is caused because parameter replacement is being done in a temporary folder, as you can see. It's anyone's guess why they are checking path.
Either way, the fix is to have the CreateInPlace template data set to 'true'.
<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Project">
<TemplateData>
...
<CreateInPlace>true</CreateInPlace>
</TemplateData>
This was a real pain to figure this out. Hopefully it will help somebody.
The problem isn't related to it being a multi project template. I solved this problem while making a multi project template.
Upvotes: 5