I am creating a custom master page through feature in sharepoint 2010 visual studio and on deploying the feature I am getting this
Error occurred in deployment step 'Activate Features': Failed to instantiate file "custom.master" from module "CustomMaster": Source path "Features\WSPBuilderImportProject2_SiteElements2db64791-54f6-4571-a161-66e0ef6497f5\custom.master" not found.
RHM, your final url is doubled up. effectively you're trying to publish to _catalogs/masterpage/_catalogs/masterpage. try to only specify the list url in the module element and then put the remainder in without the path. I.e.
If you deploy the masterpage as part as an feature (SharePoint solution) with for example Visual Studio 2010, the MasterPage will be deployed to the features directory. The feature file will provision the masterpage to the MasterPage Gallery (_Catalogs). As long as the file is not customized by SharePoint Designer, sharepoint will serve the masterpage (by using the virtual path provider) from the filesystem and not from the database.
<File Path="MasterPageModule\abc.master" Url="_catalogs/masterpage/abc.master" Type="GhostableInLibrary" />
Deploy the master page. You can now control the master page by changing it from its physical location (SharePoint Root - 14 folder) and still be able to access from /_catalogs/masterpage/abc.master
The above is the recommended approach when you deploy master pages and page layouts.
This is a fairly self explained error. SharePoint is not able to find the file in the location you have specified in Elements.xml. Check the location if it exists and retry.
My module folder has master page in it with name of "custom.master" and here is the xml
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Url="_catalogs/masterpage" RootWebOnly="FALSE" Name="CustomMaster">
<File Type="GhostableInLibrary" Url="_catalogs/masterpage/custom.master" Path="CustomMaster\custom.master" />
</Module>
</Elements>
I was having this same problem and having checked and double checked all my paths, urls etc were correct the master was just not being provisioned by the feature.
It turned out the VS2010 had got a little confused and messed up the path in the spdata file. If you're in the same situation definitely worth checking.
Related
I have an Azure shared web site. I publish my web site using Visual Studio 2013 and the operation succeeds, yet certain files are reported by the browser as missing while others are fine. The files that end up in the missing category are all binary data files for a game. All the "normal" web files (HTML, JS, CSS, etc.) appear to be fine. Is there some kind of special steps I need to take to publish binary data to an Azure web site?
Note, from within Visual Studio 2013 I tried to publish individually one of the missing files by using the Publish Single File option. The publish operation succeeds, but still, the browser can't find the file when it tries to load it. Note, I don't think it's a file size issue because several of the binary data files are only around 3 MB in size.
To fix this issue, FTP into your website and upload the following Web.config file which will set the correct MIME types. If you already have a Web.config file in place, just add the below to the appropriate section. Replacing .json and application/json with the file you're trying to load.
<?xml version="1.0"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
</system.webServer>
</configuration>
I'm guessing in this instance you haven't configured the mimeTypes for these files, if they are to be served through the server. There's a quick explanation and an appropriate resolution to your problem.
HTH
I just upgraded a Web Site project from VS2010 to VS2012 and I was looking into figuring out how to do what I used to do in the DeploymentPackage projects. There is a lot of good questions and answers I've read through on stackoverflow and I know what to do once I am able to find the files I need. For some reason my web.config doesn't have the two files underneath it (Web.Debug.config and Web.Release.config). I've installed the Web Platform Installer stuff and created my profile. I also created a custom configuration for deployment but I still am unable to see these files get created so that I can start changing some of my web.config settings on deploy time. Does anybody know if there's some setting/trick to get these files to show up in a migrated project?
If you don't see the files web.debug.config or web.release.config beneath the web.config file it could be because they are hidden. In the solution explorer panel if you click "show all files" they should appear.
I found the answer in a post here: how to add files in web.config transformation process?
In your "App Data" folder you'll find your publish profiles you created and can right click on them to add a config transform file.
I am using Microsoft's AjaxMin to minify javascript on my website, which is hosted by Azure. I am using a BuildTask to automatically minify javascript at run time. This build task is specified in the .csproj file.
The process is working on my local environment, however, it does not work when I deploy to my Azure site. The azure site throws 404: file not found errors, when i try to reference the minified version of .js files.
Is it possible to use build tasks on an Azure site? Is there anything I am missing? I have made sure not to include the .min.js files in source control as this (http://www.asp.net/ajaxlibrary/AjaxMinQuickStart.ashx) tutorial suggests, but I am wondering if there is anything specific to Azure that I need to set up.
Thanks!
I've got this working properly in my projects. I'll tell you how I did it, though this may not be the simplest or most straightforward way.
Before we get started, it's helpful to be able to check if your minified files are included in the Azure deployment package without actually deploying. It's pretty easy to do. The .cspkg file is actually a zip-formatted file, so you can open it with any zip archiver. (I like to use 7Zip for this because the right-click -> Open Archive command doesn't require you to rename the file, but you could use Windows Explorer, WinRAR, etc.) Inside the .cspkg you'll see another large file with a .cssx extension. That's a zip file too. Inside of the .cssx you'll find a sitesroot folder with a subdirectory for each website you're deploying, which will contain all your actual website files. So you can poke around in there and see what files are being deployed to Azure.
First, try editing the project file for your web project (the one that contains all the Javascript/CSS files). You can use Notepad, or in Visual Studio right-click the project, select "Unload Project", then right-click again and select "Edit ". Inside the project file, insert a section like this:
<ItemGroup>
<!-- Copy over all the minified CSS & JS to the output directory-->
<Content Include="**\*.min.css" />
<Content Include="**\*.min.js" />
</ItemGroup>
Then reload the project, repackage it, and see if your files are included in the .cspkg file. If they are, then you're done.
If not, there are a couple other things to check. Your minification might not be running at the right build stage. My minification target looks like this:
<Target Name="PrepWebApp" Condition="$(Configuration)=='Release'" AfterTargets="AfterBuild">
If that's still not working and your Web Role has multiple Sites and/or Virtual Applications in it, it's possible that the packaging steps are not running for all of the sites. So when you go to package your project for deployment to Azure, it may still not be running the minification step (along with the web.config transformations, and some other things). If that's the case, see this blog post for a way to fix it.
Just in case that blog post goes away, I'll copy the most relevant bit here. You would put this in the .ccproj file for your web role (with appropriate bits changed to match your project structure):
<PropertyGroup>
<!-- Inject the publication of "secondary" sites into the Windows Azure build/project packaging process. -->
<CoreBuildDependsOn>
CleanSecondarySites;
PublishSecondarySites;
$(CoreBuildDependsOn)
</CoreBuildDependsOn>
<!-- This is the directory within the web application project directory to which the project will be "published" for later packaging by the Azure project. -->
<SecondarySitePublishDir>azure.publish\</SecondarySitePublishDir>
</PropertyGroup>
<!-- These SecondarySite items represent the collection of sites (other than the web application associated with the role) that need special packaging. -->
<ItemGroup>
<SecondarySite Include="..\WebApplication1\WebApplication1.csproj" />
<SecondarySite Include="..\WebApplication2\WebApplication2.csproj" />
</ItemGroup>
<Target Name="CleanSecondarySites">
<RemoveDir Directories="%(SecondarySite.RootDir)%(Directory)$(SecondarySitePublishDir)" />
</Target>
<Target Name="PublishSecondarySites" Condition="'$(PackageForComputeEmulator)' == 'true'
Or '$(IsExecutingPublishTarget)' == 'true' ">
<!--
Execute the Build (and more importantly the _WPPCopyWebApplication) target to "publish" each secondary web application project.
Note the setting of the WebProjectOutputDir property; this is where the project will be published to be later picked up by CSPack.
-->
<MSBuild Projects="%(SecondarySite.Identity)" Targets="Build;_WPPCopyWebApplication" Properties="Configuration=$(Configuration);Platform=$(Platform);WebProjectOutputDir=$(SecondarySitePublishDir)" />
The build task will run in Visual Studio when you build the project. You need to make sure that the minified files are also being deployed to Azure.
I'm guessing that perhaps because the item is being generated at build-time that it's not part of the project itself, and is this ignored by the deployment step.
Please check that the deployment system being used will include all the script files and not just the ones that are in the project itself.
I have a .browser file that I need to deploy to the following location:
c:\browsers\
as part of a moss .wsp file. Can I do this in the manifest.xml or as part of a feature?
It is not possible. You can use the wsp solution to deploy any File to
Inside 12 Hive Folder Hierarchy
GAC
bin Folder of the Web Application.
Rest of the other location you need to look out for the custom solution. One option I can say is to use a Feature Installed event and keep it a Farm Feature.
Now i am using the sharepoint extensions 1.2 for Visual Studio 2005 to deploy my website. I want to add an assembly to the bin, but i don't know how to add it to the Team Definition.
Could someone give some code, plz?
OK I found a solution.
First you have to add the assembly you want to deploy into the VS project. For example you can create a "libs" folder to store all external assemblies you'll need in your team site.
Then you have to edit the manifest.xml file of your Team Site Definition. You can find this file within the "pkg" folder within your project. Be aware that the pkg folder will only be available if you've at least deployed the solution one time.
OK, now you have to add a new <Assembly> child element to the <Assemblies> element within the manifest.xml file of your Team Definition solution. With the "DeploymentTarget" Attribute you can define whether the assembly should be deployed to the GAC or to the web application's bin folder.
The following example shows how the <Assemblies> element looks like if you want to add the "TeamSiteDefinition1.dll" to the GAC and to add the "TestSolution.dll" to the bin folder. If you need a safe control entry for your assembly you can add this one too.
<Assemblies>
<Assembly Location="TeamSiteDefinition1.dll" DeploymentTarget="GlobalAssemblyCache" />
<Assembly Location="TestSolution.dll" DeploymentTarget="WebApplication">
<SafeControls>
<SafeControl ..... />
</SafeControls>
</Assembly>
</Assemblies>
If there's any SharePoint-relevant code (web part, event receiver etc) in your project, the assembly will be packaged up in the resulting WSP and your solution manifest will already have an instruction to put it into the GAC. Any particular reason you need it in the bin rather than the GAC? It can be done -- read up the documentation on the Solution Manifest XML format -- but requires manipulating the solution manifest from WSP View manually, and might require re-creating the WSP with WspBuilder.