Visual Studio 2010 not deploying XSL file to SharePoint 2010 - visual-studio-2010

So I have a SharePoint 2010 project in Visual Studio 2010 and I have defined a fldtypes_*.xsl file. I put the file into a mapped directory /Template/Layouts/XSL, however, when I deploy the application using Build->Deploy , the file is not copied.
I can copy the file manually, and it works great, but there must be a way to make it copy with the regular deployment process.
Does anyone know what's wrong?

Try to refer to your .xsl file, using relative path:
"/_XSL/path/to/xslFile.xsl"
I assume you chose Add -> SharePoint Mapped Folder... but TEMPLATES and LAYOUTS were not added when you selected the XSL folder, hence there were not added to the folders tree in the project.

Apparently, the issue was I had added a mapped folder to "Layouts", then just added the XSL folder underneath that, expecting it to be deployed along with the rest of the stuff in the layouts folder. That is not the case.
I added a mapped directory directly to the XSL folder and deployed and it works fine. Not sure why the previous setup didn't work, as that's the way it is shown in all the examples, but there you go.

Related

Visual Studio 2022 Custom Project Template doesn't show after unzipping / zipping

I have created a new Project Template by exporting a project via Project -> Export Template. Opening Visual Studio now, I can see my template showing up.
I then went to
Documents\Visual Studio 2022\My Exported Templates
and moved the MyTemplate.zip to another folder. Went to
Documents\Visual Studio 2022\Templates\ProjectTemplates
and made sure that MyTemplate.zip is not in there as well.
Now when I open VS again, I can see that my template is not available anymore.
To counter check, I moved the zip back into Documents\Visual Studio 2022\Templates\ProjectTemplates , reopened VS and made sure that the template is visible again.
I then went ahead, extracted MyTemplate.zip and compressed it into a zip again (Right Click -> Compress to Zip). Now when I move that zip into Documents\Visual Studio 2022\Templates\ProjectTemplates and restart VS, the template does not show up.
Bottom line, I am unable to import any template that I have manually compressed into a zip archive, seems like something is happening to the zip during extract / compress. I have been testing this on Win 11 with the OOB zip tools as well as nanazip.
Did you try extracting your template project ZIP file?
I was struggling as well but as soon as I extracted my custom template project with the rest of the Default templates it started showing up.
VS template is looking for folders in the ..\Visual Studio 2022\Templates\ProjectTemplates\ not a zip file. If you want your template to show up, move its folder there.
In my case the problem was that I named the XML file .vstemplate. It needs to be something.vstemplate.

Opening a Visual Studio 2010 project in 2012 what creates the backup folder and how to control it?

I have an issue. We are upgrading to VS 2012 at work. When we open a VS 2010 project Visual Studio converts the project. This is fine, because VS 2010 can still use the project (yay microsoft). However, there is a \Backup folder created in the solution directory. Is this being created as part of the migration? Is there any way to control it?
The reason I ask is that the process that makes this folder copies web.config files into the folder. If you then try to build the solution (these are MVC projects), we get a "It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS." error. The cause is that there is a web.config file in a subfolder instead of the root folder. We did not make and do not want this change, and cannot figure out how to control it. Deleting the Backup\Web.config file fixes the error. Renaming it from web.config to web.config.bak fixes the problem.
I don't really want to have to personally open and convert every single project, and don't want random people bumping into this problem. Any idea how to either stop VS from creating the Backup folder, or how to make it create them in the my documents studio folder etc? I can't find any setting to control this and can't find any good info.
By chance, are you using the MvcBuildViews property to pre-compile your views at build time? If so, this is why you're encountering this (since it does the pre-compile in the same directory, it doesn't filter out any of the files below the project directory).
Note that you will also encounter this issue if you use the Publish feature for this project. Publish copies the web.config under your intermediate build output directory (by default, obj/) before and after applying web.config transforms.
The good news is that in VS2012, or in VS2010 with the latest Azure SDK installed, pre-compile is now supported for Web Application Projects (including MVC). These settings are currently in the project properties, under the Package/Publish Web tab.
(this doesn't directly address your question about the Backup folder, but it was too long for a comment.)
There is no way to control it that I found. We had to go ahead and run through and convert every project to 2012 and delete the backup folders to prevent any other team from running into it.

Visual Studio Gallery - MVC Project Template Failing to Upload

I've created a Visual Studio 2010 ASP.NET MVC Project Template as a VSIX package that I'd like to upload to the Visual Studio Gallery, but every time I try it tells me the path is too long...
Locally, it installs and works without issue...
The structure of the project (zipped as t.zip to try and reduce the length) is a standard MVC structured project, the only caveat is that it needs (well, doesn't need to but makes sense for it be there) installs to the Web sub-folder under the C# language, so the path inside the VSIX package is ProjectTemplate\CSharp\Web.
Is there a way around this limitation, or am I simply doing something wrong?
There is a check when you upload to the VS Gallery to see if the path length might end up being too long when installed on the users machine. This check includes not only the files directly in your VSIX, but also the files embedded inside the zip file. (This is because templates are unzipped on disk before they are used for instantiating a new project.)
Unfortunately, I think your only option is to shorten-up the paths of the files in the template itself.

Visual Studio and TortoiseHg: folder not visible in VS

I created a C# project and added it to source control (mercurial). I can edit files in VS, commit it and push it using TortoiseHg. It goes to the server. When some one pulls they get the files.
In my visual studio I added a folder and a file inside that folder. I used TortoiseHg and it saw the new file in the new folder. I committed it and pushed it.
However, now someone pulled the latest code from the server - and they got the new file (it is visible through windows explorer), but when they open the solution in VS, they don't see the file.
Does someone have an idea what is wrong here? or things I should check? Thank you for the help.
P.S. I have visual studio 2010 express (so I can't use the VisualHg plugin).
Visual Studio caches changes to the solution and project until an explicit save or a build. In your comment:
In my visual studio I added a folder and a file inside that folder. I used TortoiseHg and it saw the new file in the new folder. I committed it and pushed it.
I see that an updated .sln or .vcproj file was not mentioned and checked in. Did you see an update to either of these files via TortoiseHg? If not, make sure to build or save your project after a change like this.
Did you make sure that the Visual Studio Project File or Solution file is being updated and committed?
VS solution contains projects and each project select managed files by metadata(***.vcproj file). It's not the way include all files from root directory.
So, your co-workers can see new added files by in following two ways.
1) share project file(***.vcproj)
2) manually add files in each person's VS instance.

Make visual studio deploy a folder's content without having to update it in the project

In my web project I often have a number of files in my app_data folder. These files can vary from time to time (example translation files get a new language, lucene index gets updated and gets a new file name etc).
Visual studio only adds files to the deployment process if the files are seperately added to the project. So if a file has been added on disk, but not in the project, this file will not be copied to the server...
Is there a way to make VS add all files in a folder to the deployment process without me having to update it manually?
You can use a post build event to copy the contents of a folder to the build target.
This should get you started:
http://visualstudiohacks.com/general/customize-your-project-build-process/
Wow I just saw this was asked in 2009...I hope you figured this out already :)

Resources