开发者

Visual Studio 2010 SharePoint Replaceable Parameter is not being replaced

开发者 https://www.devze.com 2023-01-31 08:46 出处:网络
I\'m creating a custom WCF service for deployment inside SharePoint 2010 following the instructions on the SharePoint Bits Blog.

I'm creating a custom WCF service for deployment inside SharePoint 2010 following the instructions on the SharePoint Bits Blog.

As step 3 says, I am building contents of my .SVC file. Note that this is a blank text file with a .SVC extension, and I have manually entered the text into this file.

<%@ ServiceHost 
Language="C#" 
Factory="...(omited for length)..."
Service="Assembly.MyService, $SharePoint.Project.AssemblyFullName$" %>

The $SharePoint.Project.AssemblyFullName$ is a replaceable parameter that visual studio is supposed to replace with the开发者_高级运维 strong name of the assembly built by my project when the solution is packaged.

The problem is that the replaceable parameter isn't getting replaced during the package step. My project also includes a visual web part (the .webpart file of which contains the same replaceable parameter) that is having its replaceable parameter replaced correctly.

how do I get the replaceable parameter in my .SVC file to replace during the package step?


Preferred option is to add a new PropertyGroup to the Project.csproj file manually in Notepad (aaargh), but then at least it works on a fresh checkout / other dev pc as well:

  <PropertyGroup>
    <TokenReplacementFileExtensions>svc</TokenReplacementFileExtensions>
  </PropertyGroup>


Have you added .SVC file extension to this list:

Although tokens can theoretically be used by any file that belongs to a SharePoint project item included in the package, by default, Visual Studio searches for tokens only in package files, manifest files, and files that have the following extensions:

XML

ASCX

ASPX

Webpart

DWP

These extensions are defined by the element in the Microsoft.VisualStudio.SharePoint.targets file, located in the …\\MSBuild\Microsoft\VisualStudio\v10.0\SharePointTools folder.

You can, however, add additional file extensions to the list. To do this, add a element to any PropertyGroup in the SharePoint project file that is defined before the of the SharePoint targets file.

0

精彩评论

暂无评论...
验证码 换一张
取 消