Q:
I'm having trouble actually creating a new add-in project using the template. I have the several files that make up the template. I took the .vstemplate file from the VB version and edited it to match the file names of the C# edition. I stuck all the files into a zip file. I ran "vsta /hostid [application] /setup" to install the template. After doing so, the VSTA IDE's New Project now offered a C# template where before there had been none. But when I choose the template and go to create the new add-in project, I always get a dialog that says:
“Unable to copy the file “AssemblyInfo.cs” from the project template to the project. Cannot find file “C:\Documents and Settings\[username]\Local Settings\Temp\3erhjrc.zyk\Temp\Properties\AssemblyInfo.cs”.
That funky node in the orange text is different each time; I assume it's just a randomly generated temporary folder. Investigating, I find that the funky folder does in fact exist, but is empty. Not surprisingly, it was created at the time of the experiment. It is not only empty of files, but also of the subordinate folders that are mentioned in the error message (Temp\Properties). So in that sense, the message is correct: it can't find AssemblyInfo.cs because it isn't there.
If I go sniff around the file system, I see that it did in fact partially create a new add-in project for me.
It gave me sln and suo files, and set up a folder hierarchy that looks reasonable. There are no other files in the other folders.
A:
I took the .vstemplate file from the VB version and edited it to match the file names of the C# edition.
That is the first step that need to be taken to translate the template. You will also need to:
1) Change the actual files to C# files instead of VB files- I would do this by using the files included with the SharpAppBasicCSharp template sample and making whatever changes you need to mirror your VB template.
2) Update the csproj file. There are several places that need to be changed. When I’ve attempted this before I used Windiff on the csproj and vbproj files from the templates included with the ShapeAppBasicCSharp sample. After spending more than an hour on this and not getting it working, I opted to start with the csproj file from the ShapeAppBasicCSharp sample and change it to meet my needs instead of starting with a vbproj file. Either way it is tedious and you will get to know a lot about Visual Studio templates and template schema. There are excellent resources on MSDN about this that I found very helpful. Here’s a link to get you started: Visual Studio Templates
As to the particular error you are getting- this is occurring when Visual Studio/VSTA is trying to create a project based on the template and running into an issue with the supporting files (#1 above) or the csproj file (#2). I believe that odd random temporary locations are used for the initial extraction. You should also verify that the file appearing in this error “AssemblyInfo.cs” exists in the template folder, is a valid AssemblyInfo.cs file, and is in a valid location (all files should be in one zip folder, none should be in sub folders in the zip folder).
Posted
May 22 2009, 01:53 PM
by
BillL