开发者

Ignore files in Windows Azure virtual application

I want to have a virtual application inside a site. I have modified my ServiceDefinition.csdef as

<Site name="Web">
        <VirtualApplicati开发者_Go百科on name="MyVirtualApp" physicalDirectory="[path to my other web app]" />
        <Bindings>
          <Binding name="HttpIn" endpointName="HttpIn" />          
        </Bindings>
      </Site>

When I create the package, I see that it includes .cs files obj folder too. Which is useless. I don't want these files to be included in my package file(.cspkg).

What should I do so that when I publish, such type of files should not be included in the package file?


I don't think you can tell visual studio to do it. It only does this for your role associated web site project. So what you can do is copy your output files to a special folder in post build event. and point your physical directory to that:)


As a workaround, I created a Web Deployment Project. To exclude files in the output, you need to put

<ExcludeFromPackageFiles Include="[your file]">
    <FromTarget>Project</FromTarget>
</ExcludeFromPackageFiles>

And in the ServiceDefinition.csdef I specified the output path for web deployment project

<VirtualApplication name="MyVirtualApp" physicalDirectory="[output path of my web deployment project]" />


Use the publish feature in the original website project that you want to become a virtual application. Publish into a separate folder in your filesystem as if it were going to be a website hosted by IIS on your system. The Publish feature will strip out all unnecessary files.

Then in your .csdef file, use the path to your published site rather than to the folder your web project is in.


  1. Create a WebDeploy Profile
  2. Enlist all the files to exclude next to <OutputPath> on the .csproj like this<ExcludeFoldersFromDeployment>bin\file1.dll;file3.csv</ExcludeFoldersFromDeployment>. Detailed info here
  3. If you want, define a relative path for the publish drop location on the .pubxml file (generally found under Properties\PublishProfiles under the web project) such as <publishUrl>bin\WebDeployDropLocation</publishUrl>
  4. Provide the drop location to ServiceDefinitioin.csdef like this: <Site name="Web" physicalDirectory="..\..\..\MyWebApp\bin\WebDeployDropLocation"> under <Sites>. Documentation here.
  5. Publish the WebProject and verify the files, Create Package from the WebRole project.
  6. Edit the file name of the resulting .cspkg, change it to a .zip file to verify the contents
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜