Click here to Skip to main content
15,891,567 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created project template for my project.I unzipped the Project Template and looked into every .cs files and it was showing errors.
A namespace with
$safeprojectname$.Constants
is created.
The $ character shows errors - Unexpected Character'$'

I have to clear this issue before adding to Templates folder where i can use.

What I have tried:

I had previously created a dummy set of projects with no files in it and created a template out of it.Since it didn't have any .cs files I was able to use the template.Now the project out of which i am creating template is having many .cs files.
What am i supposed to do?
Posted
Updated 1-Mar-16 0:41am

If you are opening the templates and extracting the files, then that's why you get errors.
In template files, template variable names are delimited by a dollar sign. So $safeprojectname$ is a template variable which will be replaced with the safe project name when the template is expanded into a "proper" project.
Instead of opening the zip manually and extracting the files, use the Visual Studio "Add...New project" widget and create a project based on the template file. That way, the template items will be replaced with the correct data for you.
 
Share this answer
 
Visual Studio right $...$ is unexpected and will be replaced only when you create an instance based on this template...
The fascinating thing is that those files are signed not to compile - and for that you can compile the project without errors - but if you open the file Visual Studio will still try and parse it, and fails...(I reported this as a bug to Microsoft some 2 years ago - they did the usual thing)...
So there is no problem with that, the template still usable, but instead of opening it you should install it with Visual Studio and instantiate it...

Some more readings: Visual Studio Templates[^]
 
Share this answer
 
Comments
Member 1097736 2-Mar-16 2:03am    
Hi thanks for responding.The quick fix i made is i changed the .cs files from compile type to content type.But i have another issue because of it,When i make apiconfig, routeconfig files to content type ,I face error in global.asax file which calls these class files(apiconfig,routeconfig,etc).Do you have any solution?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900