Closed frialex closed 8 years ago
I'm not sure of the reason why .csproj is in the preprocess exclude group
That's a bug, it should be removed. I created #70 to track it. I'll take care of it. In the meantime you can just remove it from your _preprocess.xml file.
If you do that does your template work as expected or is there more that needs to be done? FYI the .user file is special and it's created by the project system itself. I don't think that it will work if you add a .csproj.user file to your template, but not 100% sure.
Hey, Thanks for the quick reply!
My initial observation was that visual studio is mucking with the .csproj file. It takes some properties from the template but provides default values for others.
<ItemGroup> is transferred to instance
<PropertyGroup> IS NOT
<ProjectExtensions> IS NOT
Since <itemGroup>
is transferred over to an instance, all the files from the template are included in the instance.
<PropertyGroup>
and <ProjectExtensions>
(children of which control the web server settings) are given the default values.
To verify this I added a property group to the templates .csproj file. This property group is not present in the instance of the template created by visual studio. Furthermore, the .csproj file in the instance has the EXACT same <PropertyGroup>
and <ProjectExtensions>
as a new MVC application.
These tests were run on Windows 7, Visual Studio Pro 12.0.31101.00 Update 4. To create an instance of the template, I cleaned, built and hit start debugging on the solution containing the VSPackage.
This should be fixed in the recent versions of TemplateBuilder. If you continue to have issues, feel free to reopen.
My problem is that I want to create a template that will use IIS instead of IIS Express. I'm doing this because I want the newly created project to be a child app of an already established site. This established site will provide common Javascript and css for all child apps, along with a few HTTP endpoints. This hierarchy is there to prevent cross-domain rules from being applied on ajax requests.
The reason I don't want to mix IIS Express with IIS is due to port issues (one of them gotta run in a different port, thereby causing IE to apply cross-domain rules in ajax and breaking application). The second reason is consistency. I've ran in to inconsistent behaviors between the two in the past.
The crux of the problem is that visual studio puts the web server config settings in .csproj file. I'm not sure of the reason why .csproj is in the preprocess exclude group, but it does make sense since visual studio will give you a new csproj file with settings that are different than from what is in the template.
My first step was to put the IIS settings in .csproj.user file, and manually edit .csproj file to include the .user file as part of the template... But now the problem is to transform file names: Template.csproj.user to InstnceOfTemplate.csproj.user... This doesn't seem like a good way to go.
So now that dealing with .csproj files are out (or if you know of something that I've missed they are back in), I'm looking at other way to configure the project after creation.
During my research I've found that NuGet packages are able to run powershell scripts after they have been installed on to the project, so that kinda opens doors.. but those doors should have never been there in the first place.
It seems that you have something similar via Package class in the VSPackage project... and I'm going to explore that next.
But before I start exploring.. It look like I'm missing out on some information.
What I want to do is really simple:
Create an instance of the template that is EXACTLY like the template. If I've set up the template to use IIS then the instance should also use IIS. The ONLY difference being namespaces.
Any comments/Ideas?