Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.aspx and .asax files don't get published #24

Closed
chucker opened this issue Sep 17, 2021 · 7 comments
Closed

.aspx and .asax files don't get published #24

chucker opened this issue Sep 17, 2021 · 7 comments

Comments

@chucker
Copy link

chucker commented Sep 17, 2021

I'm deploying as follows:

msbuild /t:Restore,Rebuild /p:DeployOnBuild=true /p:PublishProfile=Live.pubxml
/p:Password="(my password)" /p:Configuration=Live .\MyProject\MyProject.csproj

This does build a new DLL and upload that and its dependencies to the server. However, it does not replace any aspx files on the server.

I notice VS infers the build action for aspx as None, and I'm not seeing a reason at a glance, in my csproj. Some snippets:

<Project Sdk="MSBuild.SDK.SystemWeb/4.0.49">
  <PropertyGroup>
    <TargetFramework>net472</TargetFramework>
    <UseIISExpress>true</UseIISExpress>
    <IISExpressSSLPort>44304</IISExpressSSLPort>
    <IISExpressAnonymousAuthentication />
    <IISExpressWindowsAuthentication />
    <IISExpressUseClassicPipelineMode />
    <UseGlobalApplicationHostFile />
    <Use64BitIISExpress />
    <LangVersion>9.0</LangVersion>
    <AssemblyTitle>MyProject</AssemblyTitle>
  </PropertyGroup>
  <ItemGroup>
    [.. a few package references]
  </ItemGroup>
  <ItemGroup>
    [.. a few linked files to add to compilation]
  </ItemGroup>
  <ItemGroup>
    <PackageReference Update="Microsoft.Net.Compilers.Toolset" Version="3.11.0" />
  </ItemGroup>
</Project>

I'm guessing asmx and ascx files would be affected as well.

So I think the default item includes should have:

  <ItemGroup>
    <Content Include="*.asax" />
    <Content Include="*.ascx" />
    <Content Include="*.asmx" />
    <Content Include="*.aspx" />
  </ItemGroup>
@CZEMacLeod
Copy link
Owner

It has been a while since I did webforms development (I mainly use/maintain MVC and Razor these days).
Are there any other types that should be included? I seem to remember master pages (.master?).
I believe these should be recursive so they include at any depth of folder, not just the root so probably something like

  <ItemGroup>
    <Content Include="**\*.asax" />
    <Content Include="**\*.ascx" />
    <Content Include="**\*.asmx" />
    <Content Include="**\*.aspx" />
    <Content Include="**\*.master" />
  </ItemGroup>

I'll look at adding these as default includes, perhaps behind a flag so that they can be disabled if required.

@chucker
Copy link
Author

chucker commented Sep 19, 2021

Good point — .master, too. And yes, it should be recursive (technically, the rules are more complex; e.g. App_Code should not contain markup).

@klinki
Copy link

klinki commented Sep 21, 2021

I believe .ashx should be also included

@chucker
Copy link
Author

chucker commented Sep 21, 2021

Possibly also resx, axd, config.

@CZEMacLeod
Copy link
Owner

@chucker .resx and web.config files were already handled. And .axd files do not actually exist - the URLs are just routed to a handler class by IIS.

@mcnallys
Copy link

@CZEMacLeod Thanks for the great work on this project. I updated to this version and noticed an issue after performing a publish.

In my project I end up with "bin\Release\Publish" as the output folder, however if turn on EnableWebFormsDefaultItems, once I publish it see's that published folder as content. Then each publish adds more content upon itself and eventually errors.

I have worked around this in some of my other globs by adding Exclude="$(DefaultItemExcludes)".

I recommend changing from:

<Content Include="**\*.asax" />
<Content Include="**\*.ascx" />
<Content Include="**\*.ashx" />
<Content Include="**\*.asmx" />
<Content Include="**\*.aspx" />
<Content Include="**\*.master" />

to

<Content Include="**\*.asax" Exclude="$(DefaultItemExcludes)" />
<Content Include="**\*.ascx" Exclude="$(DefaultItemExcludes)" />
<Content Include="**\*.ashx" Exclude="$(DefaultItemExcludes)" />
<Content Include="**\*.asmx" Exclude="$(DefaultItemExcludes)" />
<Content Include="**\*.aspx" Exclude="$(DefaultItemExcludes)" />
<Content Include="**\*.master" Exclude="$(DefaultItemExcludes)" />

@CZEMacLeod
Copy link
Owner

@mcnallys I've created a new issue #25 for this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants