aspnet_compiler incremental precompile - asp.net

I have a website project and I want to make aspnet_compiler precompile incrementally (right now it cleans out everything and recompile everything from scratch)
I tried to delete the -f flag, and use fixednames, but then it gave me this error error ASPRUNTIME: The target directory is not empty.
am I suppose to delete the target directory after each instance of precompiling?

Related

Dockerfile COPY ${source:-obj/Docker/publish} not finding the correct source after upgrade to 3.1

I am using Jenkins to build and deploy a .Net Core microservice application. For each microservice, I am building a docker container. My dockerfile has the following in it:
ARG source
COPY ${source:-obj/Docker/publish} .
Prior to upgrading from .Net Core 2.2 to 3.1, this worked. After the upgrade, when I try to deploy, I am getting the following error:
COPY failed: stat /var/lib/docker/tmp/docker-builder609391151/obj/Docker/publish: no such file or directory
script returned exit code 1
From what I've read, it looks like .Net Core 2.2 compiled into the /obj/Docker/publish directory, but .Net Core 3.1 compiles into the /bin/Release/netcoreapp3.1 directory, however the source is still pointing to /obj/Docker/publish. I'm trying to figure out where the source arguement is defined, and how I should change this.
Update:
I decided to leave the source out entirely and hard-code the build path. I changed the copy line to
COPY /var/lib/jenkins/jobs/fusion-core/branches/master/workspace/src/CustomerAPI/obj/Release/netcoreapp3.1 .
I'm still getting an error when I try to build the docker container that says
COPY failed: stat /var/lib/docker/tmp/docker-builder356954794/var/lib/jenkins/jobs/fusion-core/branches/master/workspace/src/CustomerAPI/obj/Release/netcoreapp3.1: no such file or directory
script returned exit code 1
I'm not sure where the "/var/lib/docker/tmp/docker-builder356954794" is coming from, or why it is appending it to the front of my path, but it doesn't exist.
Still not sure how to get around this.
Some debugging suggestions in no certain order.
Default Value
${source:-obj/Docker/publish} is bash syntax that evaluates to the value of the variable source if it was defined, or obj/Docker/publish if it was not.
I'm trying to figure out where the source argument is defined, and how I should change this.
If you can't find anything that defines it to another value, it just means that the default value obj/Docker/publish was being used.
Publish directory
3.1 still uses the publish directory, but it will be at bin/Release/netcoreapp3.1/publish. Use a RUN find -type d -iname publish to find the publish directories in your container.
Dont use the full path, it will change every build. See the tmp/docker-builder356954794 in the path?
The COPY command uses relative files, based on the path in your machine (outside the docker container). So use a path that's relative to where the context directory (or Dockerfile) is. If the dockerfile is at /var/lib/jenkins/jobs/fusion-core/branches/master/workspace/src/CustomerAPI/Dockerfile and the publish directory on your machine is at /var/lib/jenkins/jobs/fusion-core/branches/master/workspace/src/CustomerAPI/bin/Release/netcoreapp3.1/publish, then use a COPY command like this:
COPY bin/Release/netcoreapp3.1/publish .
Funny paths
I'm not sure where the "/var/lib/docker/tmp/docker-builder356954794" is coming from
Containers need to share files from one directory (in your host) to another (in your container). Depending on the container technology, it uses one or more file systems or file directories.
One of those is /var/lib/docker/tmp/...

What command can I use to remove a project in .NET Core?

What command can I use to remove a project in .NET Core?
The project I want to remove was created with the help of the command:
dotnet new webapi
Is it true that there is still no command for this? It was pointed out here.
When you run the command dotnet new [type], dotnet will create a project in whatever folder the current working directory is. (where [type] will be something like console or webapi)
You never want to run this command without first creating a sub-directory and changing to it or you will have a mess of files sitting somewhere you will wish they weren't. The amount of files and their names will depend on the type of project you are making.
If you make this mistake and don't know which files to delete, you can delete them individually.
Create a temporary directory and change to it.
Run the same dotnet new [type] command in that directory.
Looking at the files created in step #2, you will know what to delete.
If you made a sub-directory to begin with, you can simply:
(windows)rd /s /q <dirname>
(linux)rm -rf <dirname>
to clean up the mess.

How to run OwinHost from non-bin folder?

OwinHost.exe seems to only want to run against an application that lives in a folder called "bin". If I try against another folder e.g. "bin2", OwinHost says that it can't find the startup attribute.
I've tried running from within the bin2 folder, outside it, and tried the -d and -b arguments - nothing seems to work.

Visual Studio Team Services dotnet publish

My build completes with no errors, but it creates a randomly named zip file (s.zip) for the release step.
After the release step, I end up with that s.zip in inetpub/wwwroot/admin-tool/ folder. I'm almost there, but I want it to unzip and dump all the contents in here. This should be automatic, shouldn't it?
My dotnet publish looks like this:
and cause this to run, which is how I get the s.zip:
C:\Program Files\dotnet\dotnet.exe publish C:\agent\_work\3\s\Angular.AdminTool.csproj -c release --output C:\agent\_work\3\a\s
If I try to edit the -o argument and make it -o $(Build.ArtifactStagingDirectory)/admin-tool I will just end up with C:\agent\_work\3\a\admin-tool\s.zip
Is getting the name of my zip to be the same as the name of my web-site (admin-tool) the key to getting the zip to automatically extract in the release step?
In case it help others, I used the simple command line tools rather than the pre-canned "dotnet core" ones:
and for the Archive files task, be sure to include a hard-coded name for the zip to be used in the build process:
And for the release, in the "Deploy IIS App" task, be sure to include the full path for the zip file:
I also ran into this issue but solved it another way.
In my case I have a single project to build and deploy.
The $(Parameters.RestoreBuildProjects) value is set to a single project
MyProjectFolder/MyProject.csproj.
In the .Net Core Publish task, this value is used in the Path to Project(s) field.
Then I tick both the boxes for
I saved and queued this pipeline.
The zip file created seems to be derived from the name of the folder
so I ended up with a zip file in the artifact staging directory with the name of the project. Then the Publish Artifact task placed this zip file into the Artifact that is named in that task.

error ASPPARSE: Could not load type error with msbuild on teamcity

I'm receiving error ASPPARSE: Could not load type error when building a project on team city.
The file it is failing on is a folder which is not referenced in the project but is just there for source control.
C:\TC\Agents\3\work\fd3ea8938fa12582>C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_compiler -v /DummyDeployWeb -p C:\TC\Agents\3\work\fd3ea8938fa12582\Project C:\TC\Agents\3\work\fd3ea8938fa12582\PreCompiled\Project-fixednames -u
ERROR
/DummyDeployWeb/common/files/somefilename.ascx(1): error ASPPARSE: Could not load type 'Project.somefilename'
How can I get the project to build and ignore these folders that arent referenced?
The ASP.NET compiler knows nothing about project files, it simply processes the entire contents of the folder you point it at.
There is no way to tell the compiler to exclude specific files and so if this is a requirement for you then one solution would be to move these files out of the folder before you run the compiler and then copy them into the deployment folder after the compilation is complete.

Resources